]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/toolbar.tex
adding wxAdvanced library
[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.
9\item {\bf wxToolBarSimple} A simple implementation, with scrolling.
10Used on platforms with no native toolbar control, or where scrolling is required.
11\end{itemize}
12
13Note that the base class {\bf wxToolBarBase} defines
5f445b31 14automatic scrolling management functionality which is similar
81d66cf3
JS
15to \helpref{wxScrolledWindow}{wxscrolledwindow}, so please refer to this class also.
16Not all toolbars support scrolling, but wxToolBarSimple does.
a660d684
KB
17
18\wxheading{Derived from}
19
81d66cf3 20wxToolBarBase\\
a660d684
KB
21\helpref{wxControl}{wxcontrol}\\
22\helpref{wxWindow}{wxwindow}\\
23\helpref{wxEvtHandler}{wxevthandler}\\
24\helpref{wxObject}{wxobject}
25
954b8ae6
JS
26\wxheading{Include files}
27
28<wx/toolbar.h> (to allow wxWindows to select an appropriate toolbar class)\\
29<wx/tbarbase.h> (the base class)\\
30<wx/tbarmsw.h> (the non-Windows 95 Windows toolbar class)\\
31<wx/tbar95.h> (the Windows 95/98 toolbar class)\\
32<wx/tbarsmpl.h> (the generic simple toolbar class)
33
a660d684
KB
34\wxheading{Remarks}
35
81d66cf3
JS
36You may also create a toolbar that is managed by the frame, by
37calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
38
5f445b31
RR
39Due to the use of native toolbars on the various platforms, certain adaptions will
40often have to be made in order to get optimal look on all platforms as some platforms
41ignore the values for explicit placement and use their own layout and the meaning
42of a "separator" is a vertical line under Windows95 vs. simple space under GTK etc.
43
81d66cf3 44{\bf wxToolBar95:} Note that this toolbar paints tools to reflect user-selected colours.
81d66cf3
JS
45
46\wxheading{Window styles}
47
48\twocolwidtha{5cm}
49\begin{twocollist}\itemsep=0pt
b06ba076
JS
50\twocolitem{\windowstyle{wxTB\_FLAT}}{Gives the toolbar a flat look (Windows and GTK only).}
51\twocolitem{\windowstyle{wxTB\_DOCKABLE}}{Makes the toolbar floatable and dockable (GTK only).}
52\twocolitem{\windowstyle{wxTB\_HORIZONTAL}}{Specifies horizontal layout (default).}
53\twocolitem{\windowstyle{wxTB\_VERTICAL}}{Specifies vertical layout.}
54\twocolitem{\windowstyle{wxTB\_3DBUTTONS}}{Only for wxToolBarSimple: gives a mild 3D look to its buttons.}
55\twocolitem{\windowstyle{wxTB\_TEXT}}{Show the text in the toolbar buttons; by default only icons are shown.}
56\twocolitem{\windowstyle{wxTB\_NOICONS}}{Specifies no icons in the toolbar buttons; by default they are shown.}
57\twocolitem{\windowstyle{wxTB\_NODIVIDER}}{Specifies no divider (border) above the toolbar (Windows only).}
58\twocolitem{\windowstyle{wxTB\_NOALIGN}}{Specifies no alignment with the parent window (Windows only, not very useful).}
59\twocolitem{\windowstyle{wxTB\_HORZ\_LAYOUT}}{Show the text and the icons alongside, not vertically stacked (Windows and GTK
99e8cb50 602 only). This style must be used with wxTB\_TEXT.}
b06ba076 61\twocolitem{\windowstyle{wxTB\_HORZ\_TEXT}}{Combination of wxTB\_HORZ\_LAYOUT and wxTB\_TEXT.}
81d66cf3
JS
62\end{twocollist}
63
c631abda
VZ
64See also \helpref{window styles overview}{windowstyles}. Note that the Win32
65native toolbar ignores {\tt wxTB\_NOICONS} style. Also, toggling the
66{\tt wxTB\_TEXT} works only if the style was initially on.
a660d684
KB
67
68\wxheading{Event handling}
69
81d66cf3
JS
70The toolbar class emits menu commands in the same was that a frame menubar does,
71so you can use one EVT\_MENU macro for both a menu item and a toolbar button.
72The event handler functions take a wxCommandEvent argument. For most event macros,
73the identifier of the tool is passed, but for EVT\_TOOL\_ENTER the toolbar
74window is passed and the tool id is retrieved from the wxCommandEvent.
75This is because the id may be -1 when the mouse moves off a tool, and -1 is not
76allowed as an identifier in the event system.
a660d684 77
e702ff0f
JS
78Note that tool commands (and UI update events for tools) are first sent to
79the focus window within the frame that contains the toolbar. If no window within the frame has the focus,
80then the events are sent directly to the toolbar (and up the hierarchy to the
81frame, depending on where the application has put its event handlers). This allows command and UI update
82handling to be processed by specific windows and controls, and not necessarily
83by the application frame.
84
81d66cf3
JS
85\twocolwidtha{7cm}
86\begin{twocollist}\itemsep=0pt
87\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
88(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
89\twocolitem{{\bf EVT\_MENU(id, func)}}{The same as EVT\_TOOL.}
90\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
91for a range id identifiers. Pass the ids of the tools.}
92\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{The same as EVT\_TOOL\_RANGE.}
93
94\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
95Pass the id of the tool.}
96\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
97for a range of ids. Pass the ids of the tools.}
98\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
99Pass 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.}
100\end{twocollist}
a660d684
KB
101
102\wxheading{See also}
103
104\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
a660d684
KB
105\helpref{wxScrolledWindow}{wxscrolledwindow}
106
107\latexignore{\rtfignore{\wxheading{Members}}}
108
81d66cf3 109\membersection{wxToolBar::wxToolBar}\label{wxtoolbarconstr}
a660d684 110
81d66cf3 111\func{}{wxToolBar}{\void}
a660d684
KB
112
113Default constructor.
114
81d66cf3
JS
115\func{}{wxToolBar}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
116 \param{const wxPoint\& }{pos = wxDefaultPosition},
117 \param{const wxSize\& }{size = wxDefaultSize},
118 \param{long }{style = wxTB\_HORIZONTAL \pipe wxNO\_BORDER},
119 \param{const wxString\& }{name = wxPanelNameStr}}
120
121Constructs a toolbar.
122
123\wxheading{Parameters}
124
125\docparam{parent}{Pointer to a parent window.}
a660d684 126
81d66cf3
JS
127\docparam{id}{Window identifier. If -1, will automatically create an identifier.}
128
129\docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
130should generate a default position for the window. If using the wxWindow class directly, supply
131an actual position.}
132
133\docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows
134should generate a default size for the window.}
135
136\docparam{style}{Window style. See \helpref{wxToolBar}{wxtoolbar} for details.}
137
138\docparam{name}{Window name.}
139
140\wxheading{Remarks}
141
142After a toolbar is created, you use \helpref{wxToolBar::AddTool}{wxtoolbaraddtool} and
143perhaps \helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}, and then you
144must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} to construct and display the toolbar
145tools.
146
147You may also create a toolbar that is managed by the frame, by
148calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
149
150\membersection{wxToolBar::\destruct{wxToolBar}}
151
152\func{void}{\destruct{wxToolBar}}{\void}
a660d684
KB
153
154Toolbar destructor.
155
5f445b31
RR
156\membersection{wxToolBar::AddControl}\label{wxtoolbaraddcontrol}
157
158\func{bool}{AddControl}{\param{wxControl*}{ control}}
159
160Adds any control to the toolbar, typically e.g. a combobox.
161
162\docparam{control}{The control to be added.}
163
81d66cf3 164\membersection{wxToolBar::AddSeparator}\label{wxtoolbaraddseparator}
a660d684
KB
165
166\func{void}{AddSeparator}{\void}
167
168Adds a separator for spacing groups of tools.
169
170\wxheading{See also}
171
81d66cf3 172\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 173
81d66cf3 174\membersection{wxToolBar::AddTool}\label{wxtoolbaraddtool}
a660d684 175
882bf210
VZ
176\func{wxToolBarTool*}{AddTool}{\param{int}{ toolId},\rtfsp
177\param{const wxString\&}{ label},\rtfsp
178\param{const wxBitmap\&}{ bitmap1},\rtfsp
179\param{const wxString\& }{shortHelpString = ""},\rtfsp
180\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
181
182\func{wxToolBarTool*}{AddTool}{\param{int}{ toolId},\rtfsp
183\param{const wxString\&}{ label},\rtfsp
184\param{const wxBitmap\&}{ bitmap1},\rtfsp
185\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap},\rtfsp
186\param{wxItemKind}{ kind = wxITEM\_NORMAL},\rtfsp
187\param{const wxString\& }{shortHelpString = ""},
188\param{const wxString\& }{longHelpString = ""},\rtfsp
189\param{wxObject* }{clientData = NULL}}
a660d684 190
dd91da4e
VZ
191\func{wxToolBarTool*}{AddTool}{\param{wxToolBarTool* }{tool}}
192
3ca6a5f0 193Adds a tool to the toolbar. The first (short and most commonly used) version
882bf210 194has fewer parameters than the full version at the price of not being able to
dd91da4e
VZ
195specify some of the more rarely used button features. The last version allows
196to add an existing tool.
a660d684
KB
197
198\wxheading{Parameters}
199
5ef2e633 200\docparam{toolId}{An integer by which
a660d684
KB
201the tool may be identified in subsequent operations.}
202
882bf210
VZ
203\docparam{kind}{May be wxITEM\_NORMAL for a normal button (default),
204wxITEM\_CHECK for a checkable tool (such tool stays pressed after it had been
205toggled) or wxITEM\_RADIO for a checkable tool which makes part of a radio
206group of tools each of which is automatically unchecked whenever another button
207in the group is checked}
a660d684
KB
208
209\docparam{bitmap1}{The primary tool bitmap for toggle and button tools.}
210
211\docparam{bitmap2}{The second bitmap specifies the on-state bitmap for a toggle
85eb36c2 212tool. If this is wxNullBitmap, either an inverted version of the primary bitmap is
a660d684 213used for the on-state of a toggle tool (monochrome displays) or a black
85eb36c2
RR
214border is drawn around the tool (colour displays) or the pixmap is shown
215as a pressed button (GTK). }
a660d684 216
5ef2e633 217\docparam{shortHelpString}{This string is used for the tools tooltip}
a660d684 218
5ef2e633
VZ
219\docparam{longHelpString}{This string is shown in the statusbar (if any) of the
220parent frame when the mouse pointer is inside the tool}
a660d684 221
882bf210
VZ
222\docparam{clientData}{An optional pointer to client data which can be
223retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
224
dd91da4e
VZ
225\docparam{tool}{The tool to be added.}
226
81d66cf3 227\wxheading{Remarks}
a660d684 228
81d66cf3
JS
229After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
230order to have the tools appear.
a660d684 231
81d66cf3 232\wxheading{See also}
a660d684 233
882bf210
VZ
234\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator},\rtfsp
235\helpref{wxToolBar::AddCheckTool}{wxtoolbaraddchecktool},\rtfsp
236\helpref{wxToolBar::AddRadioTool}{wxtoolbaraddradiotool},\rtfsp
237\helpref{wxToolBar::InsertTool}{wxtoolbarinserttool},\rtfsp
238\helpref{wxToolBar::DeleteTool}{wxtoolbardeletetool},\rtfsp
239\helpref{wxToolBar::Realize}{wxtoolbarrealize}
240
241\membersection{wxToolBar::AddCheckTool}\label{wxtoolbaraddchecktool}
242
243\func{wxToolBarTool*}{AddCheckTool}{\param{int}{ toolId},\rtfsp
244\param{const wxString\&}{ label},\rtfsp
245\param{const wxBitmap\&}{ bitmap1},\rtfsp
246\param{const wxBitmap\&}{ bitmap2},\rtfsp
247\param{const wxString\& }{shortHelpString = ""},\rtfsp
248\param{const wxString\& }{longHelpString = ""},\rtfsp
249\param{wxObject* }{clientData = NULL}}
250
251Adds a new check (or toggle) tool to the toolbar. The parameters are the same
252as in \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.
253
254\wxheading{See also}
255
256\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
257
258\membersection{wxToolBar::AddRadioTool}\label{wxtoolbaraddradiotool}
259
260\func{wxToolBarTool*}{AddRadioTool}{\param{int}{ toolId},\rtfsp
261\param{const wxString\&}{ label},\rtfsp
262\param{const wxBitmap\&}{ bitmap1},\rtfsp
263\param{const wxBitmap\&}{ bitmap2},\rtfsp
264\param{const wxString\& }{shortHelpString = ""},\rtfsp
265\param{const wxString\& }{longHelpString = ""},\rtfsp
266\param{wxObject* }{clientData = NULL}}
267
268Adds a new radio tool to the toolbar. Consecutive radio tools form a radio
269group such that exactly one button in the group is pressed at any moment, in
270other words whenever a button in the group is pressed the previously pressed
271button is automatically released. You should avoid having the radio groups of
272only one element as it would be impossible for the user to use such button.
273
274By default, the first button in the radio group is initially pressed, the
275others are not.
276
277\wxheading{See also}
278
279\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}
a660d684 280
5ef2e633 281\membersection{wxToolBar::DeleteTool}\label{wxtoolbardeletetool}
a660d684 282
5ef2e633 283\func{bool}{DeleteTool}{\param{int }{toolId}}
a660d684 284
5ef2e633
VZ
285Removes the specified tool from the toolbar and deletes it. If you don't want
286to delete the tool, but just to remove it from the toolbar (to possibly add it
287back later), you may use \helpref{RemoveTool}{wxtoolbarremovetool} instead.
a660d684 288
5ef2e633
VZ
289Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
290change to take place, it will happen immediately.
a660d684 291
cc81d32f 292Returns true if the tool was deleted, false otherwise.
a660d684 293
5ef2e633 294\wxheading{See also}
a660d684 295
5ef2e633 296\helpref{DeleteToolByPos}{wxtoolbardeletetoolbypos}
a660d684 297
5ef2e633 298\membersection{wxToolBar::DeleteToolByPos}\label{wxtoolbardeletetoolbypos}
a660d684 299
5ef2e633 300\func{bool}{DeleteToolByPos}{\param{size\_t }{pos}}
a660d684 301
5ef2e633
VZ
302This function behaves like \helpref{DeleteTool}{wxtoolbardeletetool} but it
303deletes the tool at the specified position and not the one with the given id.
a660d684 304
81d66cf3 305\membersection{wxToolBar::EnableTool}\label{wxtoolbarenabletool}
a660d684 306
5ef2e633 307\func{void}{EnableTool}{\param{int }{toolId}, \param{const bool}{ enable}}
a660d684
KB
308
309Enables or disables the tool.
310
311\wxheading{Parameters}
312
5ef2e633 313\docparam{toolId}{Tool to enable or disable.}
a660d684 314
cc81d32f 315\docparam{enable}{If true, enables the tool, otherwise disables it.}
a660d684 316
9856788f
VZ
317{\bf NB:} This function should only be called after
318\helpref{Realize}{wxtoolbarrealize}.
319
a660d684
KB
320\wxheading{Remarks}
321
f7bd2698 322For wxToolBarSimple, does nothing. Some other implementations
a660d684
KB
323will change the visible state of the tool to indicate that it is disabled.
324
325\wxheading{See also}
326
81d66cf3 327\helpref{wxToolBar::GetToolEnabled}{wxtoolbargettoolenabled},\rtfsp
81d66cf3 328\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
a660d684 329
f89a1397
RR
330\membersection{wxToolBar::FindControl}\label{wxtoolbarfindcontrol}
331
332\func{wxControl*}{FindControl}{\param{int }{id}}
333
334Returns a pointer to the control identified by {\it id} or
335NULL if no corresponding control is found.
336
81d66cf3 337\membersection{wxToolBar::FindToolForPosition}\label{wxtoolbarfindtoolforposition}
a660d684 338
81d66cf3 339\constfunc{wxToolBarTool*}{FindToolForPosition}{\param{const float}{ x}, \param{const float}{ y}}
a660d684
KB
340
341Finds a tool for the given mouse position.
342
343\wxheading{Parameters}
344
345\docparam{x}{X position.}
346
347\docparam{y}{Y position.}
348
349\wxheading{Return value}
350
351A pointer to a tool if a tool is found, or NULL otherwise.
352
353\wxheading{Remarks}
354
355Used internally, and should not need to be used by the programmer.
356
81d66cf3 357\membersection{wxToolBar::GetToolSize}\label{wxtoolbargettoolsize}
a660d684 358
81d66cf3 359\func{wxSize}{GetToolSize}{\void}
a660d684
KB
360
361Returns the size of a whole button, which is usually larger than a tool bitmap because
362of added 3D effects.
363
364\wxheading{See also}
365
81d66cf3
JS
366\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
367\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize}
a660d684 368
81d66cf3 369\membersection{wxToolBar::GetToolBitmapSize}\label{wxtoolbargettoolbitmapsize}
a660d684 370
81d66cf3 371\func{wxSize}{GetToolBitmapSize}{\void}
a660d684
KB
372
373Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.
374
375\wxheading{Remarks}
376
81d66cf3 377Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
378and not the eventual size of the tool button.
379
380\wxheading{See also}
381
81d66cf3
JS
382\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
383\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 384
81d66cf3 385\membersection{wxToolBar::GetMargins}\label{wxtoolbargetmargins}
a660d684
KB
386
387\constfunc{wxSize}{GetMargins}{\void}
388
389Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.
390
391\wxheading{See also}
392
81d66cf3 393\helpref{wxToolBar::SetMargins}{wxtoolbarsetmargins}
a660d684 394
81d66cf3 395\membersection{wxToolBar::GetToolClientData}\label{wxtoolbargettoolclientdata}
a660d684 396
5ef2e633 397\constfunc{wxObject*}{GetToolClientData}{\param{int }{toolId}}
a660d684
KB
398
399Get any client data associated with the tool.
400
401\wxheading{Parameters}
402
5ef2e633 403\docparam{toolId}{Id of the tool, as passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
404
405\wxheading{Return value}
406
407Client data, or NULL if there is none.
408
81d66cf3 409\membersection{wxToolBar::GetToolEnabled}\label{wxtoolbargettoolenabled}
a660d684 410
5ef2e633 411\constfunc{bool}{GetToolEnabled}{\param{int }{toolId}}
a660d684
KB
412
413Called to determine whether a tool is enabled (responds to user input).
414
415\wxheading{Parameters}
416
5ef2e633 417\docparam{toolId}{Id of the tool in question.}
a660d684
KB
418
419\wxheading{Return value}
420
cc81d32f 421true if the tool is enabled, false otherwise.
a660d684 422
5ef2e633
VZ
423\wxheading{See also}
424
425\helpref{wxToolBar::EnableTool}{wxtoolbarenabletool}
426
81d66cf3 427\membersection{wxToolBar::GetToolLongHelp}\label{wxtoolbargettoollonghelp}
a660d684 428
5ef2e633 429\constfunc{wxString}{GetToolLongHelp}{\param{int }{toolId}}
a660d684
KB
430
431Returns the long help for the given tool.
432
433\wxheading{Parameters}
434
5ef2e633 435\docparam{toolId}{The tool in question.}
a660d684
KB
436
437\wxheading{See also}
438
81d66cf3
JS
439\helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp},\rtfsp
440\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 441
81d66cf3 442\membersection{wxToolBar::GetToolPacking}\label{wxtoolbargettoolpacking}
a660d684
KB
443
444\constfunc{int}{GetToolPacking}{\void}
445
446Returns the value used for packing tools.
447
448\wxheading{See also}
449
81d66cf3 450\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
a660d684 451
e6c96a7c
JS
452\membersection{wxToolBar::GetToolPos}\label{wxtoolbargettoolpos}
453
454\constfunc{int}{GetToolPos}{\param{int }{toolId}}
455
456Returns the tool position in the toolbar, or wxNOT\_FOUND if the tool is not found.
457
81d66cf3 458\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}
a660d684
KB
459
460\constfunc{int}{GetToolSeparation}{\void}
461
462Returns the default separator size.
463
464\wxheading{See also}
465
81d66cf3 466\helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
a660d684 467
81d66cf3 468\membersection{wxToolBar::GetToolShortHelp}\label{wxtoolbargettoolshorthelp}
a660d684 469
5ef2e633 470\constfunc{wxString}{GetToolShortHelp}{\param{int }{toolId}}
a660d684
KB
471
472Returns the short help for the given tool.
473
a660d684
KB
474\wxheading{Parameters}
475
5ef2e633 476\docparam{toolId}{The tool in question.}
a660d684
KB
477
478\wxheading{See also}
479
81d66cf3
JS
480\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
481\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
a660d684 482
81d66cf3 483\membersection{wxToolBar::GetToolState}\label{wxtoolbargettoolstate}
a660d684 484
5ef2e633 485\constfunc{bool}{GetToolState}{\param{int }{toolId}}
a660d684
KB
486
487Gets the on/off state of a toggle tool.
488
489\wxheading{Parameters}
490
5ef2e633 491\docparam{toolId}{The tool in question.}
a660d684
KB
492
493\wxheading{Return value}
494
cc81d32f 495true if the tool is toggled on, false otherwise.
a660d684 496
5ef2e633
VZ
497\wxheading{See also}
498
499\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
500
501\membersection{wxToolBar::InsertControl}\label{wxtoolbarinsertcontrol}
502
503\func{wxToolBarTool *}{InsertControl}{\param{size\_t }{pos}, \param{wxControl *}{control}}
504
505Inserts the control into the toolbar at the given position.
506
507You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
a660d684 508
5ef2e633
VZ
509\wxheading{See also}
510
511\helpref{AddControl}{wxtoolbaraddcontrol},\\
512\helpref{InsertTool}{wxtoolbarinserttool}
513
514\membersection{wxToolBar::InsertSeparator}\label{wxtoolbarinsertseparator}
515
516\func{wxToolBarTool *}{InsertSeparator}{\param{size\_t }{pos}}
517
518Inserts the separator into the toolbar at the given position.
519
520You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
521
522\wxheading{See also}
523
524\helpref{AddSeparator}{wxtoolbaraddseparator},\\
525\helpref{InsertTool}{wxtoolbarinserttool}
526
527\membersection{wxToolBar::InsertTool}\label{wxtoolbarinserttool}
a660d684 528
5ef2e633 529\func{wxToolBarTool *}{InsertTool}{\param{size\_t }{pos},\rtfsp
605d715d 530\param{int}{ toolId}, \param{const wxBitmap\&}{ bitmap1},\rtfsp
cc81d32f 531\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp
5ef2e633
VZ
532\param{wxObject* }{clientData = NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
533
dd91da4e
VZ
534\func{wxToolBarTool *}{InsertTool}{\param{size\_t }{pos},\rtfsp
535\param{wxToolBarTool* }{tool}}
536
5ef2e633
VZ
537Inserts the tool with the specified attributes into the toolbar at the given
538position.
a660d684 539
5ef2e633 540You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
81d66cf3
JS
541
542\wxheading{See also}
543
5ef2e633
VZ
544\helpref{AddTool}{wxtoolbaraddtool},\\
545\helpref{InsertControl}{wxtoolbarinsertcontrol},\\
546\helpref{InsertSeparator}{wxtoolbarinsertseparator}
81d66cf3
JS
547
548\membersection{wxToolBar::OnLeftClick}\label{wxtoolbaronleftclick}
a660d684 549
5ef2e633 550\func{bool}{OnLeftClick}{\param{int}{ toolId}, \param{bool}{ toggleDown}}
a660d684 551
81d66cf3
JS
552Called when the user clicks on a tool with the left mouse button.
553
554This is the old way of detecting tool clicks; although it will still work,
555you should use the EVT\_MENU or EVT\_TOOL macro instead.
a660d684
KB
556
557\wxheading{Parameters}
558
5ef2e633 559\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684 560
cc81d32f 561\docparam{toggleDown}{true if the tool is a toggle and the toggle is down, otherwise is false.}
a660d684
KB
562
563\wxheading{Return value}
564
cc81d32f 565If the tool is a toggle and this function returns false, the toggle
a660d684
KB
566toggle state (internal and visual) will not be changed. This provides a way of
567specifying that toggle operations are not permitted in some circumstances.
568
569\wxheading{See also}
570
81d66cf3
JS
571\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
572\helpref{wxToolBar::OnRightClick}{wxtoolbaronrightclick}
a660d684 573
81d66cf3 574\membersection{wxToolBar::OnMouseEnter}\label{wxtoolbaronmouseenter}
a660d684 575
5ef2e633 576\func{void}{OnMouseEnter}{\param{int}{ toolId}}
a660d684
KB
577
578This is called when the mouse cursor moves into a tool or out of
579the toolbar.
580
81d66cf3
JS
581This is the old way of detecting mouse enter events; although it will still work,
582you should use the EVT\_TOOL\_ENTER macro instead.
583
a660d684
KB
584\wxheading{Parameters}
585
5ef2e633 586\docparam{toolId}{Greater than -1 if the mouse cursor has moved into the tool,
a660d684
KB
587or -1 if the mouse cursor has moved. The
588programmer can override this to provide extra information about the tool,
589such as a short description on the status line.}
590
591\wxheading{Remarks}
592
593With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWindows may not be able to
594detect it. Therefore this function may not always be called when expected.
595
81d66cf3 596\membersection{wxToolBar::OnRightClick}\label{wxtoolbaronrightclick}
a660d684 597
5ef2e633 598\func{void}{OnRightClick}{\param{int}{ toolId}, \param{float}{ x}, \param{float}{ y}}
a660d684
KB
599
600Called when the user clicks on a tool with the right mouse button. The
601programmer should override this function to detect right tool clicks.
602
81d66cf3
JS
603This is the old way of detecting tool right clicks; although it will still work,
604you should use the EVT\_TOOL\_RCLICKED macro instead.
605
a660d684
KB
606\wxheading{Parameters}
607
5ef2e633 608\docparam{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
a660d684
KB
609
610\docparam{x}{The x position of the mouse cursor.}
611
612\docparam{y}{The y position of the mouse cursor.}
613
614\wxheading{Remarks}
615
616A typical use of this member might be to pop up a menu.
617
618\wxheading{See also}
619
81d66cf3
JS
620\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
621\helpref{wxToolBar::OnLeftClick}{wxtoolbaronleftclick}
622
623\membersection{wxToolBar::Realize}\label{wxtoolbarrealize}
624
625\func{bool}{Realize}{\void}
626
e12be2f7 627This function should be called after you have added tools.
81d66cf3
JS
628
629If you are using absolute positions for your tools when using a wxToolBarSimple object,
630do not call this function. You must call it at all other times.
a660d684 631
5ef2e633
VZ
632\membersection{wxToolBar::RemoveTool}\label{wxtoolbarremovetool}
633
634\func{wxToolBarTool *}{RemoveTool}{\param{int }{id}}
635
636Removes the given tool from the toolbar but doesn't delete it. This allows to
637insert/add this tool back to this (or another) toolbar later.
638
639Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for the
640change to take place, it will happen immediately.
641
642\wxheading{See also}
643
644\helpref{DeleteTool}{wxtoolbardeletetool}
645
6fd5fa4f
VZ
646\membersection{wxToolBar::SetMargins}\label{wxtoolbarsetmargins}
647
648\func{void}{SetMargins}{\param{const wxSize\&}{ size}}
649
650\func{void}{SetMargins}{\param{int}{ x}, \param{int}{ y}}
651
652Set the values to be used as margins for the toolbar.
653
654\wxheading{Parameters}
655
656\docparam{size}{Margin size.}
657
658\docparam{x}{Left margin, right margin and inter-tool separation value.}
659
660\docparam{y}{Top margin, bottom margin and inter-tool separation value.}
661
662\wxheading{Remarks}
663
664This must be called before the tools are added if absolute positioning is to be used, and the
665default (zero-size) margins are to be overridden.
666
667\wxheading{See also}
668
669\helpref{wxToolBar::GetMargins}{wxtoolbargetmargins}, \helpref{wxSize}{wxsize}
670
81d66cf3 671\membersection{wxToolBar::SetToolBitmapSize}\label{wxtoolbarsettoolbitmapsize}
a660d684 672
81d66cf3 673\func{void}{SetToolBitmapSize}{\param{const wxSize\&}{ size}}
a660d684
KB
674
675Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.
676
677\wxheading{Parameters}
678
679\docparam{size}{The size of the bitmaps in the toolbar.}
680
681\wxheading{Remarks}
682
683This should be called to tell the toolbar what the tool bitmap size is. Call
684it before you add tools.
685
81d66cf3 686Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
a660d684
KB
687and not the eventual size of the tool button.
688
689\wxheading{See also}
690
81d66cf3
JS
691\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize},\rtfsp
692\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
a660d684 693
6fd5fa4f 694\membersection{wxToolBar::SetToolClientData}\label{wxtoolbarsettoolclientdata}
a660d684 695
7899ef95 696\func{void}{SetToolClientData}{\param{int }{id}, \param{wxObject* }{clientData}}
a660d684 697
6fd5fa4f 698Sets the client data associated with the tool.
a660d684 699
81d66cf3 700\membersection{wxToolBar::SetToolLongHelp}\label{wxtoolbarsettoollonghelp}
a660d684 701
5ef2e633 702\func{void}{SetToolLongHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
703
704Sets the long help for the given tool.
705
706\wxheading{Parameters}
707
5ef2e633 708\docparam{toolId}{The tool in question.}
a660d684
KB
709
710\docparam{helpString}{A string for the long help.}
711
712\wxheading{Remarks}
713
714You might use the long help for displaying the tool purpose on the status line.
715
716\wxheading{See also}
717
81d66cf3
JS
718\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
719\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp},\rtfsp
a660d684 720
81d66cf3 721\membersection{wxToolBar::SetToolPacking}\label{wxtoolbarsettoolpacking}
a660d684 722
eaaa6a06 723\func{void}{SetToolPacking}{\param{int}{ packing}}
a660d684
KB
724
725Sets the value used for spacing tools. The default value is 1.
726
727\wxheading{Parameters}
728
729\docparam{packing}{The value for packing.}
730
731\wxheading{Remarks}
732
733The packing is used for spacing in the vertical direction if the toolbar is horizontal,
734and for spacing in the horizontal direction if the toolbar is vertical.
735
736\wxheading{See also}
737
81d66cf3 738\helpref{wxToolBar::GetToolPacking}{wxtoolbargettoolpacking}
a660d684 739
81d66cf3 740\membersection{wxToolBar::SetToolShortHelp}\label{wxtoolbarsettoolshorthelp}
a660d684 741
5ef2e633 742\func{void}{SetToolShortHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}
a660d684
KB
743
744Sets the short help for the given tool.
745
746\wxheading{Parameters}
747
5ef2e633 748\docparam{toolId}{The tool in question.}
a660d684
KB
749
750\docparam{helpString}{The string for the short help.}
751
752\wxheading{Remarks}
753
754An application might use short help for identifying the tool purpose in a tooltip.
755
756\wxheading{See also}
757
81d66cf3 758\helpref{wxToolBar::GetToolShortHelp}{wxtoolbargettoolshorthelp}, \helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp}
a660d684 759
81d66cf3 760\membersection{wxToolBar::SetToolSeparation}\label{wxtoolbarsettoolseparation}
a660d684 761
eaaa6a06 762\func{void}{SetToolSeparation}{\param{int}{ separation}}
a660d684
KB
763
764Sets the default separator size. The default value is 5.
765
766\wxheading{Parameters}
767
768\docparam{separation}{The separator size.}
769
770\wxheading{See also}
771
81d66cf3 772\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}
a660d684 773
81d66cf3 774\membersection{wxToolBar::ToggleTool}\label{wxtoolbartoggletool}
a660d684 775
5ef2e633 776\func{void}{ToggleTool}{\param{int }{toolId}, \param{const bool}{ toggle}}
a660d684 777
41bf0eb3 778Toggles a tool on or off. This does not cause any event to get emitted.
a660d684
KB
779
780\wxheading{Parameters}
781
5ef2e633 782\docparam{toolId}{Tool in question.}
a660d684 783
cc81d32f 784\docparam{toggle}{If true, toggles the tool on, otherwise toggles it off.}
a660d684
KB
785
786\wxheading{Remarks}
787
788Only applies to a tool that has been specified as a toggle tool.
789
790\wxheading{See also}
791
81d66cf3 792\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}