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.

109 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE examples.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. The code included in this file is provided under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  7. To use, copy, modify, and/or distribute this software for any purpose with or
  8. without fee is hereby granted provided that the above copyright notice and
  9. this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES,
  11. WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR
  12. PURPOSE, ARE DISCLAIMED.
  13. ==============================================================================
  14. */
  15. /*******************************************************************************
  16. The block below describes the properties of this PIP. A PIP is a short snippet
  17. of code that can be read by the Projucer and used to generate a JUCE project.
  18. BEGIN_JUCE_PIP_METADATA
  19. name: HelloWorldDemo
  20. version: 1.0.0
  21. vendor: JUCE
  22. website: http://juce.com
  23. description: Simple HelloWorld application.
  24. dependencies: juce_core, juce_data_structures, juce_events, juce_graphics,
  25. juce_gui_basics
  26. exporters: xcode_mac, vs2022, linux_make, xcode_iphone
  27. moduleFlags: JUCE_STRICT_REFCOUNTEDPOINTER=1
  28. type: Component
  29. mainClass: HelloWorldDemo
  30. useLocalCopy: 1
  31. END_JUCE_PIP_METADATA
  32. *******************************************************************************/
  33. #pragma once
  34. //==============================================================================
  35. class HelloWorldDemo final : public Component
  36. {
  37. public:
  38. //==============================================================================
  39. HelloWorldDemo()
  40. {
  41. addAndMakeVisible (helloWorldLabel);
  42. helloWorldLabel.setFont (Font (40.00f, Font::bold));
  43. helloWorldLabel.setJustificationType (Justification::centred);
  44. helloWorldLabel.setEditable (false, false, false);
  45. helloWorldLabel.setColour (Label::textColourId, Colours::black);
  46. helloWorldLabel.setColour (TextEditor::textColourId, Colours::black);
  47. helloWorldLabel.setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  48. addAndMakeVisible (quitButton);
  49. quitButton.onClick = [] { JUCEApplication::quit(); };
  50. setSize (600, 300);
  51. }
  52. //==============================================================================
  53. void paint (Graphics& g) override
  54. {
  55. g.fillAll (Colour (0xffc1d0ff));
  56. g.setColour (Colours::white);
  57. g.fillPath (internalPath);
  58. g.setColour (Colour (0xff6f6f6f));
  59. g.strokePath (internalPath, PathStrokeType (5.200f));
  60. }
  61. void resized() override
  62. {
  63. helloWorldLabel.setBounds (152, 80, 296, 48);
  64. quitButton.setBounds (getWidth() - 176, getHeight() - 60, 120, 32);
  65. internalPath.clear();
  66. internalPath.startNewSubPath (136.0f, 80.0f);
  67. internalPath.quadraticTo (176.0f, 24.0f, 328.0f, 32.0f);
  68. internalPath.quadraticTo (472.0f, 40.0f, 472.0f, 104.0f);
  69. internalPath.quadraticTo (472.0f, 192.0f, 232.0f, 176.0f);
  70. internalPath.lineTo (184.0f, 216.0f);
  71. internalPath.lineTo (200.0f, 168.0f);
  72. internalPath.quadraticTo (96.0f, 136.0f, 136.0f, 80.0f);
  73. internalPath.closeSubPath();
  74. }
  75. private:
  76. //==============================================================================
  77. Label helloWorldLabel { {}, TRANS ("Hello World!") };
  78. TextButton quitButton { TRANS ("Quit") };
  79. Path internalPath;
  80. //==============================================================================
  81. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HelloWorldDemo)
  82. };