Advertisement
Guest User

Main.cpp

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