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.

168 lines
5.7KB

  1. /*
  2. ==============================================================================
  3. This is an automatically generated GUI class created by the Projucer!
  4. Be careful when adding custom code to these files, as only the code within
  5. the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
  6. and re-saved.
  7. Created with Projucer version: 4.2.1
  8. ------------------------------------------------------------------------------
  9. The Projucer is part of the JUCE library - "Jules' Utility Class Extensions"
  10. Copyright (c) 2015 - ROLI Ltd.
  11. ==============================================================================
  12. */
  13. //[Headers] You can add your own extra header files here...
  14. //[/Headers]
  15. #include "MainComponent.h"
  16. //[MiscUserDefs] You can add your own user definitions and misc code here...
  17. //[/MiscUserDefs]
  18. //==============================================================================
  19. MainComponent::MainComponent ()
  20. {
  21. //[Constructor_pre] You can add your own custom stuff here..
  22. //[/Constructor_pre]
  23. addAndMakeVisible (helloWorldLabel = new Label (String(),
  24. TRANS("Hello World!")));
  25. helloWorldLabel->setFont (Font (40.00f, Font::bold));
  26. helloWorldLabel->setJustificationType (Justification::centred);
  27. helloWorldLabel->setEditable (false, false, false);
  28. helloWorldLabel->setColour (Label::textColourId, Colours::black);
  29. helloWorldLabel->setColour (TextEditor::textColourId, Colours::black);
  30. helloWorldLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  31. addAndMakeVisible (quitButton = new TextButton (String()));
  32. quitButton->setButtonText (TRANS("Quit"));
  33. quitButton->addListener (this);
  34. //[UserPreSize]
  35. //[/UserPreSize]
  36. setSize (600, 300);
  37. //[Constructor] You can add your own custom stuff here..
  38. //[/Constructor]
  39. }
  40. MainComponent::~MainComponent()
  41. {
  42. //[Destructor_pre]. You can add your own custom destruction code here..
  43. //[/Destructor_pre]
  44. helloWorldLabel = nullptr;
  45. quitButton = nullptr;
  46. //[Destructor]. You can add your own custom destruction code here..
  47. //[/Destructor]
  48. }
  49. //==============================================================================
  50. void MainComponent::paint (Graphics& g)
  51. {
  52. //[UserPrePaint] Add your own custom painting code here..
  53. //[/UserPrePaint]
  54. g.fillAll (Colour (0xffc1d0ff));
  55. g.setColour (Colours::white);
  56. g.fillPath (internalPath1);
  57. g.setColour (Colour (0xff6f6f6f));
  58. g.strokePath (internalPath1, PathStrokeType (5.200f));
  59. //[UserPaint] Add your own custom painting code here..
  60. //[/UserPaint]
  61. }
  62. void MainComponent::resized()
  63. {
  64. //[UserPreResize] Add your own custom resize code here..
  65. //[/UserPreResize]
  66. helloWorldLabel->setBounds (152, 80, 296, 48);
  67. quitButton->setBounds (getWidth() - 176, getHeight() - 60, 120, 32);
  68. internalPath1.clear();
  69. internalPath1.startNewSubPath (136.0f, 80.0f);
  70. internalPath1.quadraticTo (176.0f, 24.0f, 328.0f, 32.0f);
  71. internalPath1.quadraticTo (472.0f, 40.0f, 472.0f, 104.0f);
  72. internalPath1.quadraticTo (472.0f, 192.0f, 232.0f, 176.0f);
  73. internalPath1.lineTo (184.0f, 216.0f);
  74. internalPath1.lineTo (200.0f, 168.0f);
  75. internalPath1.quadraticTo (96.0f, 136.0f, 136.0f, 80.0f);
  76. internalPath1.closeSubPath();
  77. //[UserResized] Add your own custom resize handling here..
  78. //[/UserResized]
  79. }
  80. void MainComponent::buttonClicked (Button* buttonThatWasClicked)
  81. {
  82. //[UserbuttonClicked_Pre]
  83. //[/UserbuttonClicked_Pre]
  84. if (buttonThatWasClicked == quitButton)
  85. {
  86. //[UserButtonCode_quitButton] -- add your button handler code here..
  87. JUCEApplication::quit();
  88. //[/UserButtonCode_quitButton]
  89. }
  90. //[UserbuttonClicked_Post]
  91. //[/UserbuttonClicked_Post]
  92. }
  93. //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
  94. //[/MiscUserCode]
  95. //==============================================================================
  96. #if 0
  97. /* -- Projucer information section --
  98. This is where the Projucer stores the metadata that describe this GUI layout, so
  99. make changes in here at your peril!
  100. BEGIN_JUCER_METADATA
  101. <JUCER_COMPONENT documentType="Component" className="MainComponent" componentName=""
  102. parentClasses="public Component" constructorParams="" variableInitialisers=""
  103. snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
  104. fixedSize="1" initialWidth="600" initialHeight="300">
  105. <BACKGROUND backgroundColour="ffc1d0ff">
  106. <PATH pos="0 0 100 100" fill="solid: ffffffff" hasStroke="1" stroke="5.2, mitered, butt"
  107. strokeColour="solid: ff6f6f6f" nonZeroWinding="1">s 136 80 q 176 24 328 32 q 472 40 472 104 q 472 192 232 176 l 184 216 l 200 168 q 96 136 136 80 x</PATH>
  108. </BACKGROUND>
  109. <LABEL name="" id="be4f6f2e5725a063" memberName="helloWorldLabel" virtualName=""
  110. explicitFocusOrder="0" pos="152 80 296 48" textCol="ff000000"
  111. edTextCol="ff000000" edBkgCol="0" labelText="Hello World!" editableSingleClick="0"
  112. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  113. fontsize="40" bold="1" italic="0" justification="36"/>
  114. <TEXTBUTTON name="" id="bcf4f7b0888effe5" memberName="quitButton" virtualName=""
  115. explicitFocusOrder="0" pos="176R 60R 120 32" buttonText="Quit"
  116. connectedEdges="0" needsCallback="1" radioGroupId="0"/>
  117. </JUCER_COMPONENT>
  118. END_JUCER_METADATA
  119. */
  120. #endif
  121. //[EndFile] You can add extra defines here...
  122. //[/EndFile]