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.

103 lines
3.5KB

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