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.

104 lines
3.6KB

  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_JUCEHEADER__
  18. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  19. #include "../components/juce_Component.h"
  20. //==============================================================================
  21. /**
  22. A component that draws an outline around itself and has an optional title at
  23. the top, for drawing an outline around a group of controls.
  24. */
  25. class JUCE_API GroupComponent : public Component
  26. {
  27. public:
  28. //==============================================================================
  29. /** Creates a GroupComponent.
  30. @param componentName the name to give the component
  31. @param labelText the text to show at the top of the outline
  32. */
  33. GroupComponent (const String& componentName = String::empty,
  34. const String& labelText = String::empty);
  35. /** Destructor. */
  36. ~GroupComponent();
  37. //==============================================================================
  38. /** Changes the text that's shown at the top of the component. */
  39. void setText (const String& newText);
  40. /** Returns the currently displayed text label. */
  41. String getText() const;
  42. /** Sets the positioning of the text label.
  43. (The default is Justification::left)
  44. @see getTextLabelPosition
  45. */
  46. void setTextLabelPosition (const Justification& justification);
  47. /** Returns the current text label position.
  48. @see setTextLabelPosition
  49. */
  50. const Justification getTextLabelPosition() const noexcept { return justification; }
  51. //==============================================================================
  52. /** A set of colour IDs to use to change the colour of various aspects of the component.
  53. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  54. methods.
  55. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  56. */
  57. enum ColourIds
  58. {
  59. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  60. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  61. };
  62. //==============================================================================
  63. /** @internal */
  64. void paint (Graphics&) override;
  65. /** @internal */
  66. void enablementChanged() override;
  67. /** @internal */
  68. void colourChanged() override;
  69. private:
  70. String text;
  71. Justification justification;
  72. JUCE_DECLARE_NON_COPYABLE (GroupComponent)
  73. };
  74. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__