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.

93 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 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. #ifndef __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__
  19. #define __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__
  20. //==============================================================================
  21. class DrawableEditorToolbarFactory : public ToolbarItemFactory
  22. {
  23. public:
  24. DrawableEditorToolbarFactory (DrawableEditor& editor_)
  25. : editor (editor_)
  26. {
  27. }
  28. ~DrawableEditorToolbarFactory()
  29. {
  30. }
  31. //==============================================================================
  32. enum DemoToolbarItemIds
  33. {
  34. createComponent = 1,
  35. showInfo = 2,
  36. showComponentTree = 3,
  37. };
  38. void getAllToolbarItemIds (Array <int>& ids)
  39. {
  40. ids.add (showInfo);
  41. ids.add (showComponentTree);
  42. ids.add (separatorBarId);
  43. ids.add (spacerId);
  44. ids.add (flexibleSpacerId);
  45. }
  46. void getDefaultItemSet (Array <int>& ids)
  47. {
  48. ids.add (spacerId);
  49. ids.add (flexibleSpacerId);
  50. ids.add (showComponentTree);
  51. ids.add (showInfo);
  52. ids.add (spacerId);
  53. }
  54. ToolbarItemComponent* createItem (int itemId)
  55. {
  56. String name;
  57. int commandId = 0;
  58. switch (itemId)
  59. {
  60. case showInfo: name = "info"; commandId = CommandIDs::showOrHideProperties; break;
  61. case showComponentTree: name = "tree"; commandId = CommandIDs::showOrHideTree; break;
  62. default: jassertfalse; return 0;
  63. }
  64. ToolbarButton* b = new ToolbarButton (itemId, name, new DrawablePath(), 0);
  65. b->setCommandToTrigger (commandManager, commandId, true);
  66. return b;
  67. }
  68. private:
  69. DrawableEditor& editor;
  70. };
  71. #endif // __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__