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.

106 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. It contains the basic startup code for a JUCE application.
  5. ==============================================================================
  6. */
  7. %%app_headers%%
  8. //==============================================================================
  9. class %%app_class_name%% : public JUCEApplication
  10. {
  11. public:
  12. //==============================================================================
  13. %%app_class_name%%() {}
  14. const String getApplicationName() override { return ProjectInfo::projectName; }
  15. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  16. bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; }
  17. //==============================================================================
  18. void initialise (const String& commandLine) override
  19. {
  20. // This method is where you should put your application's initialisation code..
  21. mainWindow.reset (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 %%content_component_class%% 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 %%content_component_class%%(), true);
  56. #if JUCE_IOS || JUCE_ANDROID
  57. setFullScreen (true);
  58. #else
  59. setResizable (true, true);
  60. centreWithSize (getWidth(), getHeight());
  61. #endif
  62. setVisible (true);
  63. }
  64. void closeButtonPressed() override
  65. {
  66. // This is called when the user tries to close this window. Here, we'll just
  67. // ask the app to quit when this happens, but you can change this to do
  68. // whatever you need.
  69. JUCEApplication::getInstance()->systemRequestedQuit();
  70. }
  71. /* Note: Be careful if you override any DocumentWindow methods - the base
  72. class uses a lot of them, so by overriding you might break its functionality.
  73. It's best to do all your work in your content component instead, but if
  74. you really have to override any DocumentWindow methods, make sure your
  75. subclass also calls the superclass's method.
  76. */
  77. private:
  78. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  79. };
  80. private:
  81. std::unique_ptr<MainWindow> mainWindow;
  82. };
  83. //==============================================================================
  84. // This macro generates the main() routine that launches the app.
  85. START_JUCE_APPLICATION (%%app_class_name%%)