]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxToolBar
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 enum wxToolBarToolStyle
11 wxTOOL_STYLE_BUTTON
= 1,
12 wxTOOL_STYLE_SEPARATOR
= 2,
17 /** wxToolBar style flags */
20 /** lay out the toolbar horizontally */
24 /** lay out the toolbar vertically */
28 /** show 3D buttons (wxToolBarSimple only) */
31 /** "flat" buttons (Win32/GTK only) */
34 /** dockable toolbar (GTK only) */
37 /** don't show the icons (they're shown by default) */
40 /** show the text (not shown by default) */
43 /** don't show the divider between toolbar and the window (Win32 only) */
46 /** no automatic alignment (Win32 only, useless) */
49 /** show the text and the icons alongside, not vertically stacked (Win32/GTK) */
53 /** don't show the toolbar short help tooltips */
56 /** lay out toolbar at the bottom of the window */
59 /** lay out toolbar at the right edge of the window */
66 @class wxToolBarToolBase
68 A toolbar tool represents one item on the toolbar.
70 It has a unique id (except for the separators), the style (telling whether
71 it is a normal button, separator or a control), the state (toggled or not,
72 enabled or not) and short and long help strings. The default
73 implementations use the short help string for the tooltip text which is
74 popped up when the mouse pointer enters the tool and the long help string
75 for the applications status bar.
77 class wxToolBarToolBase
: public wxObject
80 wxToolBarToolBase(wxToolBarBase
*tbar
= NULL
,
81 int toolid
= wxID_SEPARATOR
,
82 const wxString
& label
= wxEmptyString
,
83 const wxBitmap
& bmpNormal
= wxNullBitmap
,
84 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
85 wxItemKind kind
= wxITEM_NORMAL
,
86 wxObject
*clientData
= NULL
,
87 const wxString
& shortHelpString
= wxEmptyString
,
88 const wxString
& longHelpString
= wxEmptyString
);
90 wxToolBarToolBase(wxToolBarBase
*tbar
,
92 const wxString
& label
);
94 virtual ~wxToolBarToolBase();
98 wxControl
*GetControl() const;
99 wxToolBarBase
*GetToolBar() const;
101 bool IsStretchable() const;
102 bool IsButton() const;
103 bool IsControl() const;
104 bool IsSeparator() const;
105 bool IsStretchableSpace() const;
106 int GetStyle() const;
107 wxItemKind
GetKind() const;
108 void MakeStretchable();
110 bool IsEnabled() const;
111 bool IsToggled() const;
112 bool CanBeToggled() const;
114 const wxBitmap
& GetNormalBitmap() const;
115 const wxBitmap
& GetDisabledBitmap() const;
117 const wxBitmap
& GetBitmap() const;
118 const wxString
& GetLabel() const;
120 const wxString
& GetShortHelp() const;
121 const wxString
& GetLongHelp() const;
123 wxObject
*GetClientData() const;
125 virtual bool Enable(bool enable
);
126 virtual bool Toggle(bool toggle
);
127 virtual bool SetToggle(bool toggle
);
128 virtual bool SetShortHelp(const wxString
& help
);
129 virtual bool SetLongHelp(const wxString
& help
);
131 virtual void SetNormalBitmap(const wxBitmap
& bmp
);
132 virtual void SetDisabledBitmap(const wxBitmap
& bmp
);
133 virtual void SetLabel(const wxString
& label
);
134 void SetClientData(wxObject
*clientData
);
136 virtual void Detach();
137 virtual void Attach(wxToolBarBase
*tbar
);
139 virtual void SetDropdownMenu(wxMenu
*menu
);
140 wxMenu
*GetDropdownMenu() const;
149 A toolbar is a bar of buttons and/or other controls usually placed below
150 the menu bar in a wxFrame.
152 You may create a toolbar that is managed by a frame calling
153 wxFrame::CreateToolBar(). Under Pocket PC, you should always use this
154 function for creating the toolbar to be managed by the frame, so that
155 wxWidgets can use a combined menubar and toolbar. Where you manage your
156 own toolbars, create wxToolBar as usual.
158 There are several different types of tools you can add to a toolbar.
159 These types are controlled by the ::wxItemKind enumeration.
161 Note that many methods in wxToolBar such as wxToolBar::AddTool return a
162 @c wxToolBarToolBase* object.
163 This should be regarded as an opaque handle representing the newly added
164 toolbar item, providing access to its id and position within the toolbar.
165 Changes to the item's state should be made through calls to wxToolBar methods,
166 for example wxToolBar::EnableTool.
167 Calls to @c wxToolBarToolBase methods (undocumented by purpose) will not change
168 the visible state of the item within the tool bar.
170 <b>wxMSW note</b>: Note that under wxMSW toolbar paints tools to reflect
171 system-wide colours. If you use more than 16 colours in your tool bitmaps,
172 you may wish to suppress this behaviour, otherwise system colours in your
173 bitmaps will inadvertently be mapped to system colours.
174 To do this, set the msw.remap system option before creating the toolbar:
176 wxSystemOptions::SetOption("msw.remap", 0);
178 If you wish to use 32-bit images (which include an alpha channel for
181 wxSystemOptions::SetOption("msw.remap", 2);
183 Then colour remapping is switched off, and a transparent background
184 used. But only use this option under Windows XP with true colour:
186 if (wxTheApp->GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
191 Gives the toolbar a flat look (Windows and GTK only).
192 @style{wxTB_DOCKABLE}
193 Makes the toolbar floatable and dockable (GTK only).
194 @style{wxTB_HORIZONTAL}
195 Specifies horizontal layout (default).
196 @style{wxTB_VERTICAL}
197 Specifies vertical layout.
199 Shows the text in the toolbar buttons; by default only icons are shown.
201 Specifies no icons in the toolbar buttons; by default they are shown.
202 @style{wxTB_NODIVIDER}
203 Specifies no divider (border) above the toolbar (Windows only)
205 Specifies no alignment with the parent window (Windows only, not very
207 @style{wxTB_HORZ_LAYOUT}
208 Shows the text and the icons alongside, not vertically stacked (Windows
209 and GTK 2 only). This style must be used with @c wxTB_TEXT.
210 @style{wxTB_HORZ_TEXT}
211 Combination of @c wxTB_HORZ_LAYOUT and @c wxTB_TEXT.
212 @style{wxTB_NO_TOOLTIPS}
213 Don't show the short help tooltips for the tools when the mouse hovers
216 Align the toolbar at the bottom of parent window.
218 Align the toolbar at the right side of parent window.
221 See also @ref overview_windowstyles. Note that the wxMSW native toolbar
222 ignores @c wxTB_NOICONS style. Also, toggling the @c wxTB_TEXT works only
223 if the style was initially on.
225 @beginEventEmissionTable{wxCommandEvent}
226 @event{EVT_TOOL(id, func)}
227 Process a @c wxEVT_COMMAND_TOOL_CLICKED event (a synonym for @c
228 wxEVT_COMMAND_MENU_SELECTED). Pass the id of the tool.
229 @event{EVT_MENU(id, func)}
230 The same as EVT_TOOL().
231 @event{EVT_TOOL_RANGE(id1, id2, func)}
232 Process a @c wxEVT_COMMAND_TOOL_CLICKED event for a range of
233 identifiers. Pass the ids of the tools.
234 @event{EVT_MENU_RANGE(id1, id2, func)}
235 The same as EVT_TOOL_RANGE().
236 @event{EVT_TOOL_RCLICKED(id, func)}
237 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event. Pass the id of the
238 tool. (Not available on wxOSX.)
239 @event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
240 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event for a range of ids. Pass
241 the ids of the tools. (Not available on wxOSX.)
242 @event{EVT_TOOL_ENTER(id, func)}
243 Process a @c wxEVT_COMMAND_TOOL_ENTER event. Pass the id of the toolbar
244 itself. The value of wxCommandEvent::GetSelection() is the tool id, or
245 -1 if the mouse cursor has moved off a tool. (Not available on wxOSX.)
246 @event{EVT_TOOL_DROPDOWN(id, func)}
247 Process a @c wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED event. If unhandled,
248 displays the default dropdown menu set using
249 wxToolBar::SetDropdownMenu().
252 The toolbar class emits menu commands in the same way that a frame menubar
253 does, so you can use one EVT_MENU() macro for both a menu item and a toolbar
254 button. The event handler functions take a wxCommandEvent argument. For most
255 event macros, the identifier of the tool is passed, but for EVT_TOOL_ENTER()
256 the toolbar window identifier is passed and the tool identifier is retrieved
257 from the wxCommandEvent. This is because the identifier may be @c wxID_ANY when the
258 mouse moves off a tool, and @c wxID_ANY is not allowed as an identifier in the event
264 @see @ref overview_toolbar
266 class wxToolBar
: public wxControl
275 Constructs a toolbar.
278 Pointer to a parent window.
280 Window identifier. If -1, will automatically create an identifier.
282 Window position. ::wxDefaultPosition indicates that wxWidgets should
283 generate a default position for the window.
284 If using the wxWindow class directly, supply an actual position.
286 Window size. ::wxDefaultSize indicates that wxWidgets should generate
287 a default size for the window.
289 Window style. See wxToolBar initial description for details.
293 @remarks After a toolbar is created, you use AddTool() and perhaps
294 AddSeparator(), and then you must call Realize() to construct
295 and display the toolbar tools.
297 wxToolBar(wxWindow
* parent
, wxWindowID id
,
298 const wxPoint
& pos
= wxDefaultPosition
,
299 const wxSize
& size
= wxDefaultSize
,
300 long style
= wxTB_HORIZONTAL
,
301 const wxString
& name
= wxToolBarNameStr
);
306 virtual ~wxToolBar();
309 Adds a new check (or toggle) tool to the toolbar. The parameters are the
310 same as in AddTool().
314 wxToolBarToolBase
* AddCheckTool(int toolId
, const wxString
& label
,
315 const wxBitmap
& bitmap1
,
316 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
317 const wxString
& shortHelp
= wxEmptyString
,
318 const wxString
& longHelp
= wxEmptyString
,
319 wxObject
* clientData
= NULL
);
322 Adds any control to the toolbar, typically e.g. a wxComboBox.
325 The control to be added.
327 Text to be displayed near the control.
330 wxMSW: the label is only displayed if there is enough space
331 available below the embedded control.
334 wxMac: labels are only displayed if wxWidgets is built with @c
335 wxMAC_USE_NATIVE_TOOLBAR set to 1
337 virtual wxToolBarToolBase
* AddControl(wxControl
* control
,
338 const wxString
& label
= wxEmptyString
);
341 Adds a new radio tool to the toolbar. Consecutive radio tools form a
342 radio group such that exactly one button in the group is pressed at any
343 moment, in other words whenever a button in the group is pressed the
344 previously pressed button is automatically released. You should avoid
345 having the radio groups of only one element as it would be impossible
346 for the user to use such button.
348 By default, the first button in the radio group is initially pressed,
354 wxToolBarToolBase
* AddRadioTool(int toolId
, const wxString
& label
,
355 const wxBitmap
& bitmap1
,
356 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
357 const wxString
& shortHelp
= wxEmptyString
,
358 const wxString
& longHelp
= wxEmptyString
,
359 wxObject
* clientData
= NULL
);
362 Adds a separator for spacing groups of tools.
364 Notice that the separator uses the look appropriate for the current
365 platform so it can be a vertical line (MSW, some versions of GTK) or
366 just an empty space or something else.
368 @see AddTool(), SetToolSeparation(), AddStretchableSpace()
370 virtual wxToolBarToolBase
* AddSeparator();
373 Adds a stretchable space to the toolbar.
375 Any space not taken up by the fixed items (all items except for
376 stretchable spaces) is distributed in equal measure between the
377 stretchable spaces in the toolbar. The most common use for this method
378 is to add a single stretchable space before the items which should be
379 right-aligned in the toolbar, but more exotic possibilities are
380 possible, e.g. a stretchable space may be added in the beginning and
381 the end of the toolbar to centre all toolbar items.
383 @see AddTool(), AddSeparator(), InsertStretchableSpace()
387 wxToolBarToolBase
*AddStretchableSpace();
391 Adds a tool to the toolbar.
394 The tool to be added.
396 @remarks After you have added tools to a toolbar, you must call
397 Realize() in order to have the tools appear.
399 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
400 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
402 virtual wxToolBarToolBase
* AddTool(wxToolBarToolBase
* tool
);
405 Adds a tool to the toolbar. This most commonly used version has fewer
406 parameters than the full version below which specifies the more rarely
407 used button features.
410 An integer by which the tool may be identified in subsequent
413 The string to be displayed with the tool.
415 The primary tool bitmap.
417 This string is used for the tools tooltip.
419 May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
420 for a checkable tool (such tool stays pressed after it had been
421 toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
422 a radio group of tools each of which is automatically unchecked
423 whenever another button in the group is checked. ::wxITEM_DROPDOWN
424 specifies that a drop-down menu button will appear next to the
425 tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
427 @remarks After you have added tools to a toolbar, you must call
428 Realize() in order to have the tools appear.
430 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
431 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
433 wxToolBarToolBase
* AddTool(int toolId
, const wxString
& label
,
434 const wxBitmap
& bitmap
,
435 const wxString
& shortHelp
= wxEmptyString
,
436 wxItemKind kind
= wxITEM_NORMAL
);
439 Adds a tool to the toolbar.
442 An integer by which the tool may be identified in subsequent
445 The string to be displayed with the tool.
447 The primary tool bitmap.
449 The bitmap used when the tool is disabled. If it is equal to
450 ::wxNullBitmap (default), the disabled bitmap is automatically
451 generated by greying the normal one.
453 May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
454 for a checkable tool (such tool stays pressed after it had been
455 toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
456 a radio group of tools each of which is automatically unchecked
457 whenever another button in the group is checked. ::wxITEM_DROPDOWN
458 specifies that a drop-down menu button will appear next to the
459 tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
460 @param shortHelpString
461 This string is used for the tools tooltip.
462 @param longHelpString
463 This string is shown in the statusbar (if any) of the parent frame
464 when the mouse pointer is inside the tool.
466 An optional pointer to client data which can be retrieved later
467 using GetToolClientData().
469 @remarks After you have added tools to a toolbar, you must call
470 Realize() in order to have the tools appear.
472 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
473 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
475 wxToolBarToolBase
* AddTool(int toolId
, const wxString
& label
,
476 const wxBitmap
& bitmap
,
477 const wxBitmap
& bmpDisabled
,
478 wxItemKind kind
= wxITEM_NORMAL
,
479 const wxString
& shortHelpString
= wxEmptyString
,
480 const wxString
& longHelpString
= wxEmptyString
,
481 wxObject
* clientData
= NULL
);
485 Deletes all the tools in the toolbar.
487 virtual void ClearTools();
490 Removes the specified tool from the toolbar and deletes it. If you don't
491 want to delete the tool, but just to remove it from the toolbar (to
492 possibly add it back later), you may use RemoveTool() instead.
494 @note It is unnecessary to call Realize() for the change to take
495 place, it will happen immediately.
497 @returns @true if the tool was deleted, @false otherwise.
499 @see DeleteToolByPos()
501 virtual bool DeleteTool(int toolId
);
504 This function behaves like DeleteTool() but it deletes the tool at the
505 specified position and not the one with the given id.
507 virtual bool DeleteToolByPos(size_t pos
);
510 Enables or disables the tool.
513 ID of the tool to enable or disable, as passed to AddTool().
515 If @true, enables the tool, otherwise disables it.
517 @remarks Some implementations will change the visible state of the tool
518 to indicate that it is disabled.
521 @see GetToolEnabled(), ToggleTool()
523 virtual void EnableTool(int toolId
, bool enable
);
526 Returns a pointer to the tool identified by @a id or @NULL if no
527 corresponding tool is found.
529 wxToolBarToolBase
* FindById(int id
) const;
532 Returns a pointer to the control identified by @a id or @NULL if no
533 corresponding control is found.
535 virtual wxControl
* FindControl(int id
);
538 Finds a tool for the given mouse position.
545 @return A pointer to a tool if a tool is found, or @NULL otherwise.
547 @remarks Currently not implemented in wxGTK (always returns @NULL
550 virtual wxToolBarToolBase
* FindToolForPosition(wxCoord x
, wxCoord y
) const;
553 Returns the left/right and top/bottom margins, which are also used for
558 wxSize
GetMargins() const;
561 Returns the size of bitmap that the toolbar expects to have.
563 The default bitmap size is platform-dependent: for example, it is 16*15
564 for MSW and 24*24 for GTK. This size does @em not necessarily indicate
565 the best size to use for the toolbars on the given platform, for this
566 you should use @c wxArtProvider::GetNativeSizeHint(wxART_TOOLBAR) but
567 in any case, as the bitmap size is deduced automatically from the size
568 of the bitmaps associated with the tools added to the toolbar, it is
569 usually unnecessary to call SetToolBitmapSize() explicitly.
571 @remarks Note that this is the size of the bitmap you pass to AddTool(),
572 and not the eventual size of the tool button.
574 @see SetToolBitmapSize(), GetToolSize()
576 virtual wxSize
GetToolBitmapSize() const;
579 Returns a pointer to the tool at ordinal position @a pos.
581 Don't confuse this with FindToolForPosition().
587 const wxToolBarToolBase
*GetToolByPos(int pos
) const;
590 Get any client data associated with the tool.
593 ID of the tool in question, as passed to AddTool().
595 @return Client data, or @NULL if there is none.
597 virtual wxObject
* GetToolClientData(int toolId
) const;
600 Called to determine whether a tool is enabled (responds to user input).
603 ID of the tool in question, as passed to AddTool().
605 @return @true if the tool is enabled, @false otherwise.
609 virtual bool GetToolEnabled(int toolId
) const;
612 Returns the long help for the given tool.
615 ID of the tool in question, as passed to AddTool().
617 @see SetToolLongHelp(), SetToolShortHelp()
619 virtual wxString
GetToolLongHelp(int toolId
) const;
622 Returns the value used for packing tools.
624 @see SetToolPacking()
626 virtual int GetToolPacking() const;
629 Returns the tool position in the toolbar, or @c wxNOT_FOUND if the tool
633 ID of the tool in question, as passed to AddTool().
635 virtual int GetToolPos(int toolId
) const;
638 Returns the default separator size.
640 @see SetToolSeparation()
642 virtual int GetToolSeparation() const;
645 Returns the short help for the given tool.
648 ID of the tool in question, as passed to AddTool().
650 @see GetToolLongHelp(), SetToolShortHelp()
652 virtual wxString
GetToolShortHelp(int toolId
) const;
655 Returns the size of a whole button, which is usually larger than a tool
656 bitmap because of added 3D effects.
658 @see SetToolBitmapSize(), GetToolBitmapSize()
660 virtual wxSize
GetToolSize() const;
663 Gets the on/off state of a toggle tool.
666 ID of the tool in question, as passed to AddTool().
668 @return @true if the tool is toggled on, @false otherwise.
672 virtual bool GetToolState(int toolId
) const;
675 Returns the number of tools in the toolbar.
677 size_t GetToolsCount() const;
680 Inserts the control into the toolbar at the given position. You must
681 call Realize() for the change to take place.
683 @see AddControl(), InsertTool()
685 virtual wxToolBarToolBase
* InsertControl(size_t pos
, wxControl
* control
,
686 const wxString
& label
= wxEmptyString
);
689 Inserts the separator into the toolbar at the given position. You must
690 call Realize() for the change to take place.
692 @see AddSeparator(), InsertTool()
694 virtual wxToolBarToolBase
* InsertSeparator(size_t pos
);
697 Inserts a stretchable space at the given position.
699 See AddStretchableSpace() for details about stretchable spaces.
701 @see InsertTool(), InsertSeparator()
705 wxToolBarToolBase
*InsertStretchableSpace(size_t pos
);
709 Inserts the tool with the specified attributes into the toolbar at the
712 You must call Realize() for the change to take place.
714 @see AddTool(), InsertControl(), InsertSeparator()
716 @return The newly inserted tool or @NULL on failure. Notice that with
717 the overload taking @a tool parameter the caller is responsible for
718 deleting the tool in the latter case.
720 wxToolBarToolBase
* InsertTool( size_t pos
,
722 const wxString
& label
,
723 const wxBitmap
& bitmap
,
724 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
725 wxItemKind kind
= wxITEM_NORMAL
,
726 const wxString
& shortHelp
= wxEmptyString
,
727 const wxString
& longHelp
= wxEmptyString
,
728 wxObject
*clientData
= NULL
);
730 wxToolBarToolBase
* InsertTool(size_t pos
,
731 wxToolBarToolBase
* tool
);
735 Called when the user clicks on a tool with the left mouse button. This
736 is the old way of detecting tool clicks; although it will still work,
737 you should use the EVT_MENU() or EVT_TOOL() macro instead.
740 The identifier passed to AddTool().
742 @true if the tool is a toggle and the toggle is down, otherwise is
745 @return If the tool is a toggle and this function returns @false, the
746 toggle state (internal and visual) will not be changed. This
747 provides a way of specifying that toggle operations are not
748 permitted in some circumstances.
750 @see OnMouseEnter(), OnRightClick()
752 virtual bool OnLeftClick(int toolId
, bool toggleDown
);
755 This is called when the mouse cursor moves into a tool or out of the
756 toolbar. This is the old way of detecting mouse enter events;
757 although it will still work, you should use the EVT_TOOL_ENTER()
761 Greater than -1 if the mouse cursor has moved into the tool, or -1
762 if the mouse cursor has moved. The programmer can override this to
763 provide extra information about the tool, such as a short
764 description on the status line.
766 @remarks With some derived toolbar classes, if the mouse moves quickly
767 out of the toolbar, wxWidgets may not be able to detect it.
768 Therefore this function may not always be called when expected.
770 virtual void OnMouseEnter(int toolId
);
773 @deprecated This is the old way of detecting tool right clicks;
774 although it will still work, you should use the
775 EVT_TOOL_RCLICKED() macro instead.
777 Called when the user clicks on a tool with the right mouse button. The
778 programmer should override this function to detect right tool clicks.
781 The identifier passed to AddTool().
783 The x position of the mouse cursor.
785 The y position of the mouse cursor.
787 @remarks A typical use of this member might be to pop up a menu.
789 @see OnMouseEnter(), OnLeftClick()
791 virtual void OnRightClick(int toolId
, long x
, long y
);
794 This function should be called after you have added tools.
796 virtual bool Realize();
799 Removes the given tool from the toolbar but doesn't delete it. This
800 allows to insert/add this tool back to this (or another) toolbar later.
802 @note It is unnecessary to call Realize() for the change to take place,
803 it will happen immediately.
808 virtual wxToolBarToolBase
* RemoveTool(int id
);
811 Sets the bitmap resource identifier for specifying tool bitmaps as
812 indices into a custom bitmap.
814 This is a Windows CE-specific method not available in the other ports.
816 @onlyfor{wxmsw_wince}
818 void SetBitmapResource(int resourceId
);
821 Sets the dropdown menu for the tool given by its @e id. The tool itself
822 will delete the menu when it's no longer needed. Only supported under
825 If you define a EVT_TOOL_DROPDOWN() handler in your program, you must
826 call wxEvent::Skip() from it or the menu won't be displayed.
828 bool SetDropdownMenu(int id
, wxMenu
* menu
);
832 Set the values to be used as margins for the toolbar.
835 Left margin, right margin and inter-tool separation value.
837 Top margin, bottom margin and inter-tool separation value.
839 @remarks This must be called before the tools are added if absolute
840 positioning is to be used, and the default (zero-size) margins are
845 virtual void SetMargins(int x
, int y
);
848 Set the margins for the toolbar.
853 @remarks This must be called before the tools are added if absolute
854 positioning is to be used, and the default (zero-size) margins are
857 @see GetMargins(), wxSize
859 void SetMargins(const wxSize
& size
);
863 Sets the default size of each tool bitmap. The default bitmap size is 16
867 The size of the bitmaps in the toolbar.
869 @remarks This should be called to tell the toolbar what the tool bitmap
870 size is. Call it before you add tools.
872 @see GetToolBitmapSize(), GetToolSize()
874 virtual void SetToolBitmapSize(const wxSize
& size
);
877 Sets the client data associated with the tool.
880 ID of the tool in question, as passed to AddTool().
882 virtual void SetToolClientData(int id
, wxObject
* clientData
);
885 Sets the bitmap to be used by the tool with the given ID when the tool
886 is in a disabled state. This can only be used on Button tools, not
890 ID of the tool in question, as passed to AddTool().
892 @note The native toolbar classes on the main platforms all synthesize
893 the disabled bitmap from the normal bitmap, so this function will
894 have no effect on those platforms.
897 virtual void SetToolDisabledBitmap(int id
, const wxBitmap
& bitmap
);
900 Sets the long help for the given tool.
903 ID of the tool in question, as passed to AddTool().
905 A string for the long help.
907 @remarks You might use the long help for displaying the tool purpose on
910 @see GetToolLongHelp(), SetToolShortHelp(),
912 virtual void SetToolLongHelp(int toolId
, const wxString
& helpString
);
915 Sets the bitmap to be used by the tool with the given ID. This can only
916 be used on Button tools, not controls.
919 ID of the tool in question, as passed to AddTool().
921 virtual void SetToolNormalBitmap(int id
, const wxBitmap
& bitmap
);
924 Sets the value used for spacing tools. The default value is 1.
927 The value for packing.
929 @remarks The packing is used for spacing in the vertical direction if
930 the toolbar is horizontal, and for spacing in the horizontal
931 direction if the toolbar is vertical.
933 @see GetToolPacking()
935 virtual void SetToolPacking(int packing
);
938 Sets the default separator size. The default value is 5.
945 virtual void SetToolSeparation(int separation
);
948 Sets the short help for the given tool.
951 ID of the tool in question, as passed to AddTool().
953 The string for the short help.
955 @remarks An application might use short help for identifying the tool
956 purpose in a tooltip.
959 @see GetToolShortHelp(), SetToolLongHelp()
961 virtual void SetToolShortHelp(int toolId
, const wxString
& helpString
);
964 Toggles a tool on or off. This does not cause any event to get emitted.
967 ID of the tool in question, as passed to AddTool().
969 If @true, toggles the tool on, otherwise toggles it off.
971 @remarks Only applies to a tool that has been specified as a toggle
974 virtual void ToggleTool(int toolId
, bool toggle
);
978 Factory function to create a new toolbar tool.
980 virtual wxToolBarToolBase
*CreateTool(int toolId
,
981 const wxString
& label
,
982 const wxBitmap
& bmpNormal
,
983 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
984 wxItemKind kind
= wxITEM_NORMAL
,
985 wxObject
*clientData
= NULL
,
986 const wxString
& shortHelp
= wxEmptyString
,
987 const wxString
& longHelp
= wxEmptyString
);
989 Factory function to create a new control toolbar tool.
991 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
992 const wxString
& label
);
995 Factory function to create a new separator toolbar tool.
997 wxToolBarToolBase
*CreateSeparator()