|
| 1 | +/* |
| 2 | + ============================================================================== |
| 3 | +
|
| 4 | + This file contains the startup code for a PIP. |
| 5 | +
|
| 6 | + ============================================================================== |
| 7 | +*/ |
| 8 | + |
| 9 | +#include <JuceHeader.h> |
| 10 | +#include "DemoRunner.h" |
| 11 | + |
| 12 | +class Application : public juce::JUCEApplication |
| 13 | +{ |
| 14 | +public: |
| 15 | + //============================================================================== |
| 16 | + Application() = default; |
| 17 | + |
| 18 | + const juce::String getApplicationName() override { return "DemoRunner"; } |
| 19 | + const juce::String getApplicationVersion() override { return "3.1.0"; } |
| 20 | + |
| 21 | + void initialise (const juce::String&) override |
| 22 | + { |
| 23 | + mainWindow.reset (new MainWindow ("DemoRunner", new DemoRunner, *this)); |
| 24 | + } |
| 25 | + |
| 26 | + void shutdown() override { mainWindow = nullptr; } |
| 27 | + |
| 28 | +private: |
| 29 | + class MainWindow : public juce::DocumentWindow |
| 30 | + { |
| 31 | + public: |
| 32 | + MainWindow (const juce::String& name, juce::Component* c, JUCEApplication& a) |
| 33 | + : DocumentWindow (name, juce::Desktop::getInstance().getDefaultLookAndFeel() |
| 34 | + .findColour (ResizableWindow::backgroundColourId), |
| 35 | + juce::DocumentWindow::allButtons), |
| 36 | + app (a) |
| 37 | + { |
| 38 | + setUsingNativeTitleBar (true); |
| 39 | + setContentOwned (c, true); |
| 40 | + |
| 41 | + #if JUCE_ANDROID || JUCE_IOS |
| 42 | + setFullScreen (true); |
| 43 | + #else |
| 44 | + setResizable (true, false); |
| 45 | + setResizeLimits (300, 250, 10000, 10000); |
| 46 | + centreWithSize (getWidth(), getHeight()); |
| 47 | + #endif |
| 48 | + |
| 49 | + setVisible (true); |
| 50 | + } |
| 51 | + |
| 52 | + void closeButtonPressed() override |
| 53 | + { |
| 54 | + app.systemRequestedQuit(); |
| 55 | + } |
| 56 | + |
| 57 | + private: |
| 58 | + JUCEApplication& app; |
| 59 | + |
| 60 | + //============================================================================== |
| 61 | + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow) |
| 62 | + }; |
| 63 | + |
| 64 | + std::unique_ptr<MainWindow> mainWindow; |
| 65 | +}; |
| 66 | + |
| 67 | +//============================================================================== |
| 68 | +START_JUCE_APPLICATION (Application) |
0 commit comments