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.

69 lines
2.2KB

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