]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/toolbar.tex
Added periods
[wxWidgets.git] / docs / latex / wx / toolbar.tex
CommitLineData
81d66cf3 1\section{\class{wxToolBar}}\label{wxtoolbar}
a660d684 2
81d66cf3
JS
3The name wxToolBar is defined to be a synonym for one of the following classes:
4
5\begin{itemize}\itemsep=0pt
6\item {\bf wxToolBar95} The native Windows 95 toolbar. Used on Windows 95, NT 4 and above.
7\item {\bf wxToolBarMSW} A Windows implementation. Used on 16-bit Windows.
8\item {\bf wxToolBarGTK} The GTK toolbar.
81d66cf3
JS
9\end{itemize}
10
a660d684
KB
11\wxheading{Derived from}
12
81d66cf3 13wxToolBarBase\\
a660d684
KB
14\helpref{wxControl}{wxcontrol}\\
15\helpref{wxWindow}{wxwindow}\\
16\helpref{wxEvtHandler}{wxevthandler}\\
17\helpref{wxObject}{wxobject}
18
954b8ae6
JS
19\wxheading{Include files}
20
fc2171bd 21<wx/toolbar.h> (to allow wxWidgets to select an appropriate toolbar class)\\
a9102b36 22<wx/tbarbase.h> (the base class)
954b8ae6 23
a660d684
KB
24\wxheading{Remarks}
25
81d66cf3 26You may also create a toolbar that is managed by the frame, by
a9102b36 27calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}. Under Pocket PC,
a16a4ab1 28you should \arg{always} use this function for creating the toolbar
a9102b36
JS
29to be managed by the frame, so that wxWidgets can use a combined
30menubar and toolbar. Where you manage your own toolbars, create a wxToolBar
31as usual.
81d66cf3 32
a9102b36 33The meaning of a "separator" is a vertical line under Windows and simple space under GTK+.
5f445b31 34
33c4f27f
JS
35{\bf wxToolBar95:} Note that this toolbar paints tools to reflect system-wide colours.
36If you use more than 16 colours in your tool bitmaps, you may wish to suppress
37this behaviour, otherwise system colours in your bitmaps will inadvertently be
c36f1fc7 38mapped to system colours. To do this, set the {\tt msw.remap} system option
33c4f27f
JS
39before creating the toolbar:
40
41\begin{verbatim}
c36f1fc7 42 wxSystemOptions::SetOption(wxT("msw.remap"), 0);
33c4f27f 43\end{verbatim}
81d66cf3 44
92661f97
VZ
45If you wish to use 32-bit images (which include an alpha channel for transparency)
46use:
47
48\begin{verbatim}
49 wxSystemOptions::SetOption(wxT("msw.remap"), 2);
50\end{verbatim}
51
dbd94b75 52then colour remapping is switched off, and a transparent background used. But only
92661f97
VZ
53use this option under Windows XP with true colour:
54
55\begin{verbatim}
56 (wxTheApp->GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
57\end{verbatim}
58
81d66cf3
JS
59\wxheading{Window styles}
60
61\twocolwidtha{5cm}
62\begin{twocollist}\itemsep=0pt
b06ba076
JS
63\twocolitem{\windowstyle{wxTB\_FLAT}}{Gives the toolbar a flat look (Windows and GTK only).}
64\twocolitem{\windowstyle{wxTB\_DOCKABLE}}{Makes the toolbar floatable and dockable (GTK only).}
65\twocolitem{\windowstyle{wxTB\_HORIZONTAL}}{Specifies horizontal layout (default).}
66\twocolitem{\windowstyle{wxTB\_VERTICAL}}{Specifies vertical layout.}
d3c17ee7 67\twocolitem{\windowstyle{wxTB\_TEXT}}{Shows the text in the toolbar buttons; by default only icons are shown.}
b06ba076
JS
68\twocolitem{\windowstyle{wxTB\_NOICONS}}{Specifies no icons in the toolbar buttons; by default they are shown.}
69\twocolitem{\windowstyle{wxTB\_NODIVIDER}}{Specifies no divider (border) above the toolbar (Windows only).}
70\twocolitem{\windowstyle{wxTB\_NOALIGN}}{Specifies no alignment with the parent window (Windows only, not very useful).}
d3c17ee7 71\twocolitem{\windowstyle{wxTB\_HORZ\_LAYOUT}}{Shows the text and the icons alongside, not vertically stacked (Windows and GTK
99e8cb50 722 only). This style must be used with wxTB\_TEXT.}
b06ba076 73\twocolitem{\windowstyle{wxTB\_HORZ\_TEXT}}{Combination of wxTB\_HORZ\_LAYOUT and wxTB\_TEXT.}
22d8c8bf 74\twocolitem{\windowstyle{wxTB\_NO\_TOOLTIPS}}{Don't show the short help tooltips for the tools when the mouse hovers over them.}
5b2acc3a 75\twocolitem{\windowstyle{wxTB\_BOTTOM}}{Align the toolbar at the bottom of parent window.}
7a976304 76\twocolitem{\windowstyle{wxTB\_RIGHT}}{Align the toolbar at the right side of parent window.}
81d66cf3
JS
77\end{twocollist}
78
c631abda
VZ
79See also \helpref{window styles overview}{windowstyles}. Note that the Win32
80native toolbar ignores {\tt wxTB\_NOICONS} style. Also, toggling the
81{\tt wxTB\_TEXT} works only if the style was initially on.
a660d684
KB
82
83\wxheading{Event handling}
84
eb5fa34b 85The toolbar class emits menu commands in the same way that a frame menubar does,
81d66cf3
JS
86so you can use one EVT\_MENU macro for both a menu item and a toolbar button.
87The event handler functions take a wxCommandEvent argument. For most event macros,
88the identifier of the tool is passed, but for EVT\_TOOL\_ENTER the toolbar
d3c17ee7
JS
89window identifier is passed and the tool identifier is retrieved from the wxCommandEvent.
90This is because the identifier may be -1 when the mouse moves off a tool, and -1 is not
81d66cf3 91allowed as an identifier in the event system.
a660d684 92
81d66cf3
JS
93\twocolwidtha{7cm}
94\begin{twocollist}\itemsep=0pt
95\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
96(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
97\twocolitem{{\bf EVT\_MENU(id, func)}}{The same as EVT\_TOOL.}
98\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
d3c17ee7 99for a range of identifiers. Pass the ids of the tools.}
81d66cf3 100\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{The same as EVT\_TOOL\_RANGE.}
81d66cf3
JS
101\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
102Pass the id of the tool.}
103\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
104for a range of ids. Pass the ids of the tools.}
105\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
106Pass the id of the toolbar itself. The value of wxCommandEvent::GetSelection is the tool id, or -1 if the mouse cursor has moved off a tool.}
a9a0ceca
VZ
107\twocolitem{{\bf EVT\_TOOL\_DROPDOWN(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_DROPDOWN\_CLICKED event. If unhandled, displays the default dropdown menu set using \helpref{wxToolBar::SetDropdownMenu}{wxtoolbarsetdropdownmenu}.}
108\end{twocollist}
109
110\wxheading{wxItemKind}
111
112There are several different types of tools you can add to a toolbar. These
113types are controlled by the wxItemKind enumeration which has the following
114values:
115\twocolwidtha{5cm}
116\begin{twocollist}\itemsep=0pt
117\twocolitem{{\bf wxITEM\_NORMAL}}{Normal tool button}
118\twocolitem{{\bf wxITEM\_CHECK}}{Check (or toggle) tool button.}
119\twocolitem{{\bf wxITEM\_NORMAL}}{Radio tool button. See \helpref{wxToolBar::AddRadioTool}{wxtoolbaraddradiotool} for details}
120\twocolitem{{\bf wxITEM\_DROPDOWN}}{Normal tool button with a dropdown arrow
121next to it. Clicking the dropdown arrow sends a wxEVT\_COMMAND\_TOOL\_DROPDOWN\_CLICKED
122event and may also display the menu previously associated with the item with
123\helpref{wxToolBar::SetDropdownMenu}{wxtoolbarsetdropdownmenu}. Currently this
fc6557a6 124type of tools is supported under MSW and GTK.}
81d66cf3 125\end{twocollist}
a660d684
KB
126
127\wxheading{See also}
128
129\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
a660d684
KB
130\helpref{wxScrolledWindow}{wxscrolledwindow}
131
132\latexignore{\rtfignore{\wxheading{Members}}}
133
a16a4ab1 134
81d66cf3 135\membersection{wxToolBar::wxToolBar}\label{wxtoolbarconstr}
a660d684 136
81d66cf3 137\func{}{wxToolBar}{\void}
a660d684
KB
138
139Default constructor.
140
81d66cf3
JS
141\func{}{wxToolBar}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
142 \param{const wxPoint\& }{pos = wxDefaultPosition},
143 \param{const wxSize\& }{size = wxDefaultSize},
8f689717 144 \param{long }{style = wxTB\_HORIZONTAL \pipe wxBORDER\_NONE},
81d66cf3
JS
145 \param{const wxString\& }{name = wxPanelNameStr}}
146
147Constructs a toolbar.
148
149\wxheading{Parameters}
150
151\docparam{parent}{Pointer to a parent window.}
a660d684 152
81d66cf3
JS
153\docparam{id}{Window identifier. If -1, will automatically create an identifier.}
154
fc2171bd 155\docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWidgets
81d66cf3
JS
156should generate a default position for the window. If using the wxWindow class directly, supply
157an actual position.}
158
fc2171bd 159\docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWidgets
81d66cf3
JS
160should generate a default size for the window.}
161
162\docparam{style}{Window style. See \helpref{wxToolBar}{wxtoolbar} for details.}
163
164\docparam{name}{Window name.}
165
166\wxheading{Remarks}
167
168After a toolbar is created, you use \helpref{wxToolBar::AddTool}{wxtoolbaraddtool} and
169perhaps \helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}, and then you
170must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} to construct and display the toolbar
171tools.
172
173You may also create a toolbar that is managed by the frame, by
174calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
175
a16a4ab1 176
6d06e061 177\membersection{wxToolBar::\destruct{wxToolBar}}\label{wxtoolbardtor}
81d66cf3
JS
178
179\func{void}{\destruct{wxToolBar}}{\void}
a660d684
KB
180
181Toolbar destructor.
182
a16a4ab1 183
5f445b31
RR
184\membersection{wxToolBar::AddControl}\label{wxtoolbaraddcontrol}
185
cdb11cb9 186\func{bool}{AddControl}{\param{wxControl*}{ control}, \param{const wxString&}{ label = ""}}
5f445b31
RR
187
188Adds any control to the toolbar, typically e.g. a combobox.
189
190\docparam{control}{The control to be added.}
191
cdb11cb9
VZ
192\docparam{label}{Text to be displayed near the control.}
193
194\wxheading{Remarks}
195
196wxMSW: the label is only displayed if there is enough space available below the embedded control.
197
f5f93ea5 198wxMac: labels are only displayed if wxWidgets is built with wxMAC\_USE\_NATIVE\_TOOLBAR set to 1
cdb11cb9 199
a16a4ab1 200
81d66cf3 201\membersection{wxToolBar::AddSeparator}\label{wxtoolbaraddseparator}
a660d684
KB
202
203\func{void}{AddSeparator}{\void}
204
205Adds a separator for spacing groups of tools.
206
207\wxheading{See also}
208
81d66cf3 209\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 210
a16a4ab1 211
81d66cf3 212\membersection{wxToolBar::AddTool}\label{wxtoolbaraddtool}
a660d684 213
9a75ba66 214\func{wxToolBarToolBase*}{AddTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
215\param{const wxString\&}{ label},\rtfsp
216\param{const wxBitmap\&}{ bitmap1},\rtfsp
217\param{const wxString\& }{shortHelpString = ""},\rtfsp
218\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
219
9a75ba66 220\func{wxToolBarToolBase*}{AddTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
221\param{const wxString\&}{ label},\rtfsp
222\param{const wxBitmap\&}{ bitmap1},\rtfsp
223\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap},\rtfsp
224\param{wxItemKind}{ kind = wxITEM\_NORMAL},\rtfsp
225\param{const wxString\& }{shortHelpString = ""},
226\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 227\param{wxObject* }{clientData = \NULL}}
a660d684 228
9a75ba66 229\func{wxToolBarToolBase*}{AddTool}{\param{wxToolBarToolBase* }{tool}}
dd91da4e 230
3ca6a5f0 231Adds a tool to the toolbar. The first (short and most commonly used) version
882bf210 232has fewer parameters than the full version at the price of not being able to
dd91da4e 233specify some of the more rarely used button features. The last version allows
ac1f013c 234you to add an existing tool.
a660d684
KB
235
236\wxheading{Parameters}
237
5ef2e633 238\docparam{toolId}{An integer by which
a660d684
KB
239the tool may be identified in subsequent operations.}
240
882bf210
VZ
241\docparam{kind}{May be wxITEM\_NORMAL for a normal button (default),
242wxITEM\_CHECK for a checkable tool (such tool stays pressed after it had been
243toggled) or wxITEM\_RADIO for a checkable tool which makes part of a radio
244group of tools each of which is automatically unchecked whenever another button
245in the group is checked}
a660d684 246
0bab4df5 247\docparam{bitmap1}{The primary tool bitmap.}
a660d684 248
0bab4df5
VZ
249\docparam{bitmap2}{The bitmap used when the tool is disabled. If it is equal to
250wxNullBitmap, the disabled bitmap is automatically generated by greing the
251normal one.}
a660d684 252
5ef2e633 253\docparam{shortHelpString}{This string is used for the tools tooltip}
a660d684 254
5ef2e633
VZ
255\docparam{longHelpString}{This string is shown in the statusbar (if any) of the
256parent frame when the mouse pointer is inside the tool}
a660d684 257
882bf210
VZ
258\docparam{clientData}{An optional pointer to client data which can be
259retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
260
dd91da4e
VZ
261\docparam{tool}{The tool to be added.}
262
81d66cf3 263\wxheading{Remarks}
a660d684 264
81d66cf3
JS
265After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
266order to have the tools appear.
a660d684 267
81d66cf3 268\wxheading{See also}
a660d684 269
882bf210
VZ
270\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator},\rtfsp
271\helpref{wxToolBar::AddCheckTool}{wxtoolbaraddchecktool},\rtfsp
272\helpref{wxToolBar::AddRadioTool}{wxtoolbaraddradiotool},\rtfsp
273\helpref{wxToolBar::InsertTool}{wxtoolbarinserttool},\rtfsp
274\helpref{wxToolBar::DeleteTool}{wxtoolbardeletetool},\rtfsp
275\helpref{wxToolBar::Realize}{wxtoolbarrealize}
276
a16a4ab1 277
882bf210
VZ
278\membersection{wxToolBar::AddCheckTool}\label{wxtoolbaraddchecktool}
279
9a75ba66 280\func{wxToolBarToolBase*}{AddCheckTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
281\param{const wxString\&}{ label},\rtfsp
282\param{const wxBitmap\&}{ bitmap1},\rtfsp
283\param{const wxBitmap\&}{ bitmap2},\rtfsp
284\param{const wxString\& }{shortHelpString = ""},\rtfsp
285\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 286\param{wxObject* }{clientData = \NULL}}
882bf210
VZ
287
288Adds a new check (or toggle) tool to the toolbar. The parameters are the same
289as in \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.
290
291\wxheading{See also}
292
293\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
294
a16a4ab1 295
882bf210
VZ
296\membersection{wxToolBar::AddRadioTool}\label{wxtoolbaraddradiotool}
297
9a75ba66 298\func{wxToolBarToolBase*}{AddRadioTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
299\param{const wxString\&}{ label},\rtfsp
300\param{const wxBitmap\&}{ bitmap1},\rtfsp
301\param{const wxBitmap\&}{ bitmap2},\rtfsp
302\param{const wxString\& }{shortHelpString = ""},\rtfsp
303\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 304\param{wxObject* }{clientData = \NULL}}
882bf210
VZ
305
306Adds a new radio tool to the toolbar. Consecutive radio tools form a radio
307group such that exactly one button in the group is pressed at any moment, in
308other words whenever a button in the group is pressed the previously pressed
309button is automatically released. You should avoid having the radio groups of
310only one element as it would be impossible for the user to use such button.
311
312By default, the first button in the radio group is initially pressed, the
313others are not.
314
315\wxheading{See also}
316
317\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
a660d684 318
9aaca412
JS
319\membersection{wxToolBar::ClearTools}\label{wxtoolbarcleartools}
320
321\func{void}{ClearTools}{\void}
322
323Deletes all the tools in the toolbar.
a16a4ab1 324
5ef2e633 325\membersection{wxToolBar::DeleteTool}\label{wxtoolbardeletetool}
a660d684 326
5ef2e633 327\func{bool}{DeleteTool}{\param{int }{toolId}}
a660d684 328
5ef2e633
VZ
329Removes the specified tool from the toolbar and deletes it. If you don't want
330to delete the tool, but just to remove it from the toolbar (to possibly add it
331back later), you may use \helpref{RemoveTool}{wxtoolbarremovetool} instead.
a660d684 332
5ef2e633
VZ
333Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
334change to take place, it will happen immediately.
a660d684 335
cc81d32f 336Returns true if the tool was deleted, false otherwise.
a660d684 337
5ef2e633 338\wxheading{See also}
a660d684 339
5ef2e633 340\helpref{DeleteToolByPos}{wxtoolbardeletetoolbypos}
a660d684 341
a16a4ab1 342
5ef2e633 343\membersection{wxToolBar::DeleteToolByPos}\label{wxtoolbardeletetoolbypos}
a660d684 344
5ef2e633 345\func{bool}{DeleteToolByPos}{\param{size\_t }{pos}}
a660d684 346
5ef2e633
VZ
347This function behaves like \helpref{DeleteTool}{wxtoolbardeletetool} but it
348deletes the tool at the specified position and not the one with the given id.
a660d684 349
a16a4ab1 350
81d66cf3 351\membersection{wxToolBar::EnableTool}\label{wxtoolbarenabletool}
a660d684 352
75d9e502 353\func{void}{EnableTool}{\param{int }{toolId}, \param{bool}{ enable}}
a660d684
KB
354
355Enables or disables the tool.
356
357\wxheading{Parameters}
358
5ef2e633 359\docparam{toolId}{Tool to enable or disable.}
a660d684 360
cc81d32f 361\docparam{enable}{If true, enables the tool, otherwise disables it.}
a660d684 362
9856788f
VZ
363{\bf NB:} This function should only be called after
364\helpref{Realize}{wxtoolbarrealize}.
365
a660d684
KB
366\wxheading{Remarks}
367
ac1f013c 368Some implementations will change the visible state of the tool to indicate that it is disabled.
a660d684
KB
369
370\wxheading{See also}
371
81d66cf3 372\helpref{wxToolBar::GetToolEnabled}{wxtoolbargettoolenabled},\rtfsp
81d66cf3 373\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
a660d684 374
a16a4ab1 375
ae071f31
JS
376\membersection{wxToolBar::FindById}\label{wxtoolbarfindbyid}
377
9a75ba66 378\func{wxToolBarToolBase*}{FindById}{\param{int }{id}}
ae071f31 379
a16a4ab1
VZ
380Returns a pointer to the tool identified by \arg{id} or
381\NULL if no corresponding tool is found.
382
ae071f31 383
f89a1397
RR
384\membersection{wxToolBar::FindControl}\label{wxtoolbarfindcontrol}
385
386\func{wxControl*}{FindControl}{\param{int }{id}}
387
a16a4ab1
VZ
388Returns a pointer to the control identified by \arg{id} or
389\NULL if no corresponding control is found.
390
f89a1397 391
81d66cf3 392\membersection{wxToolBar::FindToolForPosition}\label{wxtoolbarfindtoolforposition}
a660d684 393
eeb5b65b 394\constfunc{wxToolBarToolBase*}{FindToolForPosition}{\param{wxCoord }{x}, \param{wxCoord }{y}}
a660d684
KB
395
396Finds a tool for the given mouse position.
397
398\wxheading{Parameters}
399
400\docparam{x}{X position.}
401
402\docparam{y}{Y position.}
403
404\wxheading{Return value}
405
a16a4ab1 406A pointer to a tool if a tool is found, or \NULL otherwise.
a660d684
KB
407
408\wxheading{Remarks}
409
a16a4ab1
VZ
410Currently not implemented in wxGTK (always returns \NULL there).
411
a660d684 412
9aaca412
JS
413\membersection{wxToolBar::GetToolsCount}\label{wxtoolbargettoolscount}
414
415\constfunc{int}{GetToolsCount}{\void}
416
417Returns the number of tools in the toolbar.
418
419
81d66cf3 420\membersection{wxToolBar::GetToolSize}\label{wxtoolbargettoolsize}
a660d684 421
81d66cf3 422\func{wxSize}{GetToolSize}{\void}
a660d684
KB
423
424Returns the size of a whole button, which is usually larger than a tool bitmap because
425of added 3D effects.
426
427\wxheading{See also}
428
81d66cf3
JS
429\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
430\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize}
a660d684 431
a16a4ab1 432
81d66cf3 433\membersection{wxToolBar::GetToolBitmapSize}\label{wxtoolbargettoolbitmapsize}
a660d684 434
81d66cf3 435\func{wxSize}{GetToolBitmapSize}{\void}
a660d684
KB
436
437Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.
438
439\wxheading{Remarks}
440
81d66cf3 441Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
442and not the eventual size of the tool button.
443
444\wxheading{See also}
445
81d66cf3
JS
446\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
447\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 448
a16a4ab1 449
81d66cf3 450\membersection{wxToolBar::GetMargins}\label{wxtoolbargetmargins}
a660d684
KB
451
452\constfunc{wxSize}{GetMargins}{\void}
453
454Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.
455
456\wxheading{See also}
457
81d66cf3 458\helpref{wxToolBar::SetMargins}{wxtoolbarsetmargins}
a660d684 459
a16a4ab1 460
81d66cf3 461\membersection{wxToolBar::GetToolClientData}\label{wxtoolbargettoolclientdata}
a660d684 462
5ef2e633 463\constfunc{wxObject*}{GetToolClientData}{\param{int }{toolId}}
a660d684
KB
464
465Get any client data associated with the tool.
466
467\wxheading{Parameters}
468
5ef2e633 469\docparam{toolId}{Id of the tool, as passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
470
471\wxheading{Return value}
472
a16a4ab1
VZ
473Client data, or \NULL if there is none.
474
a660d684 475
81d66cf3 476\membersection{wxToolBar::GetToolEnabled}\label{wxtoolbargettoolenabled}
a660d684 477
5ef2e633 478\constfunc{bool}{GetToolEnabled}{\param{int }{toolId}}
a660d684
KB
479
480Called to determine whether a tool is enabled (responds to user input).
481
482\wxheading{Parameters}
483
5ef2e633 484\docparam{toolId}{Id of the tool in question.}
a660d684
KB
485
486\wxheading{Return value}
487
cc81d32f 488true if the tool is enabled, false otherwise.
a660d684 489
5ef2e633
VZ
490\wxheading{See also}
491
492\helpref{wxToolBar::EnableTool}{wxtoolbarenabletool}
493
a16a4ab1 494
81d66cf3 495\membersection{wxToolBar::GetToolLongHelp}\label{wxtoolbargettoollonghelp}
a660d684 496
5ef2e633 497\constfunc{wxString}{GetToolLongHelp}{\param{int }{toolId}}
a660d684
KB
498
499Returns the long help for the given tool.
500
501\wxheading{Parameters}
502
5ef2e633 503\docparam{toolId}{The tool in question.}
a660d684
KB
504
505\wxheading{See also}
506
81d66cf3
JS
507\helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp},\rtfsp
508\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 509
a16a4ab1 510
81d66cf3 511\membersection{wxToolBar::GetToolPacking}\label{wxtoolbargettoolpacking}
a660d684
KB
512
513\constfunc{int}{GetToolPacking}{\void}
514
515Returns the value used for packing tools.
516
517\wxheading{See also}
518
81d66cf3 519\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
a660d684 520
a16a4ab1 521
e6c96a7c
JS
522\membersection{wxToolBar::GetToolPos}\label{wxtoolbargettoolpos}
523
524\constfunc{int}{GetToolPos}{\param{int }{toolId}}
525
a8d08dbd 526Returns the tool position in the toolbar, or {\tt wxNOT\_FOUND} if the tool is not found.
e6c96a7c 527
a16a4ab1 528
81d66cf3 529\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}
a660d684
KB
530
531\constfunc{int}{GetToolSeparation}{\void}
532
533Returns the default separator size.
534
535\wxheading{See also}
536
81d66cf3 537\helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 538
a16a4ab1 539
81d66cf3 540\membersection{wxToolBar::GetToolShortHelp}\label{wxtoolbargettoolshorthelp}
a660d684 541
5ef2e633 542\constfunc{wxString}{GetToolShortHelp}{\param{int }{toolId}}
a660d684
KB
543
544Returns the short help for the given tool.
545
a660d684
KB
546\wxheading{Parameters}
547
5ef2e633 548\docparam{toolId}{The tool in question.}
a660d684
KB
549
550\wxheading{See also}
551
81d66cf3
JS
552\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
553\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 554
a16a4ab1 555
81d66cf3 556\membersection{wxToolBar::GetToolState}\label{wxtoolbargettoolstate}
a660d684 557
5ef2e633 558\constfunc{bool}{GetToolState}{\param{int }{toolId}}
a660d684
KB
559
560Gets the on/off state of a toggle tool.
561
562\wxheading{Parameters}
563
5ef2e633 564\docparam{toolId}{The tool in question.}
a660d684
KB
565
566\wxheading{Return value}
567
cc81d32f 568true if the tool is toggled on, false otherwise.
a660d684 569
5ef2e633
VZ
570\wxheading{See also}
571
572\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
573
a16a4ab1 574
5ef2e633
VZ
575\membersection{wxToolBar::InsertControl}\label{wxtoolbarinsertcontrol}
576
9a75ba66 577\func{wxToolBarToolBase *}{InsertControl}{\param{size\_t }{pos}, \param{wxControl *}{control}}
5ef2e633
VZ
578
579Inserts the control into the toolbar at the given position.
580
581You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
a660d684 582
5ef2e633
VZ
583\wxheading{See also}
584
585\helpref{AddControl}{wxtoolbaraddcontrol},\\
586\helpref{InsertTool}{wxtoolbarinserttool}
587
a16a4ab1 588
5ef2e633
VZ
589\membersection{wxToolBar::InsertSeparator}\label{wxtoolbarinsertseparator}
590
9a75ba66 591\func{wxToolBarToolBase *}{InsertSeparator}{\param{size\_t }{pos}}
5ef2e633
VZ
592
593Inserts the separator into the toolbar at the given position.
594
595You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
596
597\wxheading{See also}
598
599\helpref{AddSeparator}{wxtoolbaraddseparator},\\
600\helpref{InsertTool}{wxtoolbarinserttool}
601
a16a4ab1 602
5ef2e633 603\membersection{wxToolBar::InsertTool}\label{wxtoolbarinserttool}
a660d684 604
9a75ba66 605\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp
605d715d 606\param{int}{ toolId}, \param{const wxBitmap\&}{ bitmap1},\rtfsp
cc81d32f 607\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp
a16a4ab1 608\param{wxObject* }{clientData = \NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
5ef2e633 609
9a75ba66
RN
610\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp
611\param{wxToolBarToolBase* }{tool}}
dd91da4e 612
5ef2e633
VZ
613Inserts the tool with the specified attributes into the toolbar at the given
614position.
a660d684 615
5ef2e633 616You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
81d66cf3
JS
617
618\wxheading{See also}
619
5ef2e633
VZ
620\helpref{AddTool}{wxtoolbaraddtool},\\
621\helpref{InsertControl}{wxtoolbarinsertcontrol},\\
622\helpref{InsertSeparator}{wxtoolbarinsertseparator}
81d66cf3 623
a16a4ab1 624
81d66cf3 625\membersection{wxToolBar::OnLeftClick}\label{wxtoolbaronleftclick}
a660d684 626
5ef2e633 627\func{bool}{OnLeftClick}{\param{int}{ toolId}, \param{bool}{ toggleDown}}
a660d684 628
81d66cf3
JS
629Called when the user clicks on a tool with the left mouse button.
630
631This is the old way of detecting tool clicks; although it will still work,
632you should use the EVT\_MENU or EVT\_TOOL macro instead.
a660d684
KB
633
634\wxheading{Parameters}
635
5ef2e633 636\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684 637
cc81d32f 638\docparam{toggleDown}{true if the tool is a toggle and the toggle is down, otherwise is false.}
a660d684
KB
639
640\wxheading{Return value}
641
cc81d32f 642If the tool is a toggle and this function returns false, the toggle
a660d684
KB
643toggle state (internal and visual) will not be changed. This provides a way of
644specifying that toggle operations are not permitted in some circumstances.
645
646\wxheading{See also}
647
81d66cf3
JS
648\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
649\helpref{wxToolBar::OnRightClick}{wxtoolbaronrightclick}
a660d684 650
a16a4ab1 651
81d66cf3 652\membersection{wxToolBar::OnMouseEnter}\label{wxtoolbaronmouseenter}
a660d684 653
5ef2e633 654\func{void}{OnMouseEnter}{\param{int}{ toolId}}
a660d684
KB
655
656This is called when the mouse cursor moves into a tool or out of
657the toolbar.
658
81d66cf3
JS
659This is the old way of detecting mouse enter events; although it will still work,
660you should use the EVT\_TOOL\_ENTER macro instead.
661
a660d684
KB
662\wxheading{Parameters}
663
5ef2e633 664\docparam{toolId}{Greater than -1 if the mouse cursor has moved into the tool,
a660d684
KB
665or -1 if the mouse cursor has moved. The
666programmer can override this to provide extra information about the tool,
667such as a short description on the status line.}
668
669\wxheading{Remarks}
670
fc2171bd 671With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWidgets may not be able to
a660d684
KB
672detect it. Therefore this function may not always be called when expected.
673
a16a4ab1 674
81d66cf3 675\membersection{wxToolBar::OnRightClick}\label{wxtoolbaronrightclick}
a660d684 676
5ef2e633 677\func{void}{OnRightClick}{\param{int}{ toolId}, \param{float}{ x}, \param{float}{ y}}
a660d684
KB
678
679Called when the user clicks on a tool with the right mouse button. The
680programmer should override this function to detect right tool clicks.
681
81d66cf3
JS
682This is the old way of detecting tool right clicks; although it will still work,
683you should use the EVT\_TOOL\_RCLICKED macro instead.
684
a660d684
KB
685\wxheading{Parameters}
686
5ef2e633 687\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
688
689\docparam{x}{The x position of the mouse cursor.}
690
691\docparam{y}{The y position of the mouse cursor.}
692
693\wxheading{Remarks}
694
695A typical use of this member might be to pop up a menu.
696
697\wxheading{See also}
698
81d66cf3
JS
699\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
700\helpref{wxToolBar::OnLeftClick}{wxtoolbaronleftclick}
701
a16a4ab1 702
81d66cf3
JS
703\membersection{wxToolBar::Realize}\label{wxtoolbarrealize}
704
705\func{bool}{Realize}{\void}
706
e12be2f7 707This function should be called after you have added tools.
81d66cf3 708
a16a4ab1 709
5ef2e633
VZ
710\membersection{wxToolBar::RemoveTool}\label{wxtoolbarremovetool}
711
9a75ba66 712\func{wxToolBarToolBase *}{RemoveTool}{\param{int }{id}}
5ef2e633
VZ
713
714Removes the given tool from the toolbar but doesn't delete it. This allows to
715insert/add this tool back to this (or another) toolbar later.
716
717Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
718change to take place, it will happen immediately.
719
720\wxheading{See also}
721
722\helpref{DeleteTool}{wxtoolbardeletetool}
723
a16a4ab1 724
ac1f013c
JS
725\membersection{wxToolBar::SetBitmapResource}\label{wxtoolbarsetbitmapresource}
726
727\func{void}{SetBitmapResource}{\param{int }{resourceId}}
728
729Sets the bitmap resource identifier for specifying tool bitmaps as indices
730into a custom bitmap. Windows CE only.
731
a16a4ab1 732
6fd5fa4f
VZ
733\membersection{wxToolBar::SetMargins}\label{wxtoolbarsetmargins}
734
735\func{void}{SetMargins}{\param{const wxSize\&}{ size}}
736
737\func{void}{SetMargins}{\param{int}{ x}, \param{int}{ y}}
738
739Set the values to be used as margins for the toolbar.
740
741\wxheading{Parameters}
742
743\docparam{size}{Margin size.}
744
745\docparam{x}{Left margin, right margin and inter-tool separation value.}
746
747\docparam{y}{Top margin, bottom margin and inter-tool separation value.}
748
749\wxheading{Remarks}
750
751This must be called before the tools are added if absolute positioning is to be used, and the
752default (zero-size) margins are to be overridden.
753
754\wxheading{See also}
755
756\helpref{wxToolBar::GetMargins}{wxtoolbargetmargins}, \helpref{wxSize}{wxsize}
757
a16a4ab1 758
a9a0ceca
VZ
759\membersection{wxToolBar::SetDropdownMenu}\label{wxtoolbarsetdropdownmenu}
760
761\func{bool}{SetDropdownMenu}{\param{int }{id}, \param{wxMenu* }{menu}}
762
763Sets the dropdown menu for the tool given by its \arg{id}. The tool itself will
764delete the menu when it's no longer needed.
765
766If you define a EVT\_TOOL\_DROPDOWN handler in your program, you must call
767\helpref{wxEvent::Skip()}{wxeventskip} from it or the menu won't be displayed.
768
769
81d66cf3 770\membersection{wxToolBar::SetToolBitmapSize}\label{wxtoolbarsettoolbitmapsize}
a660d684 771
81d66cf3 772\func{void}{SetToolBitmapSize}{\param{const wxSize\&}{ size}}
a660d684
KB
773
774Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.
775
776\wxheading{Parameters}
777
778\docparam{size}{The size of the bitmaps in the toolbar.}
779
780\wxheading{Remarks}
781
782This should be called to tell the toolbar what the tool bitmap size is. Call
783it before you add tools.
784
81d66cf3 785Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
786and not the eventual size of the tool button.
787
788\wxheading{See also}
789
81d66cf3
JS
790\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize},\rtfsp
791\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 792
a16a4ab1 793
6fd5fa4f 794\membersection{wxToolBar::SetToolClientData}\label{wxtoolbarsettoolclientdata}
a660d684 795
7899ef95 796\func{void}{SetToolClientData}{\param{int }{id}, \param{wxObject* }{clientData}}
a660d684 797
6fd5fa4f 798Sets the client data associated with the tool.
a660d684 799
a16a4ab1 800
bbd321ff
RD
801\membersection{wxToolBar::SetToolDisabledBitmap}\label{wxtoolbarsettooldisabledbitmap}
802
803\func{void}{SetToolDisabledBitmap}{\param{int }{id}, \param{const wxBitmap\& }{bitmap}}
804
805Sets the bitmap to be used by the tool with the given ID when the tool
806is in a disabled state. This can only be used on Button tools, not
807controls. NOTE: The native toolbar classes on the main platforms all
808synthesize the disabled bitmap from the normal bitmap, so this
809function will have no effect on those platforms.
810
811
81d66cf3 812\membersection{wxToolBar::SetToolLongHelp}\label{wxtoolbarsettoollonghelp}
a660d684 813
5ef2e633 814\func{void}{SetToolLongHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
815
816Sets the long help for the given tool.
817
818\wxheading{Parameters}
819
5ef2e633 820\docparam{toolId}{The tool in question.}
a660d684
KB
821
822\docparam{helpString}{A string for the long help.}
823
824\wxheading{Remarks}
825
826You might use the long help for displaying the tool purpose on the status line.
827
828\wxheading{See also}
829
81d66cf3
JS
830\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
831\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp},\rtfsp
a660d684 832
a16a4ab1 833
81d66cf3 834\membersection{wxToolBar::SetToolPacking}\label{wxtoolbarsettoolpacking}
a660d684 835
eaaa6a06 836\func{void}{SetToolPacking}{\param{int}{ packing}}
a660d684
KB
837
838Sets the value used for spacing tools. The default value is 1.
839
840\wxheading{Parameters}
841
842\docparam{packing}{The value for packing.}
843
844\wxheading{Remarks}
845
846The packing is used for spacing in the vertical direction if the toolbar is horizontal,
847and for spacing in the horizontal direction if the toolbar is vertical.
848
849\wxheading{See also}
850
81d66cf3 851\helpref{wxToolBar::GetToolPacking}{wxtoolbargettoolpacking}
a660d684 852
a16a4ab1 853
81d66cf3 854\membersection{wxToolBar::SetToolShortHelp}\label{wxtoolbarsettoolshorthelp}
a660d684 855
5ef2e633 856\func{void}{SetToolShortHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
857
858Sets the short help for the given tool.
859
860\wxheading{Parameters}
861
5ef2e633 862\docparam{toolId}{The tool in question.}
a660d684
KB
863
864\docparam{helpString}{The string for the short help.}
865
866\wxheading{Remarks}
867
868An application might use short help for identifying the tool purpose in a tooltip.
869
870\wxheading{See also}
871
81d66cf3 872\helpref{wxToolBar::GetToolShortHelp}{wxtoolbargettoolshorthelp}, \helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp}
a660d684 873
a16a4ab1 874
bbd321ff
RD
875\membersection{wxToolBar::SetToolNormalBitmap}\label{wxtoolbarsettoolnormalbitmap}
876
877\func{void}{SetToolNormalBitmap}{\param{int }{id}, \param{const wxBitmap\& }{bitmap}}
878
879Sets the bitmap to be used by the tool with the given ID. This can
880only be used on Button tools, not controls.
881
882
883
81d66cf3 884\membersection{wxToolBar::SetToolSeparation}\label{wxtoolbarsettoolseparation}
a660d684 885
eaaa6a06 886\func{void}{SetToolSeparation}{\param{int}{ separation}}
a660d684
KB
887
888Sets the default separator size. The default value is 5.
889
890\wxheading{Parameters}
891
892\docparam{separation}{The separator size.}
893
894\wxheading{See also}
895
81d66cf3 896\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}
a660d684 897
a16a4ab1 898
81d66cf3 899\membersection{wxToolBar::ToggleTool}\label{wxtoolbartoggletool}
a660d684 900
75d9e502 901\func{void}{ToggleTool}{\param{int }{toolId}, \param{bool}{ toggle}}
a660d684 902
41bf0eb3 903Toggles a tool on or off. This does not cause any event to get emitted.
a660d684
KB
904
905\wxheading{Parameters}
906
5ef2e633 907\docparam{toolId}{Tool in question.}
a660d684 908
cc81d32f 909\docparam{toggle}{If true, toggles the tool on, otherwise toggles it off.}
a660d684
KB
910
911\wxheading{Remarks}
912
913Only applies to a tool that has been specified as a toggle tool.
914
915\wxheading{See also}
916
81d66cf3 917\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}
0497e172 918