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.

99 lines
3.2KB

  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_COMPONENTEDITORTOOLBAR_H_6B5CA931__
  19. #define __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__
  20. //==============================================================================
  21. class ComponentEditorToolbarFactory : public ToolbarItemFactory
  22. {
  23. public:
  24. ComponentEditorToolbarFactory (ComponentEditor& editor_)
  25. : editor (editor_)
  26. {
  27. }
  28. ~ComponentEditorToolbarFactory()
  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 (createComponent);
  41. ids.add (showInfo);
  42. ids.add (showComponentTree);
  43. ids.add (separatorBarId);
  44. ids.add (spacerId);
  45. ids.add (flexibleSpacerId);
  46. }
  47. void getDefaultItemSet (Array <int>& ids)
  48. {
  49. ids.add (spacerId);
  50. ids.add (createComponent);
  51. ids.add (flexibleSpacerId);
  52. ids.add (showComponentTree);
  53. ids.add (showInfo);
  54. ids.add (spacerId);
  55. }
  56. ToolbarItemComponent* createItem (int itemId)
  57. {
  58. String name;
  59. int commandId = 0;
  60. switch (itemId)
  61. {
  62. case createComponent: name = "new"; break;
  63. case showInfo: name = "info"; commandId = CommandIDs::showOrHideProperties; break;
  64. case showComponentTree: name = "tree"; commandId = CommandIDs::showOrHideTree; break;
  65. default: jassertfalse; return 0;
  66. }
  67. ToolbarButton* b = new ToolbarButton (itemId, name, new DrawablePath(), 0);
  68. b->setCommandToTrigger (commandManager, commandId, true);
  69. return b;
  70. }
  71. private:
  72. ComponentEditor& editor;
  73. ComponentEditorToolbarFactory (const ComponentEditorToolbarFactory&);
  74. ComponentEditorToolbarFactory& operator= (const ComponentEditorToolbarFactory&);
  75. };
  76. #endif // __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__