| 1 |
/* |
| 2 |
============================================================================== |
| 3 |
|
| 4 |
This file was auto-generated! |
| 5 |
|
| 6 |
It contains the basic startup code for a JUCE application. |
| 7 |
|
| 8 |
============================================================================== |
| 9 |
*/ |
| 10 |
|
| 11 |
#include "../JuceLibraryCode/JuceHeader.h" |
| 12 |
#include "ControlWindow.h" |
| 13 |
|
| 14 |
|
| 15 |
//============================================================================== |
| 16 |
class NewProjectApplication : public JUCEApplication |
| 17 |
{ |
| 18 |
public: |
| 19 |
//============================================================================== |
| 20 |
NewProjectApplication() {} |
| 21 |
|
| 22 |
const String getApplicationName() override { return ProjectInfo::projectName; } |
| 23 |
const String getApplicationVersion() override { return ProjectInfo::versionString; } |
| 24 |
bool moreThanOneInstanceAllowed() override { return true; } |
| 25 |
|
| 26 |
//============================================================================== |
| 27 |
void initialise (const String& commandLine) override |
| 28 |
{ |
| 29 |
// This method is where you should put your application's initialisation code.. |
| 30 |
|
| 31 |
mainWindow = new MainWindow (getApplicationName()); |
| 32 |
} |
| 33 |
|
| 34 |
void shutdown() override |
| 35 |
{ |
| 36 |
// Add your application's shutdown code here.. |
| 37 |
|
| 38 |
mainWindow = nullptr; // (deletes our window) |
| 39 |
} |
| 40 |
|
| 41 |
//============================================================================== |
| 42 |
void systemRequestedQuit() override |
| 43 |
{ |
| 44 |
// This is called when the app is being asked to quit: you can ignore this |
| 45 |
// request and let the app carry on running, or call quit() to allow the app to close. |
| 46 |
quit(); |
| 47 |
} |
| 48 |
|
| 49 |
void anotherInstanceStarted (const String& commandLine) override |
| 50 |
{ |
| 51 |
// When another instance of the app is launched while this one is running, |
| 52 |
// this method is invoked, and the commandLine parameter tells you what |
| 53 |
// the other instance's command-line arguments were. |
| 54 |
} |
| 55 |
|
| 56 |
//============================================================================== |
| 57 |
/* |
| 58 |
This class implements the desktop window that contains an instance of |
| 59 |
our MainComponent class. |
| 60 |
*/ |
| 61 |
class MainWindow : public DocumentWindow |
| 62 |
{ |
| 63 |
public: |
| 64 |
MainWindow (String name) : DocumentWindow (name, |
| 65 |
Desktop::getInstance().getDefaultLookAndFeel() |
| 66 |
.findColour (ResizableWindow::backgroundColourId), |
| 67 |
DocumentWindow::allButtons) |
| 68 |
{ |
| 69 |
setUsingNativeTitleBar (true); |
| 70 |
setContentOwned (new ControlWindow(), true); |
| 71 |
|
| 72 |
centreWithSize (getWidth(), getHeight()); |
| 73 |
setVisible (true); |
| 74 |
setResizable(true, true); |
| 75 |
} |
| 76 |
|
| 77 |
void closeButtonPressed() override |
| 78 |
{ |
| 79 |
// This is called when the user tries to close this window. Here, we'll just |
| 80 |
// ask the app to quit when this happens, but you can change this to do |
| 81 |
// whatever you need. |
| 82 |
JUCEApplication::getInstance()->systemRequestedQuit(); |
| 83 |
} |
| 84 |
|
| 85 |
/* Note: Be careful if you override any DocumentWindow methods - the base |
| 86 |
class uses a lot of them, so by overriding you might break its functionality. |
| 87 |
It's best to do all your work in your content component instead, but if |
| 88 |
you really have to override any DocumentWindow methods, make sure your |
| 89 |
subclass also calls the superclass's method. |
| 90 |
*/ |
| 91 |
|
| 92 |
private: |
| 93 |
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow) |
| 94 |
}; |
| 95 |
|
| 96 |
private: |
| 97 |
ScopedPointer<MainWindow> mainWindow; |
| 98 |
}; |
| 99 |
|
| 100 |
//============================================================================== |
| 101 |
// This macro generates the main() routine that launches the app. |
| 102 |
START_JUCE_APPLICATION (NewProjectApplication) |