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.

85 lines
3.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. class TextButtonHandler : public ButtonHandler
  19. {
  20. public:
  21. TextButtonHandler()
  22. : ButtonHandler ("Text Button", "TextButton", typeid (TextButton), 150, 24)
  23. {
  24. registerColour (TextButton::buttonColourId, "background (normal)", "bgColOff");
  25. registerColour (TextButton::buttonOnColourId, "background (on)", "bgColOn");
  26. registerColour (TextButton::textColourOnId, "text colour (normal)", "textCol");
  27. registerColour (TextButton::textColourOffId, "text colour (on)", "textColOn");
  28. }
  29. Component* createNewComponent (JucerDocument*)
  30. {
  31. return new TextButton ("new button", String::empty);
  32. }
  33. void getEditableProperties (Component* component, JucerDocument& document, Array <PropertyComponent*>& properties)
  34. {
  35. ButtonHandler::getEditableProperties (component, document, properties);
  36. addColourProperties (component, document, properties);
  37. }
  38. XmlElement* createXmlFor (Component* comp, const ComponentLayout* layout)
  39. {
  40. XmlElement* e = ButtonHandler::createXmlFor (comp, layout);
  41. //TextButton* tb = (TextButton*) comp;
  42. return e;
  43. }
  44. bool restoreFromXml (const XmlElement& xml, Component* comp, const ComponentLayout* layout)
  45. {
  46. if (! ButtonHandler::restoreFromXml (xml, comp, layout))
  47. return false;
  48. //TextButton* tb = (TextButton*) comp;
  49. return true;
  50. }
  51. void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName)
  52. {
  53. ButtonHandler::fillInCreationCode (code, component, memberVariableName);
  54. //TextButton* const tb = dynamic_cast <TextButton*> (component);
  55. //TextButton defaultButton (String::empty);
  56. String s;
  57. s << getColourIntialisationCode (component, memberVariableName)
  58. << '\n';
  59. code.constructorCode += s;
  60. }
  61. };