]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: toolbar.h | |
e54c96f1 | 3 | // Purpose: interface of wxToolBar |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxToolBar | |
11 | @wxheader{toolbar.h} | |
7c913512 | 12 | |
23324ae1 | 13 | The name wxToolBar is defined to be a synonym for one of the following classes: |
7c913512 | 14 | |
23324ae1 FM |
15 | @b wxToolBar95 The native Windows 95 toolbar. Used on Windows 95, NT 4 and |
16 | above. | |
17 | @b wxToolBarMSW A Windows implementation. Used on 16-bit Windows. | |
18 | @b wxToolBarGTK The GTK toolbar. | |
7c913512 FM |
19 | |
20 | ||
23324ae1 | 21 | @beginStyleTable |
8c6791e4 | 22 | @style{wxTB_FLAT} |
23324ae1 | 23 | Gives the toolbar a flat look (Windows and GTK only). |
8c6791e4 | 24 | @style{wxTB_DOCKABLE} |
23324ae1 | 25 | Makes the toolbar floatable and dockable (GTK only). |
8c6791e4 | 26 | @style{wxTB_HORIZONTAL} |
23324ae1 | 27 | Specifies horizontal layout (default). |
8c6791e4 | 28 | @style{wxTB_VERTICAL} |
23324ae1 | 29 | Specifies vertical layout. |
8c6791e4 | 30 | @style{wxTB_TEXT} |
23324ae1 FM |
31 | Shows the text in the toolbar buttons; by default only icons are |
32 | shown. | |
8c6791e4 | 33 | @style{wxTB_NOICONS} |
23324ae1 FM |
34 | Specifies no icons in the toolbar buttons; by default they are |
35 | shown. | |
8c6791e4 | 36 | @style{wxTB_NODIVIDER} |
23324ae1 | 37 | Specifies no divider (border) above the toolbar (Windows only). |
8c6791e4 | 38 | @style{wxTB_NOALIGN} |
23324ae1 FM |
39 | Specifies no alignment with the parent window (Windows only, not |
40 | very useful). | |
8c6791e4 | 41 | @style{wxTB_HORZ_LAYOUT} |
23324ae1 FM |
42 | Shows the text and the icons alongside, not vertically stacked |
43 | (Windows and GTK 2 only). This style must be used with wxTB_TEXT. | |
8c6791e4 | 44 | @style{wxTB_HORZ_TEXT} |
23324ae1 | 45 | Combination of wxTB_HORZ_LAYOUT and wxTB_TEXT. |
8c6791e4 | 46 | @style{wxTB_NO_TOOLTIPS} |
23324ae1 FM |
47 | Don't show the short help tooltips for the tools when the mouse |
48 | hovers over them. | |
8c6791e4 | 49 | @style{wxTB_BOTTOM} |
23324ae1 | 50 | Align the toolbar at the bottom of parent window. |
8c6791e4 | 51 | @style{wxTB_RIGHT} |
23324ae1 FM |
52 | Align the toolbar at the right side of parent window. |
53 | @endStyleTable | |
7c913512 | 54 | |
23324ae1 FM |
55 | @library{wxbase} |
56 | @category{miscwnd} | |
7c913512 | 57 | |
f09b5681 | 58 | @see @ref overview_toolbar |
23324ae1 FM |
59 | */ |
60 | class wxToolBar : public wxControl | |
61 | { | |
62 | public: | |
63 | //@{ | |
64 | /** | |
65 | Constructs a toolbar. | |
3c4f71cc | 66 | |
7c913512 | 67 | @param parent |
4cc4bfaf | 68 | Pointer to a parent window. |
7c913512 | 69 | @param id |
4cc4bfaf | 70 | Window identifier. If -1, will automatically create an identifier. |
7c913512 | 71 | @param pos |
4cc4bfaf FM |
72 | Window position. wxDefaultPosition is (-1, -1) which indicates that |
73 | wxWidgets | |
74 | should generate a default position for the window. If using the wxWindow | |
75 | class directly, supply | |
76 | an actual position. | |
7c913512 | 77 | @param size |
4cc4bfaf FM |
78 | Window size. wxDefaultSize is (-1, -1) which indicates that wxWidgets |
79 | should generate a default size for the window. | |
7c913512 | 80 | @param style |
4cc4bfaf | 81 | Window style. See wxToolBar for details. |
7c913512 | 82 | @param name |
4cc4bfaf | 83 | Window name. |
3c4f71cc | 84 | |
23324ae1 | 85 | @remarks After a toolbar is created, you use AddTool() and |
4cc4bfaf FM |
86 | perhaps AddSeparator(), and then you must call |
87 | Realize() to construct and display the toolbar | |
88 | tools. | |
23324ae1 FM |
89 | */ |
90 | wxToolBar(); | |
7c913512 FM |
91 | wxToolBar(wxWindow* parent, wxWindowID id, |
92 | const wxPoint& pos = wxDefaultPosition, | |
93 | const wxSize& size = wxDefaultSize, | |
4cc4bfaf | 94 | long style = wxTB_HORIZONTAL | wxBORDER_NONE, |
7c913512 | 95 | const wxString& name = wxPanelNameStr); |
23324ae1 FM |
96 | //@} |
97 | ||
98 | /** | |
99 | Toolbar destructor. | |
100 | */ | |
101 | ~wxToolBar(); | |
102 | ||
103 | /** | |
104 | Adds a new check (or toggle) tool to the toolbar. The parameters are the same | |
105 | as in AddTool(). | |
3c4f71cc | 106 | |
4cc4bfaf | 107 | @see AddTool() |
23324ae1 FM |
108 | */ |
109 | wxToolBarToolBase* AddCheckTool(int toolId, | |
110 | const wxString& label, | |
111 | const wxBitmap& bitmap1, | |
112 | const wxBitmap& bitmap2, | |
113 | const wxString& shortHelpString = "", | |
114 | const wxString& longHelpString = "", | |
4cc4bfaf | 115 | wxObject* clientData = NULL); |
23324ae1 FM |
116 | |
117 | /** | |
118 | Adds any control to the toolbar, typically e.g. a combobox. | |
3c4f71cc | 119 | |
7c913512 | 120 | @param control |
4cc4bfaf | 121 | The control to be added. |
7c913512 | 122 | @param label |
4cc4bfaf | 123 | Text to be displayed near the control. |
3c4f71cc | 124 | |
23324ae1 | 125 | @remarks wxMSW: the label is only displayed if there is enough space |
4cc4bfaf | 126 | available below the embedded control. |
23324ae1 FM |
127 | */ |
128 | bool AddControl(wxControl* control, const wxString label = ""); | |
129 | ||
130 | /** | |
131 | Adds a new radio tool to the toolbar. Consecutive radio tools form a radio | |
132 | group such that exactly one button in the group is pressed at any moment, in | |
133 | other words whenever a button in the group is pressed the previously pressed | |
134 | button is automatically released. You should avoid having the radio groups of | |
135 | only one element as it would be impossible for the user to use such button. | |
23324ae1 FM |
136 | By default, the first button in the radio group is initially pressed, the |
137 | others are not. | |
3c4f71cc | 138 | |
4cc4bfaf | 139 | @see AddTool() |
23324ae1 FM |
140 | */ |
141 | wxToolBarToolBase* AddRadioTool(int toolId, | |
142 | const wxString& label, | |
143 | const wxBitmap& bitmap1, | |
144 | const wxBitmap& bitmap2, | |
145 | const wxString& shortHelpString = "", | |
146 | const wxString& longHelpString = "", | |
4cc4bfaf | 147 | wxObject* clientData = NULL); |
23324ae1 FM |
148 | |
149 | /** | |
150 | Adds a separator for spacing groups of tools. | |
3c4f71cc | 151 | |
4cc4bfaf | 152 | @see AddTool(), SetToolSeparation() |
23324ae1 FM |
153 | */ |
154 | void AddSeparator(); | |
155 | ||
156 | //@{ | |
157 | /** | |
158 | Adds a tool to the toolbar. The first (short and most commonly used) version | |
159 | has fewer parameters than the full version at the price of not being able to | |
160 | specify some of the more rarely used button features. The last version allows | |
161 | you to add an existing tool. | |
3c4f71cc | 162 | |
7c913512 | 163 | @param toolId |
4cc4bfaf FM |
164 | An integer by which |
165 | the tool may be identified in subsequent operations. | |
7c913512 | 166 | @param kind |
4cc4bfaf FM |
167 | May be wxITEM_NORMAL for a normal button (default), |
168 | wxITEM_CHECK for a checkable tool (such tool stays pressed after it had been | |
169 | toggled) or wxITEM_RADIO for a checkable tool which makes part of a radio | |
170 | group of tools each of which is automatically unchecked whenever another | |
171 | button | |
172 | in the group is checked | |
7c913512 | 173 | @param bitmap1 |
4cc4bfaf | 174 | The primary tool bitmap. |
7c913512 | 175 | @param bitmap2 |
4cc4bfaf FM |
176 | The bitmap used when the tool is disabled. If it is equal to |
177 | wxNullBitmap, the disabled bitmap is automatically generated by greing the | |
178 | normal one. | |
7c913512 | 179 | @param shortHelpString |
4cc4bfaf | 180 | This string is used for the tools tooltip |
7c913512 | 181 | @param longHelpString |
4cc4bfaf FM |
182 | This string is shown in the statusbar (if any) of the |
183 | parent frame when the mouse pointer is inside the tool | |
7c913512 | 184 | @param clientData |
4cc4bfaf FM |
185 | An optional pointer to client data which can be |
186 | retrieved later using GetToolClientData(). | |
7c913512 | 187 | @param tool |
4cc4bfaf | 188 | The tool to be added. |
3c4f71cc | 189 | |
23324ae1 | 190 | @remarks After you have added tools to a toolbar, you must call |
4cc4bfaf | 191 | Realize() in order to have the tools appear. |
3c4f71cc | 192 | |
4cc4bfaf FM |
193 | @see AddSeparator(), AddCheckTool(), AddRadioTool(), |
194 | InsertTool(), DeleteTool(), Realize() | |
23324ae1 FM |
195 | */ |
196 | wxToolBarToolBase* AddTool(int toolId, const wxString& label, | |
197 | const wxBitmap& bitmap1, | |
198 | const wxString& shortHelpString = "", | |
199 | wxItemKind kind = wxITEM_NORMAL); | |
7c913512 FM |
200 | wxToolBarToolBase* AddTool(int toolId, const wxString& label, |
201 | const wxBitmap& bitmap1, | |
202 | const wxBitmap& bitmap2 = wxNullBitmap, | |
203 | wxItemKind kind = wxITEM_NORMAL, | |
204 | const wxString& shortHelpString = "", | |
205 | const wxString& longHelpString = "", | |
4cc4bfaf | 206 | wxObject* clientData = NULL); |
7c913512 | 207 | wxToolBarToolBase* AddTool(wxToolBarToolBase* tool); |
23324ae1 FM |
208 | //@} |
209 | ||
210 | /** | |
211 | Deletes all the tools in the toolbar. | |
212 | */ | |
213 | void ClearTools(); | |
214 | ||
215 | /** | |
216 | Removes the specified tool from the toolbar and deletes it. If you don't want | |
217 | to delete the tool, but just to remove it from the toolbar (to possibly add it | |
218 | back later), you may use RemoveTool() instead. | |
23324ae1 FM |
219 | Note that it is unnecessary to call Realize() for the |
220 | change to take place, it will happen immediately. | |
23324ae1 | 221 | Returns @true if the tool was deleted, @false otherwise. |
3c4f71cc | 222 | |
4cc4bfaf | 223 | @see DeleteToolByPos() |
23324ae1 FM |
224 | */ |
225 | bool DeleteTool(int toolId); | |
226 | ||
227 | /** | |
228 | This function behaves like DeleteTool() but it | |
229 | deletes the tool at the specified position and not the one with the given id. | |
230 | */ | |
231 | bool DeleteToolByPos(size_t pos); | |
232 | ||
233 | /** | |
234 | Enables or disables the tool. | |
3c4f71cc | 235 | |
7c913512 | 236 | @param toolId |
4cc4bfaf | 237 | Tool to enable or disable. |
7c913512 | 238 | @param enable |
4cc4bfaf | 239 | If @true, enables the tool, otherwise disables it. |
3c4f71cc | 240 | |
23324ae1 | 241 | @remarks Some implementations will change the visible state of the tool |
4cc4bfaf | 242 | to indicate that it is disabled. |
3c4f71cc | 243 | |
4cc4bfaf | 244 | @see GetToolEnabled(), ToggleTool() |
23324ae1 FM |
245 | */ |
246 | void EnableTool(int toolId, bool enable); | |
247 | ||
248 | /** | |
4cc4bfaf | 249 | Returns a pointer to the tool identified by @a id or |
23324ae1 FM |
250 | @NULL if no corresponding tool is found. |
251 | */ | |
252 | wxToolBarToolBase* FindById(int id); | |
253 | ||
254 | /** | |
4cc4bfaf | 255 | Returns a pointer to the control identified by @a id or |
23324ae1 FM |
256 | @NULL if no corresponding control is found. |
257 | */ | |
258 | wxControl* FindControl(int id); | |
259 | ||
260 | /** | |
261 | Finds a tool for the given mouse position. | |
3c4f71cc | 262 | |
7c913512 | 263 | @param x |
4cc4bfaf | 264 | X position. |
7c913512 | 265 | @param y |
4cc4bfaf | 266 | Y position. |
3c4f71cc | 267 | |
d29a9a8a | 268 | @return A pointer to a tool if a tool is found, or @NULL otherwise. |
3c4f71cc | 269 | |
23324ae1 FM |
270 | @remarks Currently not implemented in wxGTK (always returns @NULL there). |
271 | */ | |
328f5751 | 272 | wxToolBarToolBase* FindToolForPosition(wxCoord x, wxCoord y) const; |
23324ae1 FM |
273 | |
274 | /** | |
275 | Returns the left/right and top/bottom margins, which are also used for | |
276 | inter-toolspacing. | |
3c4f71cc | 277 | |
4cc4bfaf | 278 | @see SetMargins() |
23324ae1 | 279 | */ |
328f5751 | 280 | wxSize GetMargins() const; |
23324ae1 FM |
281 | |
282 | /** | |
283 | Returns the size of bitmap that the toolbar expects to have. The default bitmap | |
284 | size is 16 by 15 pixels. | |
3c4f71cc | 285 | |
23324ae1 | 286 | @remarks Note that this is the size of the bitmap you pass to |
4cc4bfaf FM |
287 | AddTool(), and not the eventual size of the |
288 | tool button. | |
3c4f71cc | 289 | |
4cc4bfaf | 290 | @see SetToolBitmapSize(), GetToolSize() |
23324ae1 FM |
291 | */ |
292 | wxSize GetToolBitmapSize(); | |
293 | ||
294 | /** | |
295 | Get any client data associated with the tool. | |
3c4f71cc | 296 | |
7c913512 | 297 | @param toolId |
4cc4bfaf | 298 | Id of the tool, as passed to AddTool(). |
3c4f71cc | 299 | |
d29a9a8a | 300 | @return Client data, or @NULL if there is none. |
23324ae1 | 301 | */ |
328f5751 | 302 | wxObject* GetToolClientData(int toolId) const; |
23324ae1 FM |
303 | |
304 | /** | |
305 | Called to determine whether a tool is enabled (responds to user input). | |
3c4f71cc | 306 | |
7c913512 | 307 | @param toolId |
4cc4bfaf | 308 | Id of the tool in question. |
3c4f71cc | 309 | |
d29a9a8a | 310 | @return @true if the tool is enabled, @false otherwise. |
3c4f71cc | 311 | |
4cc4bfaf | 312 | @see EnableTool() |
23324ae1 | 313 | */ |
328f5751 | 314 | bool GetToolEnabled(int toolId) const; |
23324ae1 FM |
315 | |
316 | /** | |
317 | Returns the long help for the given tool. | |
3c4f71cc | 318 | |
7c913512 | 319 | @param toolId |
4cc4bfaf | 320 | The tool in question. |
3c4f71cc | 321 | |
4cc4bfaf | 322 | @see SetToolLongHelp(), SetToolShortHelp() |
23324ae1 | 323 | */ |
328f5751 | 324 | wxString GetToolLongHelp(int toolId) const; |
23324ae1 FM |
325 | |
326 | /** | |
327 | Returns the value used for packing tools. | |
3c4f71cc | 328 | |
4cc4bfaf | 329 | @see SetToolPacking() |
23324ae1 | 330 | */ |
328f5751 | 331 | int GetToolPacking() const; |
23324ae1 FM |
332 | |
333 | /** | |
334 | Returns the tool position in the toolbar, or @c wxNOT_FOUND if the tool is not | |
335 | found. | |
336 | */ | |
328f5751 | 337 | int GetToolPos(int toolId) const; |
23324ae1 FM |
338 | |
339 | /** | |
340 | Returns the default separator size. | |
3c4f71cc | 341 | |
4cc4bfaf | 342 | @see SetToolSeparation() |
23324ae1 | 343 | */ |
328f5751 | 344 | int GetToolSeparation() const; |
23324ae1 FM |
345 | |
346 | /** | |
347 | Returns the short help for the given tool. | |
3c4f71cc | 348 | |
7c913512 | 349 | @param toolId |
4cc4bfaf | 350 | The tool in question. |
3c4f71cc | 351 | |
4cc4bfaf | 352 | @see GetToolLongHelp(), SetToolShortHelp() |
23324ae1 | 353 | */ |
328f5751 | 354 | wxString GetToolShortHelp(int toolId) const; |
23324ae1 FM |
355 | |
356 | /** | |
357 | Returns the size of a whole button, which is usually larger than a tool bitmap | |
358 | because | |
359 | of added 3D effects. | |
3c4f71cc | 360 | |
4cc4bfaf | 361 | @see SetToolBitmapSize(), GetToolBitmapSize() |
23324ae1 FM |
362 | */ |
363 | wxSize GetToolSize(); | |
364 | ||
365 | /** | |
366 | Gets the on/off state of a toggle tool. | |
3c4f71cc | 367 | |
7c913512 | 368 | @param toolId |
4cc4bfaf | 369 | The tool in question. |
3c4f71cc | 370 | |
d29a9a8a | 371 | @return @true if the tool is toggled on, @false otherwise. |
3c4f71cc | 372 | |
4cc4bfaf | 373 | @see ToggleTool() |
23324ae1 | 374 | */ |
328f5751 | 375 | bool GetToolState(int toolId) const; |
23324ae1 FM |
376 | |
377 | /** | |
378 | Returns the number of tools in the toolbar. | |
379 | */ | |
328f5751 | 380 | int GetToolsCount() const; |
23324ae1 FM |
381 | |
382 | /** | |
383 | Inserts the control into the toolbar at the given position. | |
23324ae1 | 384 | You must call Realize() for the change to take place. |
3c4f71cc | 385 | |
4cc4bfaf | 386 | @see AddControl(), InsertTool() |
23324ae1 | 387 | */ |
4cc4bfaf | 388 | wxToolBarToolBase* InsertControl(size_t pos, wxControl* control); |
23324ae1 FM |
389 | |
390 | /** | |
391 | Inserts the separator into the toolbar at the given position. | |
23324ae1 | 392 | You must call Realize() for the change to take place. |
3c4f71cc | 393 | |
4cc4bfaf | 394 | @see AddSeparator(), InsertTool() |
23324ae1 | 395 | */ |
4cc4bfaf | 396 | wxToolBarToolBase* InsertSeparator(size_t pos); |
23324ae1 FM |
397 | |
398 | //@{ | |
399 | /** | |
400 | Inserts the tool with the specified attributes into the toolbar at the given | |
401 | position. | |
23324ae1 | 402 | You must call Realize() for the change to take place. |
3c4f71cc | 403 | |
4cc4bfaf FM |
404 | @see AddTool(), InsertControl(), InsertSeparator() |
405 | */ | |
406 | wxToolBarToolBase* InsertTool(size_t pos, int toolId, | |
407 | const wxBitmap& bitmap1, | |
408 | const wxBitmap& bitmap2 = wxNullBitmap, | |
409 | bool isToggle = false, | |
410 | wxObject* clientData = NULL, | |
411 | const wxString& shortHelpString = "", | |
412 | const wxString& longHelpString = ""); | |
413 | wxToolBarToolBase* InsertTool(size_t pos, | |
414 | wxToolBarToolBase* tool); | |
23324ae1 FM |
415 | //@} |
416 | ||
417 | /** | |
418 | Called when the user clicks on a tool with the left mouse button. | |
23324ae1 FM |
419 | This is the old way of detecting tool clicks; although it will still work, |
420 | you should use the EVT_MENU or EVT_TOOL macro instead. | |
3c4f71cc | 421 | |
7c913512 | 422 | @param toolId |
4cc4bfaf | 423 | The identifier passed to AddTool(). |
7c913512 | 424 | @param toggleDown |
4cc4bfaf | 425 | @true if the tool is a toggle and the toggle is down, otherwise is @false. |
3c4f71cc | 426 | |
d29a9a8a | 427 | @return If the tool is a toggle and this function returns @false, the |
4cc4bfaf FM |
428 | toggle toggle state (internal and visual) will not be |
429 | changed. This provides a way of specifying that toggle | |
430 | operations are not permitted in some circumstances. | |
3c4f71cc | 431 | |
4cc4bfaf | 432 | @see OnMouseEnter(), OnRightClick() |
23324ae1 FM |
433 | */ |
434 | bool OnLeftClick(int toolId, bool toggleDown); | |
435 | ||
436 | /** | |
437 | This is called when the mouse cursor moves into a tool or out of | |
438 | the toolbar. | |
23324ae1 FM |
439 | This is the old way of detecting mouse enter events; although it will still |
440 | work, | |
441 | you should use the EVT_TOOL_ENTER macro instead. | |
3c4f71cc | 442 | |
7c913512 | 443 | @param toolId |
4cc4bfaf FM |
444 | Greater than -1 if the mouse cursor has moved into the tool, |
445 | or -1 if the mouse cursor has moved. The | |
446 | programmer can override this to provide extra information about the tool, | |
447 | such as a short description on the status line. | |
3c4f71cc | 448 | |
23324ae1 | 449 | @remarks With some derived toolbar classes, if the mouse moves quickly |
4cc4bfaf FM |
450 | out of the toolbar, wxWidgets may not be able to detect |
451 | it. Therefore this function may not always be called | |
452 | when expected. | |
23324ae1 FM |
453 | */ |
454 | void OnMouseEnter(int toolId); | |
455 | ||
456 | /** | |
457 | Called when the user clicks on a tool with the right mouse button. The | |
458 | programmer should override this function to detect right tool clicks. | |
23324ae1 FM |
459 | This is the old way of detecting tool right clicks; although it will still work, |
460 | you should use the EVT_TOOL_RCLICKED macro instead. | |
3c4f71cc | 461 | |
7c913512 | 462 | @param toolId |
4cc4bfaf | 463 | The identifier passed to AddTool(). |
7c913512 | 464 | @param x |
4cc4bfaf | 465 | The x position of the mouse cursor. |
7c913512 | 466 | @param y |
4cc4bfaf | 467 | The y position of the mouse cursor. |
3c4f71cc | 468 | |
23324ae1 | 469 | @remarks A typical use of this member might be to pop up a menu. |
3c4f71cc | 470 | |
4cc4bfaf | 471 | @see OnMouseEnter(), OnLeftClick() |
23324ae1 FM |
472 | */ |
473 | void OnRightClick(int toolId, float x, float y); | |
474 | ||
475 | /** | |
476 | This function should be called after you have added tools. | |
477 | */ | |
478 | bool Realize(); | |
479 | ||
480 | /** | |
481 | Removes the given tool from the toolbar but doesn't delete it. This allows to | |
482 | insert/add this tool back to this (or another) toolbar later. | |
23324ae1 FM |
483 | Note that it is unnecessary to call Realize() for the |
484 | change to take place, it will happen immediately. | |
3c4f71cc | 485 | |
4cc4bfaf | 486 | @see DeleteTool() |
23324ae1 | 487 | */ |
4cc4bfaf | 488 | wxToolBarToolBase* RemoveTool(int id); |
23324ae1 FM |
489 | |
490 | /** | |
491 | Sets the bitmap resource identifier for specifying tool bitmaps as indices | |
492 | into a custom bitmap. Windows CE only. | |
493 | */ | |
494 | void SetBitmapResource(int resourceId); | |
495 | ||
496 | /** | |
497 | Sets the dropdown menu for the tool given by its @e id. The tool itself will | |
498 | delete the menu when it's no longer needed. | |
7c913512 | 499 | If you define a EVT_TOOL_DROPDOWN handler in your program, you must call |
23324ae1 FM |
500 | wxEvent::Skip from it or the menu won't be displayed. |
501 | */ | |
502 | bool SetDropdownMenu(int id, wxMenu* menu); | |
503 | ||
504 | //@{ | |
505 | /** | |
506 | Set the values to be used as margins for the toolbar. | |
3c4f71cc | 507 | |
7c913512 | 508 | @param size |
4cc4bfaf | 509 | Margin size. |
7c913512 | 510 | @param x |
4cc4bfaf | 511 | Left margin, right margin and inter-tool separation value. |
7c913512 | 512 | @param y |
4cc4bfaf | 513 | Top margin, bottom margin and inter-tool separation value. |
3c4f71cc | 514 | |
23324ae1 | 515 | @remarks This must be called before the tools are added if absolute |
4cc4bfaf FM |
516 | positioning is to be used, and the default (zero-size) |
517 | margins are to be overridden. | |
3c4f71cc | 518 | |
4cc4bfaf | 519 | @see GetMargins(), wxSize |
23324ae1 FM |
520 | */ |
521 | void SetMargins(const wxSize& size); | |
7c913512 | 522 | void SetMargins(int x, int y); |
23324ae1 FM |
523 | //@} |
524 | ||
525 | /** | |
526 | Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 | |
527 | pixels. | |
3c4f71cc | 528 | |
7c913512 | 529 | @param size |
4cc4bfaf | 530 | The size of the bitmaps in the toolbar. |
3c4f71cc | 531 | |
23324ae1 | 532 | @remarks This should be called to tell the toolbar what the tool bitmap |
4cc4bfaf | 533 | size is. Call it before you add tools. |
3c4f71cc | 534 | |
4cc4bfaf | 535 | @see GetToolBitmapSize(), GetToolSize() |
23324ae1 FM |
536 | */ |
537 | void SetToolBitmapSize(const wxSize& size); | |
538 | ||
539 | /** | |
540 | Sets the client data associated with the tool. | |
541 | */ | |
542 | void SetToolClientData(int id, wxObject* clientData); | |
543 | ||
544 | /** | |
545 | Sets the bitmap to be used by the tool with the given ID when the tool | |
546 | is in a disabled state. This can only be used on Button tools, not | |
547 | controls. NOTE: The native toolbar classes on the main platforms all | |
548 | synthesize the disabled bitmap from the normal bitmap, so this | |
549 | function will have no effect on those platforms. | |
550 | */ | |
551 | void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); | |
552 | ||
553 | /** | |
554 | Sets the long help for the given tool. | |
3c4f71cc | 555 | |
7c913512 | 556 | @param toolId |
4cc4bfaf | 557 | The tool in question. |
7c913512 | 558 | @param helpString |
4cc4bfaf | 559 | A string for the long help. |
3c4f71cc | 560 | |
23324ae1 | 561 | @remarks You might use the long help for displaying the tool purpose on |
4cc4bfaf | 562 | the status line. |
3c4f71cc | 563 | |
4cc4bfaf | 564 | @see GetToolLongHelp(), SetToolShortHelp(), |
23324ae1 FM |
565 | */ |
566 | void SetToolLongHelp(int toolId, const wxString& helpString); | |
567 | ||
568 | /** | |
569 | Sets the bitmap to be used by the tool with the given ID. This can | |
570 | only be used on Button tools, not controls. | |
571 | */ | |
572 | void SetToolNormalBitmap(int id, const wxBitmap& bitmap); | |
573 | ||
574 | /** | |
575 | Sets the value used for spacing tools. The default value is 1. | |
3c4f71cc | 576 | |
7c913512 | 577 | @param packing |
4cc4bfaf | 578 | The value for packing. |
3c4f71cc | 579 | |
23324ae1 | 580 | @remarks The packing is used for spacing in the vertical direction if the |
4cc4bfaf FM |
581 | toolbar is horizontal, and for spacing in the |
582 | horizontal direction if the toolbar is vertical. | |
3c4f71cc | 583 | |
4cc4bfaf | 584 | @see GetToolPacking() |
23324ae1 FM |
585 | */ |
586 | void SetToolPacking(int packing); | |
587 | ||
588 | /** | |
589 | Sets the default separator size. The default value is 5. | |
3c4f71cc | 590 | |
7c913512 | 591 | @param separation |
4cc4bfaf | 592 | The separator size. |
3c4f71cc | 593 | |
4cc4bfaf | 594 | @see AddSeparator() |
23324ae1 FM |
595 | */ |
596 | void SetToolSeparation(int separation); | |
597 | ||
598 | /** | |
599 | Sets the short help for the given tool. | |
3c4f71cc | 600 | |
7c913512 | 601 | @param toolId |
4cc4bfaf | 602 | The tool in question. |
7c913512 | 603 | @param helpString |
4cc4bfaf | 604 | The string for the short help. |
3c4f71cc | 605 | |
23324ae1 | 606 | @remarks An application might use short help for identifying the tool |
4cc4bfaf | 607 | purpose in a tooltip. |
3c4f71cc | 608 | |
4cc4bfaf | 609 | @see GetToolShortHelp(), SetToolLongHelp() |
23324ae1 FM |
610 | */ |
611 | void SetToolShortHelp(int toolId, const wxString& helpString); | |
612 | ||
613 | /** | |
614 | Toggles a tool on or off. This does not cause any event to get emitted. | |
3c4f71cc | 615 | |
7c913512 | 616 | @param toolId |
4cc4bfaf | 617 | Tool in question. |
7c913512 | 618 | @param toggle |
4cc4bfaf | 619 | If @true, toggles the tool on, otherwise toggles it off. |
3c4f71cc | 620 | |
23324ae1 FM |
621 | @remarks Only applies to a tool that has been specified as a toggle tool. |
622 | */ | |
623 | void ToggleTool(int toolId, bool toggle); | |
624 | }; | |
e54c96f1 | 625 |