Add remaining files
[juce-lv2.git] / juce / source / src / gui / components / controls / juce_ToolbarItemFactory.h
blob619aff6c180d727e9f5ce25a453feb3af1b2a780
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
27 #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
29 #include "juce_ToolbarItemComponent.h"
32 //==============================================================================
33 /**
34 A factory object which can create ToolbarItemComponent objects.
36 A subclass of ToolbarItemFactory publishes a set of types of toolbar item
37 that it can create.
39 Each type of item is identified by a unique ID, and multiple instances of an
40 item type can exist at once (even on the same toolbar, e.g. spacers or separator
41 bars).
43 @see Toolbar, ToolbarItemComponent, ToolbarButton
45 class JUCE_API ToolbarItemFactory
47 public:
48 //==============================================================================
49 ToolbarItemFactory();
51 /** Destructor. */
52 virtual ~ToolbarItemFactory();
54 //==============================================================================
55 /** A set of reserved item ID values, used for the built-in item types.
57 enum SpecialItemIds
59 separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
60 can be placed between sets of items to break them into groups. */
61 spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
62 items.*/
63 flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
64 either side of it, filling any available space. */
67 //==============================================================================
68 /** Must return a list of the IDs for all the item types that this factory can create.
70 The ids should be added to the array that is passed-in.
72 An item ID can be any integer you choose, except for 0, which is considered a null ID,
73 and the predefined IDs in the SpecialItemIds enum.
75 You should also add the built-in types (separatorBarId, spacerId and flexibleSpacerId)
76 to this list if you want your toolbar to be able to contain those items.
78 The list returned here is used by the ToolbarItemPalette class to obtain its list
79 of available items, and their order on the palette will reflect the order in which
80 they appear on this list.
82 @see ToolbarItemPalette
84 virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
86 /** Must return the set of items that should be added to a toolbar as its default set.
88 This method is used by Toolbar::addDefaultItems() to determine which items to
89 create.
91 The items that your method adds to the array that is passed-in will be added to the
92 toolbar in the same order. Items can appear in the list more than once.
94 virtual void getDefaultItemSet (Array <int>& ids) = 0;
96 /** Must create an instance of one of the items that the factory lists in its
97 getAllToolbarItemIds() method.
99 The itemId parameter can be any of the values listed by your getAllToolbarItemIds()
100 method, except for the built-in item types from the SpecialItemIds enum, which
101 are created internally by the toolbar code.
103 Try not to keep a pointer to the object that is returned, as it will be deleted
104 automatically by the toolbar, and remember that multiple instances of the same
105 item type are likely to exist at the same time.
107 virtual ToolbarItemComponent* createItem (int itemId) = 0;
111 #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__