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.

84 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  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 button that can be toggled on/off.
  18. All buttons can be toggle buttons, but this lets you create one of the
  19. standard ones which has a tick-box and a text label next to it.
  20. @see Button, DrawableButton, TextButton
  21. @tags{GUI}
  22. */
  23. class JUCE_API ToggleButton : public Button
  24. {
  25. public:
  26. //==============================================================================
  27. /** Creates a ToggleButton. */
  28. ToggleButton();
  29. /** Creates a ToggleButton.
  30. @param buttonText the text to put in the button (the component's name is also
  31. initially set to this string, but these can be changed later
  32. using the setName() and setButtonText() methods)
  33. */
  34. explicit ToggleButton (const String& buttonText);
  35. /** Destructor. */
  36. ~ToggleButton() override;
  37. //==============================================================================
  38. /** Resizes the button to fit neatly around its current text.
  39. The button's height won't be affected, only its width.
  40. */
  41. void changeWidthToFitText();
  42. //==============================================================================
  43. /** A set of colour IDs to use to change the colour of various aspects of the button.
  44. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  45. methods.
  46. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  47. */
  48. enum ColourIds
  49. {
  50. textColourId = 0x1006501, /**< The colour to use for the button's text. */
  51. tickColourId = 0x1006502, /**< The colour to use for the tick mark. */
  52. tickDisabledColourId = 0x1006503 /**< The colour to use for the disabled tick mark and/or outline. */
  53. };
  54. protected:
  55. //==============================================================================
  56. /** @internal */
  57. void paintButton (Graphics&, bool, bool) override;
  58. /** @internal */
  59. void colourChanged() override;
  60. private:
  61. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToggleButton)
  62. };
  63. } // namespace juce