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.

113 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  19. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  20. #include "../components/juce_Component.h"
  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::empty,
  35. const String& labelText = String::empty);
  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 (const Justification& justification);
  48. /** Returns the current text label position.
  49. @see setTextLabelPosition
  50. */
  51. const 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. struct Ids
  65. {
  66. static const Identifier tagType, text, justification;
  67. };
  68. void refreshFromValueTree (const ValueTree&, ComponentBuilder&);
  69. //==============================================================================
  70. /** @internal */
  71. void paint (Graphics& g);
  72. /** @internal */
  73. void enablementChanged();
  74. /** @internal */
  75. void colourChanged();
  76. private:
  77. String text;
  78. Justification justification;
  79. JUCE_DECLARE_NON_COPYABLE (GroupComponent);
  80. };
  81. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__