Audio plugin host https://kx.studio/carla
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.

112 lines
3.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. A component that draws an outline around itself and has an optional title at
  24. the top, for drawing an outline around a group of controls.
  25. */
  26. class JUCE_API GroupComponent : public Component
  27. {
  28. public:
  29. //==============================================================================
  30. /** Creates a GroupComponent.
  31. @param componentName the name to give the component
  32. @param labelText the text to show at the top of the outline
  33. */
  34. GroupComponent (const String& componentName = String(),
  35. const String& labelText = String());
  36. /** Destructor. */
  37. ~GroupComponent();
  38. //==============================================================================
  39. /** Changes the text that's shown at the top of the component. */
  40. void setText (const String& newText);
  41. /** Returns the currently displayed text label. */
  42. String getText() const;
  43. /** Sets the positioning of the text label.
  44. (The default is Justification::left)
  45. @see getTextLabelPosition
  46. */
  47. void setTextLabelPosition (Justification justification);
  48. /** Returns the current text label position.
  49. @see setTextLabelPosition
  50. */
  51. Justification getTextLabelPosition() const noexcept { return justification; }
  52. //==============================================================================
  53. /** A set of colour IDs to use to change the colour of various aspects of the component.
  54. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  55. methods.
  56. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  57. */
  58. enum ColourIds
  59. {
  60. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  61. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  62. };
  63. //==============================================================================
  64. /** This abstract base class is implemented by LookAndFeel classes. */
  65. struct JUCE_API LookAndFeelMethods
  66. {
  67. virtual ~LookAndFeelMethods() {}
  68. virtual void drawGroupComponentOutline (Graphics&, int w, int h, const String& text,
  69. const Justification&, GroupComponent&) = 0;
  70. };
  71. //==============================================================================
  72. /** @internal */
  73. void paint (Graphics&) override;
  74. /** @internal */
  75. void enablementChanged() override;
  76. /** @internal */
  77. void colourChanged() override;
  78. private:
  79. String text;
  80. Justification justification;
  81. JUCE_DECLARE_NON_COPYABLE (GroupComponent)
  82. };
  83. } // namespace juce