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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #pragma once
  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(),
  34. const String& labelText = String());
  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 (Justification justification);
  47. /** Returns the current text label position.
  48. @see setTextLabelPosition
  49. */
  50. 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. /** This abstract base class is implemented by LookAndFeel classes. */
  64. struct JUCE_API LookAndFeelMethods
  65. {
  66. virtual ~LookAndFeelMethods() {}
  67. virtual void drawGroupComponentOutline (Graphics&, int w, int h, const String& text,
  68. const Justification&, GroupComponent&) = 0;
  69. };
  70. //==============================================================================
  71. /** @internal */
  72. void paint (Graphics&) override;
  73. /** @internal */
  74. void enablementChanged() override;
  75. /** @internal */
  76. void colourChanged() override;
  77. private:
  78. String text;
  79. Justification justification;
  80. JUCE_DECLARE_NON_COPYABLE (GroupComponent)
  81. };