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_ButtonPropertyComponent.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 PropertyComponent that contains a button.
  18. This type of property component can be used if you need a button to trigger some
  19. kind of action.
  20. @see PropertyComponent
  21. @tags{GUI}
  22. */
  23. class JUCE_API ButtonPropertyComponent : public PropertyComponent
  24. {
  25. public:
  26. //==============================================================================
  27. /** Creates a button component.
  28. @param propertyName the property name to be passed to the PropertyComponent
  29. @param triggerOnMouseDown this is passed to the Button::setTriggeredOnMouseDown() method
  30. */
  31. ButtonPropertyComponent (const String& propertyName,
  32. bool triggerOnMouseDown);
  33. /** Destructor. */
  34. ~ButtonPropertyComponent() override;
  35. //==============================================================================
  36. /** Called when the user clicks the button.
  37. */
  38. virtual void buttonClicked() = 0;
  39. /** Returns the string that should be displayed in the button.
  40. If you need to change this string, call refresh() to update the component.
  41. */
  42. virtual String getButtonText() const = 0;
  43. //==============================================================================
  44. /** @internal */
  45. void refresh() override;
  46. private:
  47. TextButton button;
  48. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ButtonPropertyComponent)
  49. };
  50. } // namespace juce