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;
102 bool IsStretchable() const;
103 bool IsButton() const;
104 bool IsControl() const;
105 bool IsSeparator() const;
106 bool IsStretchableSpace() const;
107 int GetStyle() const;
108 wxItemKind
GetKind() const;
109 void MakeStretchable();
112 bool IsEnabled() const;
113 bool IsToggled() const;
114 bool CanBeToggled() const;
117 const wxBitmap
& GetNormalBitmap() const;
118 const wxBitmap
& GetDisabledBitmap() const;
120 const wxBitmap
& GetBitmap() const;
121 const wxString
& GetLabel() const;
123 const wxString
& GetShortHelp() const;
124 const wxString
& GetLongHelp() const;
126 wxObject
*GetClientData() const;
128 // modifiers: return true if the state really changed
129 virtual bool Enable(bool enable
);
130 virtual bool Toggle(bool toggle
);
131 virtual bool SetToggle(bool toggle
);
132 virtual bool SetShortHelp(const wxString
& help
);
133 virtual bool SetLongHelp(const wxString
& help
);
135 virtual void SetNormalBitmap(const wxBitmap
& bmp
);
136 virtual void SetDisabledBitmap(const wxBitmap
& bmp
);
137 virtual void SetLabel(const wxString
& label
);
138 void SetClientData(wxObject
*clientData
);
140 // add tool to/remove it from a toolbar
141 virtual void Detach();
142 virtual void Attach(wxToolBarBase
*tbar
);
144 // these methods are only for tools of wxITEM_DROPDOWN kind (but even such
145 // tools can have a NULL associated menu)
146 virtual void SetDropdownMenu(wxMenu
*menu
);
147 wxMenu
*GetDropdownMenu() const { return m_dropdownMenu
; }
156 A toolbar is a bar of buttons and/or other controls usually placed below
157 the menu bar in a wxFrame.
159 You may create a toolbar that is managed by a frame calling
160 wxFrame::CreateToolBar(). Under Pocket PC, you should always use this
161 function for creating the toolbar to be managed by the frame, so that
162 wxWidgets can use a combined menubar and toolbar. Where you manage your
163 own toolbars, create wxToolBar as usual.
165 There are several different types of tools you can add to a toolbar.
166 These types are controlled by the ::wxItemKind enumeration.
168 Note that many methods in wxToolBar such as wxToolBar::AddTool return a
169 @c wxToolBarToolBase* object.
170 This should be regarded as an opaque handle representing the newly added
171 toolbar item, providing access to its id and position within the toolbar.
172 Changes to the item's state should be made through calls to wxToolBar methods,
173 for example wxToolBar::EnableTool.
174 Calls to @c wxToolBarToolBase methods (undocumented by purpose) will not change
175 the visible state of the item within the tool bar.
177 <b>wxMSW note</b>: Note that under wxMSW toolbar paints tools to reflect
178 system-wide colours. If you use more than 16 colours in your tool bitmaps,
179 you may wish to suppress this behaviour, otherwise system colours in your
180 bitmaps will inadvertently be mapped to system colours.
181 To do this, set the msw.remap system option before creating the toolbar:
183 wxSystemOptions::SetOption("msw.remap", 0);
185 If you wish to use 32-bit images (which include an alpha channel for
188 wxSystemOptions::SetOption("msw.remap", 2);
190 Then colour remapping is switched off, and a transparent background
191 used. But only use this option under Windows XP with true colour:
193 if (wxTheApp->GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
198 Gives the toolbar a flat look (Windows and GTK only).
199 @style{wxTB_DOCKABLE}
200 Makes the toolbar floatable and dockable (GTK only).
201 @style{wxTB_HORIZONTAL}
202 Specifies horizontal layout (default).
203 @style{wxTB_VERTICAL}
204 Specifies vertical layout.
206 Shows the text in the toolbar buttons; by default only icons are shown.
208 Specifies no icons in the toolbar buttons; by default they are shown.
209 @style{wxTB_NODIVIDER}
210 Specifies no divider (border) above the toolbar (Windows only)
212 Specifies no alignment with the parent window (Windows only, not very
214 @style{wxTB_HORZ_LAYOUT}
215 Shows the text and the icons alongside, not vertically stacked (Windows
216 and GTK 2 only). This style must be used with @c wxTB_TEXT.
217 @style{wxTB_HORZ_TEXT}
218 Combination of @c wxTB_HORZ_LAYOUT and @c wxTB_TEXT.
219 @style{wxTB_NO_TOOLTIPS}
220 Don't show the short help tooltips for the tools when the mouse hovers
223 Align the toolbar at the bottom of parent window.
225 Align the toolbar at the right side of parent window.
228 See also @ref overview_windowstyles. Note that the wxMSW native toolbar
229 ignores @c wxTB_NOICONS style. Also, toggling the @c wxTB_TEXT works only
230 if the style was initially on.
232 @beginEventEmissionTable{wxCommandEvent}
233 @event{EVT_TOOL(id, func)}
234 Process a @c wxEVT_COMMAND_TOOL_CLICKED event (a synonym for @c
235 wxEVT_COMMAND_MENU_SELECTED). Pass the id of the tool.
236 @event{EVT_MENU(id, func)}
237 The same as EVT_TOOL().
238 @event{EVT_TOOL_RANGE(id1, id2, func)}
239 Process a @c wxEVT_COMMAND_TOOL_CLICKED event for a range of
240 identifiers. Pass the ids of the tools.
241 @event{EVT_MENU_RANGE(id1, id2, func)}
242 The same as EVT_TOOL_RANGE().
243 @event{EVT_TOOL_RCLICKED(id, func)}
244 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event. Pass the id of the
245 tool. (Not available on wxOSX.)
246 @event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
247 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event for a range of ids. Pass
248 the ids of the tools. (Not available on wxOSX.)
249 @event{EVT_TOOL_ENTER(id, func)}
250 Process a @c wxEVT_COMMAND_TOOL_ENTER event. Pass the id of the toolbar
251 itself. The value of wxCommandEvent::GetSelection() is the tool id, or
252 -1 if the mouse cursor has moved off a tool. (Not available on wxOSX.)
253 @event{EVT_TOOL_DROPDOWN(id, func)}
254 Process a @c wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED event. If unhandled,
255 displays the default dropdown menu set using
256 wxToolBar::SetDropdownMenu().
259 The toolbar class emits menu commands in the same way that a frame menubar
260 does, so you can use one EVT_MENU() macro for both a menu item and a toolbar
261 button. The event handler functions take a wxCommandEvent argument. For most
262 event macros, the identifier of the tool is passed, but for EVT_TOOL_ENTER()
263 the toolbar window identifier is passed and the tool identifier is retrieved
264 from the wxCommandEvent. This is because the identifier may be @c wxID_ANY when the
265 mouse moves off a tool, and @c wxID_ANY is not allowed as an identifier in the event
271 @see @ref overview_toolbar
273 class wxToolBar
: public wxControl
282 Constructs a toolbar.
285 Pointer to a parent window.
287 Window identifier. If -1, will automatically create an identifier.
289 Window position. ::wxDefaultPosition indicates that wxWidgets should
290 generate a default position for the window.
291 If using the wxWindow class directly, supply an actual position.
293 Window size. ::wxDefaultSize indicates that wxWidgets should generate
294 a default size for the window.
296 Window style. See wxToolBar initial description for details.
300 @remarks After a toolbar is created, you use AddTool() and perhaps
301 AddSeparator(), and then you must call Realize() to construct
302 and display the toolbar tools.
304 wxToolBar(wxWindow
* parent
, wxWindowID id
,
305 const wxPoint
& pos
= wxDefaultPosition
,
306 const wxSize
& size
= wxDefaultSize
,
307 long style
= wxTB_HORIZONTAL
,
308 const wxString
& name
= wxToolBarNameStr
);
313 virtual ~wxToolBar();
316 Adds a new check (or toggle) tool to the toolbar. The parameters are the
317 same as in AddTool().
321 wxToolBarToolBase
* AddCheckTool(int toolId
, const wxString
& label
,
322 const wxBitmap
& bitmap1
,
323 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
324 const wxString
& shortHelp
= wxEmptyString
,
325 const wxString
& longHelp
= wxEmptyString
,
326 wxObject
* clientData
= NULL
);
329 Adds any control to the toolbar, typically e.g. a wxComboBox.
332 The control to be added.
334 Text to be displayed near the control.
337 wxMSW: the label is only displayed if there is enough space
338 available below the embedded control.
341 wxMac: labels are only displayed if wxWidgets is built with @c
342 wxMAC_USE_NATIVE_TOOLBAR set to 1
344 virtual wxToolBarToolBase
* AddControl(wxControl
* control
,
345 const wxString
& label
= wxEmptyString
);
348 Adds a new radio tool to the toolbar. Consecutive radio tools form a
349 radio group such that exactly one button in the group is pressed at any
350 moment, in other words whenever a button in the group is pressed the
351 previously pressed button is automatically released. You should avoid
352 having the radio groups of only one element as it would be impossible
353 for the user to use such button.
355 By default, the first button in the radio group is initially pressed,
361 wxToolBarToolBase
* AddRadioTool(int toolId
, const wxString
& label
,
362 const wxBitmap
& bitmap1
,
363 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
364 const wxString
& shortHelp
= wxEmptyString
,
365 const wxString
& longHelp
= wxEmptyString
,
366 wxObject
* clientData
= NULL
);
369 Adds a separator for spacing groups of tools.
371 Notice that the separator uses the look appropriate for the current
372 platform so it can be a vertical line (MSW, some versions of GTK) or
373 just an empty space or something else.
375 @see AddTool(), SetToolSeparation(), AddStretchableSpace()
377 virtual wxToolBarToolBase
* AddSeparator();
380 Adds a stretchable space to the toolbar.
382 Any space not taken up by the fixed items (all items except for
383 stretchable spaces) is distributed in equal measure between the
384 stretchable spaces in the toolbar. The most common use for this method
385 is to add a single stretchable space before the items which should be
386 right-aligned in the toolbar, but more exotic possibilities are
387 possible, e.g. a stretchable space may be added in the beginning and
388 the end of the toolbar to centre all toolbar items.
390 @see AddTool(), AddSeparator(), InsertStretchableSpace()
394 wxToolBarToolBase
*AddStretchableSpace();
398 Adds a tool to the toolbar.
401 The tool to be added.
403 @remarks After you have added tools to a toolbar, you must call
404 Realize() in order to have the tools appear.
406 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
407 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
409 virtual wxToolBarToolBase
* AddTool(wxToolBarToolBase
* tool
);
412 Adds a tool to the toolbar. This most commonly used version has fewer
413 parameters than the full version below which specifies the more rarely
414 used button features.
417 An integer by which the tool may be identified in subsequent
420 The string to be displayed with the tool.
422 The primary tool bitmap.
424 This string is used for the tools tooltip.
426 May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
427 for a checkable tool (such tool stays pressed after it had been
428 toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
429 a radio group of tools each of which is automatically unchecked
430 whenever another button in the group is checked. ::wxITEM_DROPDOWN
431 specifies that a drop-down menu button will appear next to the
432 tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
434 @remarks After you have added tools to a toolbar, you must call
435 Realize() in order to have the tools appear.
437 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
438 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
440 wxToolBarToolBase
* AddTool(int toolId
, const wxString
& label
,
441 const wxBitmap
& bitmap
,
442 const wxString
& shortHelp
= wxEmptyString
,
443 wxItemKind kind
= wxITEM_NORMAL
);
446 Adds a tool to the toolbar.
449 An integer by which the tool may be identified in subsequent
452 The string to be displayed with the tool.
454 The primary tool bitmap.
456 The bitmap used when the tool is disabled. If it is equal to
457 ::wxNullBitmap (default), the disabled bitmap is automatically
458 generated by greying the normal one.
460 May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
461 for a checkable tool (such tool stays pressed after it had been
462 toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
463 a radio group of tools each of which is automatically unchecked
464 whenever another button in the group is checked. ::wxITEM_DROPDOWN
465 specifies that a drop-down menu button will appear next to the
466 tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
467 @param shortHelpString
468 This string is used for the tools tooltip.
469 @param longHelpString
470 This string is shown in the statusbar (if any) of the parent frame
471 when the mouse pointer is inside the tool.
473 An optional pointer to client data which can be retrieved later
474 using GetToolClientData().
476 @remarks After you have added tools to a toolbar, you must call
477 Realize() in order to have the tools appear.
479 @see AddSeparator(), AddCheckTool(), AddRadioTool(),
480 InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
482 wxToolBarToolBase
* AddTool(int toolId
, const wxString
& label
,
483 const wxBitmap
& bitmap
,
484 const wxBitmap
& bmpDisabled
,
485 wxItemKind kind
= wxITEM_NORMAL
,
486 const wxString
& shortHelpString
= wxEmptyString
,
487 const wxString
& longHelpString
= wxEmptyString
,
488 wxObject
* clientData
= NULL
);
492 Deletes all the tools in the toolbar.
494 virtual void ClearTools();
497 Removes the specified tool from the toolbar and deletes it. If you don't
498 want to delete the tool, but just to remove it from the toolbar (to
499 possibly add it back later), you may use RemoveTool() instead.
501 @note It is unnecessary to call Realize() for the change to take
502 place, it will happen immediately.
504 @returns @true if the tool was deleted, @false otherwise.
506 @see DeleteToolByPos()
508 virtual bool DeleteTool(int toolId
);
511 This function behaves like DeleteTool() but it deletes the tool at the
512 specified position and not the one with the given id.
514 virtual bool DeleteToolByPos(size_t pos
);
517 Enables or disables the tool.
520 ID of the tool to enable or disable, as passed to AddTool().
522 If @true, enables the tool, otherwise disables it.
524 @remarks Some implementations will change the visible state of the tool
525 to indicate that it is disabled.
528 @see GetToolEnabled(), ToggleTool()
530 virtual void EnableTool(int toolId
, bool enable
);
533 Returns a pointer to the tool identified by @a id or @NULL if no
534 corresponding tool is found.
536 wxToolBarToolBase
* FindById(int id
) const;
539 Returns a pointer to the control identified by @a id or @NULL if no
540 corresponding control is found.
542 virtual wxControl
* FindControl(int id
);
545 Finds a tool for the given mouse position.
552 @return A pointer to a tool if a tool is found, or @NULL otherwise.
554 @remarks Currently not implemented in wxGTK (always returns @NULL
557 virtual wxToolBarToolBase
* FindToolForPosition(wxCoord x
, wxCoord y
) const;
560 Returns the left/right and top/bottom margins, which are also used for
565 wxSize
GetMargins() const;
568 Returns the size of bitmap that the toolbar expects to have.
570 The default bitmap size is platform-dependent: for example, it is 16*15
571 for MSW and 24*24 for GTK. This size does @em not necessarily indicate
572 the best size to use for the toolbars on the given platform, for this
573 you should use @c wxArtProvider::GetNativeSizeHint(wxART_TOOLBAR) but
574 in any case, as the bitmap size is deduced automatically from the size
575 of the bitmaps associated with the tools added to the toolbar, it is
576 usually unnecessary to call SetToolBitmapSize() explicitly.
578 @remarks Note that this is the size of the bitmap you pass to AddTool(),
579 and not the eventual size of the tool button.
581 @see SetToolBitmapSize(), GetToolSize()
583 virtual wxSize
GetToolBitmapSize() const;
586 Returns a pointer to the tool at ordinal position @a pos.
588 Don't confuse this with FindToolForPosition().
594 const wxToolBarToolBase
*GetToolByPos(int pos
) const;
597 Get any client data associated with the tool.
600 ID of the tool in question, as passed to AddTool().
602 @return Client data, or @NULL if there is none.
604 virtual wxObject
* GetToolClientData(int toolId
) const;
607 Called to determine whether a tool is enabled (responds to user input).
610 ID of the tool in question, as passed to AddTool().
612 @return @true if the tool is enabled, @false otherwise.
616 virtual bool GetToolEnabled(int toolId
) const;
619 Returns the long help for the given tool.
622 ID of the tool in question, as passed to AddTool().
624 @see SetToolLongHelp(), SetToolShortHelp()
626 virtual wxString
GetToolLongHelp(int toolId
) const;
629 Returns the value used for packing tools.
631 @see SetToolPacking()
633 virtual int GetToolPacking() const;
636 Returns the tool position in the toolbar, or @c wxNOT_FOUND if the tool
640 ID of the tool in question, as passed to AddTool().
642 virtual int GetToolPos(int toolId
) const;
645 Returns the default separator size.
647 @see SetToolSeparation()
649 virtual int GetToolSeparation() const;
652 Returns the short help for the given tool.
655 ID of the tool in question, as passed to AddTool().
657 @see GetToolLongHelp(), SetToolShortHelp()
659 virtual wxString
GetToolShortHelp(int toolId
) const;
662 Returns the size of a whole button, which is usually larger than a tool
663 bitmap because of added 3D effects.
665 @see SetToolBitmapSize(), GetToolBitmapSize()
667 virtual wxSize
GetToolSize() const;
670 Gets the on/off state of a toggle tool.
673 ID of the tool in question, as passed to AddTool().
675 @return @true if the tool is toggled on, @false otherwise.
679 virtual bool GetToolState(int toolId
) const;
682 Returns the number of tools in the toolbar.
684 size_t GetToolsCount() const;
687 Inserts the control into the toolbar at the given position. You must
688 call Realize() for the change to take place.
690 @see AddControl(), InsertTool()
692 virtual wxToolBarToolBase
* InsertControl(size_t pos
, wxControl
* control
,
693 const wxString
& label
= wxEmptyString
);
696 Inserts the separator into the toolbar at the given position. You must
697 call Realize() for the change to take place.
699 @see AddSeparator(), InsertTool()
701 virtual wxToolBarToolBase
* InsertSeparator(size_t pos
);
704 Inserts a stretchable space at the given position.
706 See AddStretchableSpace() for details about stretchable spaces.
708 @see InsertTool(), InsertSeparator()
712 wxToolBarToolBase
*InsertStretchableSpace(size_t pos
);
716 Inserts the tool with the specified attributes into the toolbar at the
719 You must call Realize() for the change to take place.
721 @see AddTool(), InsertControl(), InsertSeparator()
723 @return The newly inserted tool or @NULL on failure. Notice that with
724 the overload taking @a tool parameter the caller is responsible for
725 deleting the tool in the latter case.
727 wxToolBarToolBase
* InsertTool(size_t pos
, int toolId
,
728 const wxBitmap
& bitmap1
,
729 const wxBitmap
& bitmap2
= wxNullBitmap
,
730 bool isToggle
= false,
731 wxObject
* clientData
= NULL
,
732 const wxString
& shortHelpString
= wxEmptyString
,
733 const wxString
& longHelpString
= wxEmptyString
);
734 wxToolBarToolBase
* InsertTool(size_t pos
,
735 wxToolBarToolBase
* tool
);
739 Called when the user clicks on a tool with the left mouse button. This
740 is the old way of detecting tool clicks; although it will still work,
741 you should use the EVT_MENU() or EVT_TOOL() macro instead.
744 The identifier passed to AddTool().
746 @true if the tool is a toggle and the toggle is down, otherwise is
749 @return If the tool is a toggle and this function returns @false, the
750 toggle state (internal and visual) will not be changed. This
751 provides a way of specifying that toggle operations are not
752 permitted in some circumstances.
754 @see OnMouseEnter(), OnRightClick()
756 virtual bool OnLeftClick(int toolId
, bool toggleDown
);
759 This is called when the mouse cursor moves into a tool or out of the
760 toolbar. This is the old way of detecting mouse enter events;
761 although it will still work, you should use the EVT_TOOL_ENTER()
765 Greater than -1 if the mouse cursor has moved into the tool, or -1
766 if the mouse cursor has moved. The programmer can override this to
767 provide extra information about the tool, such as a short
768 description on the status line.
770 @remarks With some derived toolbar classes, if the mouse moves quickly
771 out of the toolbar, wxWidgets may not be able to detect it.
772 Therefore this function may not always be called when expected.
774 virtual void OnMouseEnter(int toolId
);
777 @deprecated This is the old way of detecting tool right clicks;
778 although it will still work, you should use the
779 EVT_TOOL_RCLICKED() macro instead.
781 Called when the user clicks on a tool with the right mouse button. The
782 programmer should override this function to detect right tool clicks.
785 The identifier passed to AddTool().
787 The x position of the mouse cursor.
789 The y position of the mouse cursor.
791 @remarks A typical use of this member might be to pop up a menu.
793 @see OnMouseEnter(), OnLeftClick()
795 virtual void OnRightClick(int toolId
, long x
, long y
);
798 This function should be called after you have added tools.
800 virtual bool Realize();
803 Removes the given tool from the toolbar but doesn't delete it. This
804 allows to insert/add this tool back to this (or another) toolbar later.
806 @note It is unnecessary to call Realize() for the change to take place,
807 it will happen immediately.
812 virtual wxToolBarToolBase
* RemoveTool(int id
);
815 Sets the bitmap resource identifier for specifying tool bitmaps as
816 indices into a custom bitmap.
818 This is a Windows CE-specific method not available in the other ports.
820 @onlyfor{wxmsw_wince}
822 void SetBitmapResource(int resourceId
);
825 Sets the dropdown menu for the tool given by its @e id. The tool itself
826 will delete the menu when it's no longer needed. Only supported under
829 If you define a EVT_TOOL_DROPDOWN() handler in your program, you must
830 call wxEvent::Skip() from it or the menu won't be displayed.
832 bool SetDropdownMenu(int id
, wxMenu
* menu
);
836 Set the values to be used as margins for the toolbar.
839 Left margin, right margin and inter-tool separation value.
841 Top margin, bottom margin and inter-tool separation value.
843 @remarks This must be called before the tools are added if absolute
844 positioning is to be used, and the default (zero-size) margins are
849 virtual void SetMargins(int x
, int y
);
852 Set the margins for the toolbar.
857 @remarks This must be called before the tools are added if absolute
858 positioning is to be used, and the default (zero-size) margins are
861 @see GetMargins(), wxSize
863 void SetMargins(const wxSize
& size
);
867 Sets the default size of each tool bitmap. The default bitmap size is 16
871 The size of the bitmaps in the toolbar.
873 @remarks This should be called to tell the toolbar what the tool bitmap
874 size is. Call it before you add tools.
876 @see GetToolBitmapSize(), GetToolSize()
878 virtual void SetToolBitmapSize(const wxSize
& size
);
881 Sets the client data associated with the tool.
884 ID of the tool in question, as passed to AddTool().
886 virtual void SetToolClientData(int id
, wxObject
* clientData
);
889 Sets the bitmap to be used by the tool with the given ID when the tool
890 is in a disabled state. This can only be used on Button tools, not
894 ID of the tool in question, as passed to AddTool().
896 @note The native toolbar classes on the main platforms all synthesize
897 the disabled bitmap from the normal bitmap, so this function will
898 have no effect on those platforms.
901 virtual void SetToolDisabledBitmap(int id
, const wxBitmap
& bitmap
);
904 Sets the long help for the given tool.
907 ID of the tool in question, as passed to AddTool().
909 A string for the long help.
911 @remarks You might use the long help for displaying the tool purpose on
914 @see GetToolLongHelp(), SetToolShortHelp(),
916 virtual void SetToolLongHelp(int toolId
, const wxString
& helpString
);
919 Sets the bitmap to be used by the tool with the given ID. This can only
920 be used on Button tools, not controls.
923 ID of the tool in question, as passed to AddTool().
925 virtual void SetToolNormalBitmap(int id
, const wxBitmap
& bitmap
);
928 Sets the value used for spacing tools. The default value is 1.
931 The value for packing.
933 @remarks The packing is used for spacing in the vertical direction if
934 the toolbar is horizontal, and for spacing in the horizontal
935 direction if the toolbar is vertical.
937 @see GetToolPacking()
939 virtual void SetToolPacking(int packing
);
942 Sets the default separator size. The default value is 5.
949 virtual void SetToolSeparation(int separation
);
952 Sets the short help for the given tool.
955 ID of the tool in question, as passed to AddTool().
957 The string for the short help.
959 @remarks An application might use short help for identifying the tool
960 purpose in a tooltip.
963 @see GetToolShortHelp(), SetToolLongHelp()
965 virtual void SetToolShortHelp(int toolId
, const wxString
& helpString
);
968 Toggles a tool on or off. This does not cause any event to get emitted.
971 ID of the tool in question, as passed to AddTool().
973 If @true, toggles the tool on, otherwise toggles it off.
975 @remarks Only applies to a tool that has been specified as a toggle
978 virtual void ToggleTool(int toolId
, bool toggle
);