The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.8KB

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