Advertisement
Guest User

Untitled

a guest
Mar 27th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1. #include "../JuceLibraryCode/JuceHeader.h"
  2. #include "MainComponent.h"
  3.  
  4.  
  5. class viewportApplication  : public JUCEApplication
  6. {
  7. public:
  8.  
  9.     viewportApplication() {}
  10.  
  11.     const String getApplicationName() override       { return ProjectInfo::projectName; }
  12.     const String getApplicationVersion() override    { return ProjectInfo::versionString; }
  13.     bool moreThanOneInstanceAllowed() override       { return true; }
  14.  
  15.  
  16.     void initialise (const String& commandLine) override
  17.     {
  18.         mainWindow = new MainWindow (getApplicationName());
  19.     }
  20.  
  21.  
  22.     void shutdown() override
  23.     {
  24.         mainWindow = nullptr; // (deletes our window)
  25.     }
  26.  
  27.  
  28.     void systemRequestedQuit() override
  29.     {
  30.         quit();
  31.     }
  32.  
  33.     void anotherInstanceStarted (const String& commandLine) override
  34.     {
  35.     }
  36.  
  37.  
  38.  
  39.     class MainWindow    : public DocumentWindow
  40.     {
  41.     public:
  42.         MainWindow (String name)  : DocumentWindow (name,
  43.                                                     Desktop::getInstance().getDefaultLookAndFeel()
  44.                                                                           .findColour (ResizableWindow::backgroundColourId),
  45.                                                     DocumentWindow::allButtons)
  46.         {
  47.             setUsingNativeTitleBar (true);
  48.             setContentOwned (new MainComponent(), true);
  49.  
  50.             centreWithSize (getWidth(), getHeight());
  51.             setVisible (true);
  52.         }
  53.  
  54.         void closeButtonPressed() override
  55.         {
  56.             JUCEApplication::getInstance()->systemRequestedQuit();
  57.         }
  58.  
  59.     private:
  60.         JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  61.     };
  62.  
  63. private:
  64.     ScopedPointer<MainWindow> mainWindow;
  65. };
  66.  
  67.  
  68. START_JUCE_APPLICATION (viewportApplication)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement