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.

juce_GroupComponent.h 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_GROUPCOMPONENT_H_INCLUDED
  18. #define JUCE_GROUPCOMPONENT_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A component that draws an outline around itself and has an optional title at
  22. the top, for drawing an outline around a group of controls.
  23. */
  24. class JUCE_API GroupComponent : public Component
  25. {
  26. public:
  27. //==============================================================================
  28. /** Creates a GroupComponent.
  29. @param componentName the name to give the component
  30. @param labelText the text to show at the top of the outline
  31. */
  32. GroupComponent (const String& componentName = String::empty,
  33. const String& labelText = String::empty);
  34. /** Destructor. */
  35. ~GroupComponent();
  36. //==============================================================================
  37. /** Changes the text that's shown at the top of the component. */
  38. void setText (const String& newText);
  39. /** Returns the currently displayed text label. */
  40. String getText() const;
  41. /** Sets the positioning of the text label.
  42. (The default is Justification::left)
  43. @see getTextLabelPosition
  44. */
  45. void setTextLabelPosition (Justification justification);
  46. /** Returns the current text label position.
  47. @see setTextLabelPosition
  48. */
  49. Justification getTextLabelPosition() const noexcept { return justification; }
  50. //==============================================================================
  51. /** A set of colour IDs to use to change the colour of various aspects of the component.
  52. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  53. methods.
  54. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  55. */
  56. enum ColourIds
  57. {
  58. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  59. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  60. };
  61. //==============================================================================
  62. /** This abstract base class is implemented by LookAndFeel classes. */
  63. struct JUCE_API LookAndFeelMethods
  64. {
  65. virtual ~LookAndFeelMethods() {}
  66. virtual void drawGroupComponentOutline (Graphics&, int w, int h, const String& text,
  67. const Justification&, GroupComponent&) = 0;
  68. };
  69. //==============================================================================
  70. /** @internal */
  71. void paint (Graphics&) override;
  72. /** @internal */
  73. void enablementChanged() override;
  74. /** @internal */
  75. void colourChanged() override;
  76. private:
  77. String text;
  78. Justification justification;
  79. JUCE_DECLARE_NON_COPYABLE (GroupComponent)
  80. };
  81. #endif // JUCE_GROUPCOMPONENT_H_INCLUDED