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.

73 lines
2.5KB

  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. #pragma once
  14. //==============================================================================
  15. class TextButtonHandler : public ButtonHandler
  16. {
  17. public:
  18. TextButtonHandler()
  19. : ButtonHandler ("Text Button", "juce::TextButton", typeid (TextButton), 150, 24)
  20. {
  21. registerColour (TextButton::buttonColourId, "background (normal)", "bgColOff");
  22. registerColour (TextButton::buttonOnColourId, "background (on)", "bgColOn");
  23. registerColour (TextButton::textColourOffId, "text colour (normal)", "textCol");
  24. registerColour (TextButton::textColourOnId, "text colour (on)", "textColOn");
  25. }
  26. Component* createNewComponent (JucerDocument*) override
  27. {
  28. return new TextButton ("new button", String());
  29. }
  30. void getEditableProperties (Component* component, JucerDocument& document,
  31. Array<PropertyComponent*>& props, bool multipleSelected) override
  32. {
  33. ButtonHandler::getEditableProperties (component, document, props, multipleSelected);
  34. if (multipleSelected)
  35. return;
  36. addColourProperties (component, document, props);
  37. }
  38. XmlElement* createXmlFor (Component* comp, const ComponentLayout* layout) override
  39. {
  40. return ButtonHandler::createXmlFor (comp, layout);
  41. }
  42. bool restoreFromXml (const XmlElement& xml, Component* comp, const ComponentLayout* layout) override
  43. {
  44. return ButtonHandler::restoreFromXml (xml, comp, layout);
  45. }
  46. void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) override
  47. {
  48. ButtonHandler::fillInCreationCode (code, component, memberVariableName);
  49. String s;
  50. s << getColourIntialisationCode (component, memberVariableName)
  51. << '\n';
  52. code.constructorCode += s;
  53. }
  54. };