]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/toolbar.tex
fix assert because of passing more than one border bit in style to the base class...
[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.}
107\end{twocollist}
a660d684
KB
108
109\wxheading{See also}
110
111\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
a660d684
KB
112\helpref{wxScrolledWindow}{wxscrolledwindow}
113
114\latexignore{\rtfignore{\wxheading{Members}}}
115
a16a4ab1 116
81d66cf3 117\membersection{wxToolBar::wxToolBar}\label{wxtoolbarconstr}
a660d684 118
81d66cf3 119\func{}{wxToolBar}{\void}
a660d684
KB
120
121Default constructor.
122
81d66cf3
JS
123\func{}{wxToolBar}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
124 \param{const wxPoint\& }{pos = wxDefaultPosition},
125 \param{const wxSize\& }{size = wxDefaultSize},
126 \param{long }{style = wxTB\_HORIZONTAL \pipe wxNO\_BORDER},
127 \param{const wxString\& }{name = wxPanelNameStr}}
128
129Constructs a toolbar.
130
131\wxheading{Parameters}
132
133\docparam{parent}{Pointer to a parent window.}
a660d684 134
81d66cf3
JS
135\docparam{id}{Window identifier. If -1, will automatically create an identifier.}
136
fc2171bd 137\docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWidgets
81d66cf3
JS
138should generate a default position for the window. If using the wxWindow class directly, supply
139an actual position.}
140
fc2171bd 141\docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWidgets
81d66cf3
JS
142should generate a default size for the window.}
143
144\docparam{style}{Window style. See \helpref{wxToolBar}{wxtoolbar} for details.}
145
146\docparam{name}{Window name.}
147
148\wxheading{Remarks}
149
150After a toolbar is created, you use \helpref{wxToolBar::AddTool}{wxtoolbaraddtool} and
151perhaps \helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}, and then you
152must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} to construct and display the toolbar
153tools.
154
155You may also create a toolbar that is managed by the frame, by
156calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
157
a16a4ab1 158
6d06e061 159\membersection{wxToolBar::\destruct{wxToolBar}}\label{wxtoolbardtor}
81d66cf3
JS
160
161\func{void}{\destruct{wxToolBar}}{\void}
a660d684
KB
162
163Toolbar destructor.
164
a16a4ab1 165
5f445b31
RR
166\membersection{wxToolBar::AddControl}\label{wxtoolbaraddcontrol}
167
168\func{bool}{AddControl}{\param{wxControl*}{ control}}
169
170Adds any control to the toolbar, typically e.g. a combobox.
171
172\docparam{control}{The control to be added.}
173
a16a4ab1 174
81d66cf3 175\membersection{wxToolBar::AddSeparator}\label{wxtoolbaraddseparator}
a660d684
KB
176
177\func{void}{AddSeparator}{\void}
178
179Adds a separator for spacing groups of tools.
180
181\wxheading{See also}
182
81d66cf3 183\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 184
a16a4ab1 185
81d66cf3 186\membersection{wxToolBar::AddTool}\label{wxtoolbaraddtool}
a660d684 187
9a75ba66 188\func{wxToolBarToolBase*}{AddTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
189\param{const wxString\&}{ label},\rtfsp
190\param{const wxBitmap\&}{ bitmap1},\rtfsp
191\param{const wxString\& }{shortHelpString = ""},\rtfsp
192\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
193
9a75ba66 194\func{wxToolBarToolBase*}{AddTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
195\param{const wxString\&}{ label},\rtfsp
196\param{const wxBitmap\&}{ bitmap1},\rtfsp
197\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap},\rtfsp
198\param{wxItemKind}{ kind = wxITEM\_NORMAL},\rtfsp
199\param{const wxString\& }{shortHelpString = ""},
200\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 201\param{wxObject* }{clientData = \NULL}}
a660d684 202
9a75ba66 203\func{wxToolBarToolBase*}{AddTool}{\param{wxToolBarToolBase* }{tool}}
dd91da4e 204
3ca6a5f0 205Adds a tool to the toolbar. The first (short and most commonly used) version
882bf210 206has fewer parameters than the full version at the price of not being able to
dd91da4e 207specify some of the more rarely used button features. The last version allows
ac1f013c 208you to add an existing tool.
a660d684
KB
209
210\wxheading{Parameters}
211
5ef2e633 212\docparam{toolId}{An integer by which
a660d684
KB
213the tool may be identified in subsequent operations.}
214
882bf210
VZ
215\docparam{kind}{May be wxITEM\_NORMAL for a normal button (default),
216wxITEM\_CHECK for a checkable tool (such tool stays pressed after it had been
217toggled) or wxITEM\_RADIO for a checkable tool which makes part of a radio
218group of tools each of which is automatically unchecked whenever another button
219in the group is checked}
a660d684 220
0bab4df5 221\docparam{bitmap1}{The primary tool bitmap.}
a660d684 222
0bab4df5
VZ
223\docparam{bitmap2}{The bitmap used when the tool is disabled. If it is equal to
224wxNullBitmap, the disabled bitmap is automatically generated by greing the
225normal one.}
a660d684 226
5ef2e633 227\docparam{shortHelpString}{This string is used for the tools tooltip}
a660d684 228
5ef2e633
VZ
229\docparam{longHelpString}{This string is shown in the statusbar (if any) of the
230parent frame when the mouse pointer is inside the tool}
a660d684 231
882bf210
VZ
232\docparam{clientData}{An optional pointer to client data which can be
233retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
234
dd91da4e
VZ
235\docparam{tool}{The tool to be added.}
236
81d66cf3 237\wxheading{Remarks}
a660d684 238
81d66cf3
JS
239After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
240order to have the tools appear.
a660d684 241
81d66cf3 242\wxheading{See also}
a660d684 243
882bf210
VZ
244\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator},\rtfsp
245\helpref{wxToolBar::AddCheckTool}{wxtoolbaraddchecktool},\rtfsp
246\helpref{wxToolBar::AddRadioTool}{wxtoolbaraddradiotool},\rtfsp
247\helpref{wxToolBar::InsertTool}{wxtoolbarinserttool},\rtfsp
248\helpref{wxToolBar::DeleteTool}{wxtoolbardeletetool},\rtfsp
249\helpref{wxToolBar::Realize}{wxtoolbarrealize}
250
a16a4ab1 251
882bf210
VZ
252\membersection{wxToolBar::AddCheckTool}\label{wxtoolbaraddchecktool}
253
9a75ba66 254\func{wxToolBarToolBase*}{AddCheckTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
255\param{const wxString\&}{ label},\rtfsp
256\param{const wxBitmap\&}{ bitmap1},\rtfsp
257\param{const wxBitmap\&}{ bitmap2},\rtfsp
258\param{const wxString\& }{shortHelpString = ""},\rtfsp
259\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 260\param{wxObject* }{clientData = \NULL}}
882bf210
VZ
261
262Adds a new check (or toggle) tool to the toolbar. The parameters are the same
263as in \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.
264
265\wxheading{See also}
266
267\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
268
a16a4ab1 269
882bf210
VZ
270\membersection{wxToolBar::AddRadioTool}\label{wxtoolbaraddradiotool}
271
9a75ba66 272\func{wxToolBarToolBase*}{AddRadioTool}{\param{int}{ toolId},\rtfsp
882bf210
VZ
273\param{const wxString\&}{ label},\rtfsp
274\param{const wxBitmap\&}{ bitmap1},\rtfsp
275\param{const wxBitmap\&}{ bitmap2},\rtfsp
276\param{const wxString\& }{shortHelpString = ""},\rtfsp
277\param{const wxString\& }{longHelpString = ""},\rtfsp
a16a4ab1 278\param{wxObject* }{clientData = \NULL}}
882bf210
VZ
279
280Adds a new radio tool to the toolbar. Consecutive radio tools form a radio
281group such that exactly one button in the group is pressed at any moment, in
282other words whenever a button in the group is pressed the previously pressed
283button is automatically released. You should avoid having the radio groups of
284only one element as it would be impossible for the user to use such button.
285
286By default, the first button in the radio group is initially pressed, the
287others are not.
288
289\wxheading{See also}
290
291\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
a660d684 292
9aaca412
JS
293\membersection{wxToolBar::ClearTools}\label{wxtoolbarcleartools}
294
295\func{void}{ClearTools}{\void}
296
297Deletes all the tools in the toolbar.
a16a4ab1 298
5ef2e633 299\membersection{wxToolBar::DeleteTool}\label{wxtoolbardeletetool}
a660d684 300
5ef2e633 301\func{bool}{DeleteTool}{\param{int }{toolId}}
a660d684 302
5ef2e633
VZ
303Removes the specified tool from the toolbar and deletes it. If you don't want
304to delete the tool, but just to remove it from the toolbar (to possibly add it
305back later), you may use \helpref{RemoveTool}{wxtoolbarremovetool} instead.
a660d684 306
5ef2e633
VZ
307Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
308change to take place, it will happen immediately.
a660d684 309
cc81d32f 310Returns true if the tool was deleted, false otherwise.
a660d684 311
5ef2e633 312\wxheading{See also}
a660d684 313
5ef2e633 314\helpref{DeleteToolByPos}{wxtoolbardeletetoolbypos}
a660d684 315
a16a4ab1 316
5ef2e633 317\membersection{wxToolBar::DeleteToolByPos}\label{wxtoolbardeletetoolbypos}
a660d684 318
5ef2e633 319\func{bool}{DeleteToolByPos}{\param{size\_t }{pos}}
a660d684 320
5ef2e633
VZ
321This function behaves like \helpref{DeleteTool}{wxtoolbardeletetool} but it
322deletes the tool at the specified position and not the one with the given id.
a660d684 323
a16a4ab1 324
81d66cf3 325\membersection{wxToolBar::EnableTool}\label{wxtoolbarenabletool}
a660d684 326
5ef2e633 327\func{void}{EnableTool}{\param{int }{toolId}, \param{const bool}{ enable}}
a660d684
KB
328
329Enables or disables the tool.
330
331\wxheading{Parameters}
332
5ef2e633 333\docparam{toolId}{Tool to enable or disable.}
a660d684 334
cc81d32f 335\docparam{enable}{If true, enables the tool, otherwise disables it.}
a660d684 336
9856788f
VZ
337{\bf NB:} This function should only be called after
338\helpref{Realize}{wxtoolbarrealize}.
339
a660d684
KB
340\wxheading{Remarks}
341
ac1f013c 342Some implementations will change the visible state of the tool to indicate that it is disabled.
a660d684
KB
343
344\wxheading{See also}
345
81d66cf3 346\helpref{wxToolBar::GetToolEnabled}{wxtoolbargettoolenabled},\rtfsp
81d66cf3 347\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
a660d684 348
a16a4ab1 349
ae071f31
JS
350\membersection{wxToolBar::FindById}\label{wxtoolbarfindbyid}
351
9a75ba66 352\func{wxToolBarToolBase*}{FindById}{\param{int }{id}}
ae071f31 353
a16a4ab1
VZ
354Returns a pointer to the tool identified by \arg{id} or
355\NULL if no corresponding tool is found.
356
ae071f31 357
f89a1397
RR
358\membersection{wxToolBar::FindControl}\label{wxtoolbarfindcontrol}
359
360\func{wxControl*}{FindControl}{\param{int }{id}}
361
a16a4ab1
VZ
362Returns a pointer to the control identified by \arg{id} or
363\NULL if no corresponding control is found.
364
f89a1397 365
81d66cf3 366\membersection{wxToolBar::FindToolForPosition}\label{wxtoolbarfindtoolforposition}
a660d684 367
eeb5b65b 368\constfunc{wxToolBarToolBase*}{FindToolForPosition}{\param{wxCoord }{x}, \param{wxCoord }{y}}
a660d684
KB
369
370Finds a tool for the given mouse position.
371
372\wxheading{Parameters}
373
374\docparam{x}{X position.}
375
376\docparam{y}{Y position.}
377
378\wxheading{Return value}
379
a16a4ab1 380A pointer to a tool if a tool is found, or \NULL otherwise.
a660d684
KB
381
382\wxheading{Remarks}
383
a16a4ab1
VZ
384Currently not implemented in wxGTK (always returns \NULL there).
385
a660d684 386
9aaca412
JS
387\membersection{wxToolBar::GetToolsCount}\label{wxtoolbargettoolscount}
388
389\constfunc{int}{GetToolsCount}{\void}
390
391Returns the number of tools in the toolbar.
392
393
81d66cf3 394\membersection{wxToolBar::GetToolSize}\label{wxtoolbargettoolsize}
a660d684 395
81d66cf3 396\func{wxSize}{GetToolSize}{\void}
a660d684
KB
397
398Returns the size of a whole button, which is usually larger than a tool bitmap because
399of added 3D effects.
400
401\wxheading{See also}
402
81d66cf3
JS
403\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
404\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize}
a660d684 405
a16a4ab1 406
81d66cf3 407\membersection{wxToolBar::GetToolBitmapSize}\label{wxtoolbargettoolbitmapsize}
a660d684 408
81d66cf3 409\func{wxSize}{GetToolBitmapSize}{\void}
a660d684
KB
410
411Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.
412
413\wxheading{Remarks}
414
81d66cf3 415Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
416and not the eventual size of the tool button.
417
418\wxheading{See also}
419
81d66cf3
JS
420\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
421\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 422
a16a4ab1 423
81d66cf3 424\membersection{wxToolBar::GetMargins}\label{wxtoolbargetmargins}
a660d684
KB
425
426\constfunc{wxSize}{GetMargins}{\void}
427
428Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.
429
430\wxheading{See also}
431
81d66cf3 432\helpref{wxToolBar::SetMargins}{wxtoolbarsetmargins}
a660d684 433
a16a4ab1 434
81d66cf3 435\membersection{wxToolBar::GetToolClientData}\label{wxtoolbargettoolclientdata}
a660d684 436
5ef2e633 437\constfunc{wxObject*}{GetToolClientData}{\param{int }{toolId}}
a660d684
KB
438
439Get any client data associated with the tool.
440
441\wxheading{Parameters}
442
5ef2e633 443\docparam{toolId}{Id of the tool, as passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
444
445\wxheading{Return value}
446
a16a4ab1
VZ
447Client data, or \NULL if there is none.
448
a660d684 449
81d66cf3 450\membersection{wxToolBar::GetToolEnabled}\label{wxtoolbargettoolenabled}
a660d684 451
5ef2e633 452\constfunc{bool}{GetToolEnabled}{\param{int }{toolId}}
a660d684
KB
453
454Called to determine whether a tool is enabled (responds to user input).
455
456\wxheading{Parameters}
457
5ef2e633 458\docparam{toolId}{Id of the tool in question.}
a660d684
KB
459
460\wxheading{Return value}
461
cc81d32f 462true if the tool is enabled, false otherwise.
a660d684 463
5ef2e633
VZ
464\wxheading{See also}
465
466\helpref{wxToolBar::EnableTool}{wxtoolbarenabletool}
467
a16a4ab1 468
81d66cf3 469\membersection{wxToolBar::GetToolLongHelp}\label{wxtoolbargettoollonghelp}
a660d684 470
5ef2e633 471\constfunc{wxString}{GetToolLongHelp}{\param{int }{toolId}}
a660d684
KB
472
473Returns the long help for the given tool.
474
475\wxheading{Parameters}
476
5ef2e633 477\docparam{toolId}{The tool in question.}
a660d684
KB
478
479\wxheading{See also}
480
81d66cf3
JS
481\helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp},\rtfsp
482\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 483
a16a4ab1 484
81d66cf3 485\membersection{wxToolBar::GetToolPacking}\label{wxtoolbargettoolpacking}
a660d684
KB
486
487\constfunc{int}{GetToolPacking}{\void}
488
489Returns the value used for packing tools.
490
491\wxheading{See also}
492
81d66cf3 493\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
a660d684 494
a16a4ab1 495
e6c96a7c
JS
496\membersection{wxToolBar::GetToolPos}\label{wxtoolbargettoolpos}
497
498\constfunc{int}{GetToolPos}{\param{int }{toolId}}
499
a8d08dbd 500Returns the tool position in the toolbar, or {\tt wxNOT\_FOUND} if the tool is not found.
e6c96a7c 501
a16a4ab1 502
81d66cf3 503\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}
a660d684
KB
504
505\constfunc{int}{GetToolSeparation}{\void}
506
507Returns the default separator size.
508
509\wxheading{See also}
510
81d66cf3 511\helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 512
a16a4ab1 513
81d66cf3 514\membersection{wxToolBar::GetToolShortHelp}\label{wxtoolbargettoolshorthelp}
a660d684 515
5ef2e633 516\constfunc{wxString}{GetToolShortHelp}{\param{int }{toolId}}
a660d684
KB
517
518Returns the short help for the given tool.
519
a660d684
KB
520\wxheading{Parameters}
521
5ef2e633 522\docparam{toolId}{The tool in question.}
a660d684
KB
523
524\wxheading{See also}
525
81d66cf3
JS
526\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
527\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 528
a16a4ab1 529
81d66cf3 530\membersection{wxToolBar::GetToolState}\label{wxtoolbargettoolstate}
a660d684 531
5ef2e633 532\constfunc{bool}{GetToolState}{\param{int }{toolId}}
a660d684
KB
533
534Gets the on/off state of a toggle tool.
535
536\wxheading{Parameters}
537
5ef2e633 538\docparam{toolId}{The tool in question.}
a660d684
KB
539
540\wxheading{Return value}
541
cc81d32f 542true if the tool is toggled on, false otherwise.
a660d684 543
5ef2e633
VZ
544\wxheading{See also}
545
546\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
547
a16a4ab1 548
5ef2e633
VZ
549\membersection{wxToolBar::InsertControl}\label{wxtoolbarinsertcontrol}
550
9a75ba66 551\func{wxToolBarToolBase *}{InsertControl}{\param{size\_t }{pos}, \param{wxControl *}{control}}
5ef2e633
VZ
552
553Inserts the control into the toolbar at the given position.
554
555You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
a660d684 556
5ef2e633
VZ
557\wxheading{See also}
558
559\helpref{AddControl}{wxtoolbaraddcontrol},\\
560\helpref{InsertTool}{wxtoolbarinserttool}
561
a16a4ab1 562
5ef2e633
VZ
563\membersection{wxToolBar::InsertSeparator}\label{wxtoolbarinsertseparator}
564
9a75ba66 565\func{wxToolBarToolBase *}{InsertSeparator}{\param{size\_t }{pos}}
5ef2e633
VZ
566
567Inserts the separator into the toolbar at the given position.
568
569You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
570
571\wxheading{See also}
572
573\helpref{AddSeparator}{wxtoolbaraddseparator},\\
574\helpref{InsertTool}{wxtoolbarinserttool}
575
a16a4ab1 576
5ef2e633 577\membersection{wxToolBar::InsertTool}\label{wxtoolbarinserttool}
a660d684 578
9a75ba66 579\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp
605d715d 580\param{int}{ toolId}, \param{const wxBitmap\&}{ bitmap1},\rtfsp
cc81d32f 581\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp
a16a4ab1 582\param{wxObject* }{clientData = \NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
5ef2e633 583
9a75ba66
RN
584\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp
585\param{wxToolBarToolBase* }{tool}}
dd91da4e 586
5ef2e633
VZ
587Inserts the tool with the specified attributes into the toolbar at the given
588position.
a660d684 589
5ef2e633 590You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
81d66cf3
JS
591
592\wxheading{See also}
593
5ef2e633
VZ
594\helpref{AddTool}{wxtoolbaraddtool},\\
595\helpref{InsertControl}{wxtoolbarinsertcontrol},\\
596\helpref{InsertSeparator}{wxtoolbarinsertseparator}
81d66cf3 597
a16a4ab1 598
81d66cf3 599\membersection{wxToolBar::OnLeftClick}\label{wxtoolbaronleftclick}
a660d684 600
5ef2e633 601\func{bool}{OnLeftClick}{\param{int}{ toolId}, \param{bool}{ toggleDown}}
a660d684 602
81d66cf3
JS
603Called when the user clicks on a tool with the left mouse button.
604
605This is the old way of detecting tool clicks; although it will still work,
606you should use the EVT\_MENU or EVT\_TOOL macro instead.
a660d684
KB
607
608\wxheading{Parameters}
609
5ef2e633 610\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684 611
cc81d32f 612\docparam{toggleDown}{true if the tool is a toggle and the toggle is down, otherwise is false.}
a660d684
KB
613
614\wxheading{Return value}
615
cc81d32f 616If the tool is a toggle and this function returns false, the toggle
a660d684
KB
617toggle state (internal and visual) will not be changed. This provides a way of
618specifying that toggle operations are not permitted in some circumstances.
619
620\wxheading{See also}
621
81d66cf3
JS
622\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
623\helpref{wxToolBar::OnRightClick}{wxtoolbaronrightclick}
a660d684 624
a16a4ab1 625
81d66cf3 626\membersection{wxToolBar::OnMouseEnter}\label{wxtoolbaronmouseenter}
a660d684 627
5ef2e633 628\func{void}{OnMouseEnter}{\param{int}{ toolId}}
a660d684
KB
629
630This is called when the mouse cursor moves into a tool or out of
631the toolbar.
632
81d66cf3
JS
633This is the old way of detecting mouse enter events; although it will still work,
634you should use the EVT\_TOOL\_ENTER macro instead.
635
a660d684
KB
636\wxheading{Parameters}
637
5ef2e633 638\docparam{toolId}{Greater than -1 if the mouse cursor has moved into the tool,
a660d684
KB
639or -1 if the mouse cursor has moved. The
640programmer can override this to provide extra information about the tool,
641such as a short description on the status line.}
642
643\wxheading{Remarks}
644
fc2171bd 645With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWidgets may not be able to
a660d684
KB
646detect it. Therefore this function may not always be called when expected.
647
a16a4ab1 648
81d66cf3 649\membersection{wxToolBar::OnRightClick}\label{wxtoolbaronrightclick}
a660d684 650
5ef2e633 651\func{void}{OnRightClick}{\param{int}{ toolId}, \param{float}{ x}, \param{float}{ y}}
a660d684
KB
652
653Called when the user clicks on a tool with the right mouse button. The
654programmer should override this function to detect right tool clicks.
655
81d66cf3
JS
656This is the old way of detecting tool right clicks; although it will still work,
657you should use the EVT\_TOOL\_RCLICKED macro instead.
658
a660d684
KB
659\wxheading{Parameters}
660
5ef2e633 661\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
662
663\docparam{x}{The x position of the mouse cursor.}
664
665\docparam{y}{The y position of the mouse cursor.}
666
667\wxheading{Remarks}
668
669A typical use of this member might be to pop up a menu.
670
671\wxheading{See also}
672
81d66cf3
JS
673\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
674\helpref{wxToolBar::OnLeftClick}{wxtoolbaronleftclick}
675
a16a4ab1 676
81d66cf3
JS
677\membersection{wxToolBar::Realize}\label{wxtoolbarrealize}
678
679\func{bool}{Realize}{\void}
680
e12be2f7 681This function should be called after you have added tools.
81d66cf3 682
a16a4ab1 683
5ef2e633
VZ
684\membersection{wxToolBar::RemoveTool}\label{wxtoolbarremovetool}
685
9a75ba66 686\func{wxToolBarToolBase *}{RemoveTool}{\param{int }{id}}
5ef2e633
VZ
687
688Removes the given tool from the toolbar but doesn't delete it. This allows to
689insert/add this tool back to this (or another) toolbar later.
690
691Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
692change to take place, it will happen immediately.
693
694\wxheading{See also}
695
696\helpref{DeleteTool}{wxtoolbardeletetool}
697
a16a4ab1 698
ac1f013c
JS
699\membersection{wxToolBar::SetBitmapResource}\label{wxtoolbarsetbitmapresource}
700
701\func{void}{SetBitmapResource}{\param{int }{resourceId}}
702
703Sets the bitmap resource identifier for specifying tool bitmaps as indices
704into a custom bitmap. Windows CE only.
705
a16a4ab1 706
6fd5fa4f
VZ
707\membersection{wxToolBar::SetMargins}\label{wxtoolbarsetmargins}
708
709\func{void}{SetMargins}{\param{const wxSize\&}{ size}}
710
711\func{void}{SetMargins}{\param{int}{ x}, \param{int}{ y}}
712
713Set the values to be used as margins for the toolbar.
714
715\wxheading{Parameters}
716
717\docparam{size}{Margin size.}
718
719\docparam{x}{Left margin, right margin and inter-tool separation value.}
720
721\docparam{y}{Top margin, bottom margin and inter-tool separation value.}
722
723\wxheading{Remarks}
724
725This must be called before the tools are added if absolute positioning is to be used, and the
726default (zero-size) margins are to be overridden.
727
728\wxheading{See also}
729
730\helpref{wxToolBar::GetMargins}{wxtoolbargetmargins}, \helpref{wxSize}{wxsize}
731
a16a4ab1 732
81d66cf3 733\membersection{wxToolBar::SetToolBitmapSize}\label{wxtoolbarsettoolbitmapsize}
a660d684 734
81d66cf3 735\func{void}{SetToolBitmapSize}{\param{const wxSize\&}{ size}}
a660d684
KB
736
737Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.
738
739\wxheading{Parameters}
740
741\docparam{size}{The size of the bitmaps in the toolbar.}
742
743\wxheading{Remarks}
744
745This should be called to tell the toolbar what the tool bitmap size is. Call
746it before you add tools.
747
81d66cf3 748Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
749and not the eventual size of the tool button.
750
751\wxheading{See also}
752
81d66cf3
JS
753\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize},\rtfsp
754\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 755
a16a4ab1 756
6fd5fa4f 757\membersection{wxToolBar::SetToolClientData}\label{wxtoolbarsettoolclientdata}
a660d684 758
7899ef95 759\func{void}{SetToolClientData}{\param{int }{id}, \param{wxObject* }{clientData}}
a660d684 760
6fd5fa4f 761Sets the client data associated with the tool.
a660d684 762
a16a4ab1 763
bbd321ff
RD
764\membersection{wxToolBar::SetToolDisabledBitmap}\label{wxtoolbarsettooldisabledbitmap}
765
766\func{void}{SetToolDisabledBitmap}{\param{int }{id}, \param{const wxBitmap\& }{bitmap}}
767
768Sets the bitmap to be used by the tool with the given ID when the tool
769is in a disabled state. This can only be used on Button tools, not
770controls. NOTE: The native toolbar classes on the main platforms all
771synthesize the disabled bitmap from the normal bitmap, so this
772function will have no effect on those platforms.
773
774
81d66cf3 775\membersection{wxToolBar::SetToolLongHelp}\label{wxtoolbarsettoollonghelp}
a660d684 776
5ef2e633 777\func{void}{SetToolLongHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
778
779Sets the long help for the given tool.
780
781\wxheading{Parameters}
782
5ef2e633 783\docparam{toolId}{The tool in question.}
a660d684
KB
784
785\docparam{helpString}{A string for the long help.}
786
787\wxheading{Remarks}
788
789You might use the long help for displaying the tool purpose on the status line.
790
791\wxheading{See also}
792
81d66cf3
JS
793\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
794\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp},\rtfsp
a660d684 795
a16a4ab1 796
81d66cf3 797\membersection{wxToolBar::SetToolPacking}\label{wxtoolbarsettoolpacking}
a660d684 798
eaaa6a06 799\func{void}{SetToolPacking}{\param{int}{ packing}}
a660d684
KB
800
801Sets the value used for spacing tools. The default value is 1.
802
803\wxheading{Parameters}
804
805\docparam{packing}{The value for packing.}
806
807\wxheading{Remarks}
808
809The packing is used for spacing in the vertical direction if the toolbar is horizontal,
810and for spacing in the horizontal direction if the toolbar is vertical.
811
812\wxheading{See also}
813
81d66cf3 814\helpref{wxToolBar::GetToolPacking}{wxtoolbargettoolpacking}
a660d684 815
a16a4ab1 816
81d66cf3 817\membersection{wxToolBar::SetToolShortHelp}\label{wxtoolbarsettoolshorthelp}
a660d684 818
5ef2e633 819\func{void}{SetToolShortHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
820
821Sets the short help for the given tool.
822
823\wxheading{Parameters}
824
5ef2e633 825\docparam{toolId}{The tool in question.}
a660d684
KB
826
827\docparam{helpString}{The string for the short help.}
828
829\wxheading{Remarks}
830
831An application might use short help for identifying the tool purpose in a tooltip.
832
833\wxheading{See also}
834
81d66cf3 835\helpref{wxToolBar::GetToolShortHelp}{wxtoolbargettoolshorthelp}, \helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp}
a660d684 836
a16a4ab1 837
bbd321ff
RD
838\membersection{wxToolBar::SetToolNormalBitmap}\label{wxtoolbarsettoolnormalbitmap}
839
840\func{void}{SetToolNormalBitmap}{\param{int }{id}, \param{const wxBitmap\& }{bitmap}}
841
842Sets the bitmap to be used by the tool with the given ID. This can
843only be used on Button tools, not controls.
844
845
846
81d66cf3 847\membersection{wxToolBar::SetToolSeparation}\label{wxtoolbarsettoolseparation}
a660d684 848
eaaa6a06 849\func{void}{SetToolSeparation}{\param{int}{ separation}}
a660d684
KB
850
851Sets the default separator size. The default value is 5.
852
853\wxheading{Parameters}
854
855\docparam{separation}{The separator size.}
856
857\wxheading{See also}
858
81d66cf3 859\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}
a660d684 860
a16a4ab1 861
81d66cf3 862\membersection{wxToolBar::ToggleTool}\label{wxtoolbartoggletool}
a660d684 863
5ef2e633 864\func{void}{ToggleTool}{\param{int }{toolId}, \param{const bool}{ toggle}}
a660d684 865
41bf0eb3 866Toggles a tool on or off. This does not cause any event to get emitted.
a660d684
KB
867
868\wxheading{Parameters}
869
5ef2e633 870\docparam{toolId}{Tool in question.}
a660d684 871
cc81d32f 872\docparam{toggle}{If true, toggles the tool on, otherwise toggles it off.}
a660d684
KB
873
874\wxheading{Remarks}
875
876Only applies to a tool that has been specified as a toggle tool.
877
878\wxheading{See also}
879
81d66cf3 880\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}
0497e172 881