1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
|
<HTML>
<head><title>wxToolBar</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxtoolbar"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx248.htm#wxtimer"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx250.htm#wxtreectrl"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxToolBar</H2>
<P>
The name wxToolBar is defined to be a synonym for one of the following classes:<P>
<UL>
<LI> <B>wxToolBar95</B> The native Windows 95 toolbar. Used on Windows 95, NT 4 and above.
<LI> <B>wxToolBarMSW</B> A Windows implementation. Used on 16-bit Windows.
<LI> <B>wxToolBarGTK</B> The GTK toolbar.
<LI> <B>wxToolBarSimple</B> A simple implementation, with scrolling.
Used on platforms with no native toolbar control, or where scrolling is required.
</UL>
<P>
Note that the base class <B>wxToolBarBase</B> defines
automatic scrolling management functionality which is identical
to <A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A>, so please refer to this class also.
Not all toolbars support scrolling, but wxToolBarSimple does.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
wxToolBarBase<BR>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>
<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/toolbar.h> (to allow wxWindows to select an appropriate toolbar class)<BR>
<wx/tbarbase.h> (the base class)<BR>
<wx/tbarmsw.h> (the non-Windows 95 Windows toolbar class)<BR>
<wx/tbar95.h> (the Windows 95/98 toolbar class)<BR>
<wx/tbarsmpl.h> (the generic simple toolbar class)<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
You may also create a toolbar that is managed by the frame, by
calling <A HREF="wx104.htm#wxframecreatetoolbar">wxFrame::CreateToolBar</A>.<P>
<B>wxToolBar95:</B> Note that this toolbar paints tools to reflect user-selected colours.
The toolbar orientation must always be <B>wxVERTICAL</B>.<P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxTB_FLAT</B>
</TD>
<TD VALIGN=TOP>
Gives the toolbar a flat look ('coolbar' or 'flatbar' style). Windows 95 only.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTB_HORIZONTAL</B>
</TD>
<TD VALIGN=TOP>
Specifies horizontal layout.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTB_VERTICAL</B>
</TD>
<TD VALIGN=TOP>
Specifies vertical layout (not available for the Windows 95
toolbar).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTB_3DBUTTONS</B>
</TD>
<TD VALIGN=TOP>
Gives wxToolBarSimple a mild 3D look to its buttons.
</TD></TR>
</TABLE>
<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
The toolbar class emits menu commands in the same was that a frame menubar does,
so you can use one EVT_MENU macro for both a menu item and a toolbar button.
The event handler functions take a wxCommandEvent argument. For most event macros,
the identifier of the tool is passed, but for EVT_TOOL_ENTER the toolbar
window is passed and the tool id is retrieved from the wxCommandEvent.
This is because the id may be -1 when the mouse moves off a tool, and -1 is not
allowed as an identifier in the event system.<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_CLICKED event
(a synonym for wxEVT_COMMAND_MENU_SELECTED). Pass the id of the tool.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_MENU(id, func)</B>
</TD>
<TD VALIGN=TOP>
The same as EVT_TOOL.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_CLICKED event
for a range id identifiers. Pass the ids of the tools.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_MENU_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
The same as EVT_TOOL_RANGE.
</TD></TR>
<P>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RCLICKED(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_RCLICKED event.
Pass the id of the tool.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RCLICKED_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_RCLICKED event
for a range of ids. Pass the ids of the tools.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_ENTER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_ENTER event.
Pass 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.
</TD></TR>
</TABLE>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx308.htm#wxtoolbaroverview">Toolbar overview</A>,
<A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxtoolbarconstr">wxToolBar::wxToolBar</A><BR>
<A HREF="#topic983">wxToolBar::~wxToolBar</A><BR>
<A HREF="#wxtoolbaraddseparator">wxToolBar::AddSeparator</A><BR>
<A HREF="#wxtoolbaraddtool">wxToolBar::AddTool</A><BR>
<A HREF="#wxtoolbarcreatetools">wxToolBar::CreateTools</A><BR>
<A HREF="#wxtoolbardrawtool">wxToolBar::DrawTool</A><BR>
<A HREF="#wxtoolbarenabletool">wxToolBar::EnableTool</A><BR>
<A HREF="#wxtoolbarfindtoolforposition">wxToolBar::FindToolForPosition</A><BR>
<A HREF="#wxtoolbargettoolsize">wxToolBar::GetToolSize</A><BR>
<A HREF="#wxtoolbargettoolbitmapsize">wxToolBar::GetToolBitmapSize</A><BR>
<A HREF="#wxtoolbargetmargins">wxToolBar::GetMargins</A><BR>
<A HREF="#wxtoolbargetmaxsize">wxToolBar::GetMaxSize</A><BR>
<A HREF="#wxtoolbargettoolclientdata">wxToolBar::GetToolClientData</A><BR>
<A HREF="#wxtoolbargettoolenabled">wxToolBar::GetToolEnabled</A><BR>
<A HREF="#wxtoolbargettoollonghelp">wxToolBar::GetToolLongHelp</A><BR>
<A HREF="#wxtoolbargettoolpacking">wxToolBar::GetToolPacking</A><BR>
<A HREF="#wxtoolbargettoolseparation">wxToolBar::GetToolSeparation</A><BR>
<A HREF="#wxtoolbargettoolshorthelp">wxToolBar::GetToolShortHelp</A><BR>
<A HREF="#wxtoolbargettoolstate">wxToolBar::GetToolState</A><BR>
<A HREF="#wxtoolbarlayout">wxToolBar::Layout</A><BR>
<A HREF="#wxtoolbaronleftclick">wxToolBar::OnLeftClick</A><BR>
<A HREF="#wxtoolbaronmouseenter">wxToolBar::OnMouseEnter</A><BR>
<A HREF="#wxtoolbaronrightclick">wxToolBar::OnRightClick</A><BR>
<A HREF="#wxtoolbarrealize">wxToolBar::Realize</A><BR>
<A HREF="#wxtoolbarsettoolbitmapsize">wxToolBar::SetToolBitmapSize</A><BR>
<A HREF="#wxtoolbarsetmargins">wxToolBar::SetMargins</A><BR>
<A HREF="#wxtoolbarsettoollonghelp">wxToolBar::SetToolLongHelp</A><BR>
<A HREF="#wxtoolbarsettoolpacking">wxToolBar::SetToolPacking</A><BR>
<A HREF="#wxtoolbarsettoolshorthelp">wxToolBar::SetToolShortHelp</A><BR>
<A HREF="#wxtoolbarsettoolseparation">wxToolBar::SetToolSeparation</A><BR>
<A HREF="#wxtoolbartoggletool">wxToolBar::ToggleTool</A><BR>
<P>
<HR>
<A NAME="wxtoolbarconstr"></A>
<H3>wxToolBar::wxToolBar</H3>
<P>
<B></B> <B>wxToolBar</B>()<P>
Default constructor.<P>
<B></B> <B>wxToolBar</B>(<B>wxWindow*</B><I> parent</I>, <B>wxWindowID </B><I>id</I>,
<B>const wxPoint& </B><I>pos = wxDefaultPosition</I>,
<B>const wxSize& </B><I>size = wxDefaultSize</I>,
<B>long </B><I>style = wxTB_HORIZONTAL | wxNO_BORDER</I>,
<B>const wxString& </B><I>name = wxPanelNameStr</I>)<P>
Constructs a toolbar.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Pointer to a parent window.</UL></UL>
<P>
<I>id</I><UL><UL>
Window identifier. If -1, will automatically create an identifier.</UL></UL>
<P>
<I>pos</I><UL><UL>
Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
should generate a default position for the window. If using the wxWindow class directly, supply
an actual position.</UL></UL>
<P>
<I>size</I><UL><UL>
Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows
should generate a default size for the window.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx249.htm#wxtoolbar">wxToolBar</A> for details.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
After a toolbar is created, you use <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A> and
perhaps <A HREF="wx249.htm#wxtoolbaraddseparator">wxToolBar::AddSeparator</A>, and then you
must call <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A> to construct and display the toolbar
tools.<P>
You may also create a toolbar that is managed by the frame, by
calling <A HREF="wx104.htm#wxframecreatetoolbar">wxFrame::CreateToolBar</A>.<P>
<HR>
<A NAME="topic983"></A>
<H3>wxToolBar::~wxToolBar</H3>
<P>
<B>void</B> <B>~wxToolBar</B>()<P>
Toolbar destructor.<P>
<HR>
<A NAME="wxtoolbaraddseparator"></A>
<H3>wxToolBar::AddSeparator</H3>
<P>
<B>void</B> <B>AddSeparator</B>()<P>
Adds a separator for spacing groups of tools.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>, <A HREF="wx249.htm#wxtoolbarsettoolseparation">wxToolBar::SetToolSeparation</A><P>
<HR>
<A NAME="wxtoolbaraddtool"></A>
<H3>wxToolBar::AddTool</H3>
<P>
<B>wxToolBarTool*</B> <B>AddTool</B>(<B>int</B><I> toolIndex</I>, <B>const wxBitmap&</B><I> bitmap1</I>,
<B>const wxBitmap&</B><I> bitmap2 = wxNullBitmap</I>, <B>bool</B><I> isToggle = FALSE</I>,
<B>long</B><I> xPos = -1</I>, <B>long</B><I> yPos = -1</I>,
<B>wxObject* </B><I>clientData = NULL</I>, <B>const wxString& </B><I>shortHelpString = ""</I>, <B>const wxString& </B><I>longHelpString = ""</I>)<P>
Adds a tool to the toolbar.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
An integer by which
the tool may be identified in subsequent operations.</UL></UL>
<P>
<I>isToggle</I><UL><UL>
Specifies whether the tool is a toggle or not: a toggle tool may be in
two states, whereas a non-toggle tool is just a button.</UL></UL>
<P>
<I>bitmap1</I><UL><UL>
The primary tool bitmap for toggle and button tools.</UL></UL>
<P>
<I>bitmap2</I><UL><UL>
The second bitmap specifies the on-state bitmap for a toggle
tool. If this is NULL, either an inverted version of the primary bitmap is
used for the on-state of a toggle tool (monochrome displays) or a black
border is drawn around the tool (colour displays). Note that to pass a NULL value,
you need to cast it to (wxBitmap *) so that C++ can construct an appropriate temporary
wxBitmap object.</UL></UL>
<P>
<I>xPos</I><UL><UL>
Specifies the x position of the tool if automatic layout is not suitable.</UL></UL>
<P>
<I>yPos</I><UL><UL>
Specifies the y position of the tool if automatic layout is not suitable.</UL></UL>
<P>
<I>clientData</I><UL><UL>
An optional pointer to client data which can be
retrieved later using <A HREF="wx249.htm#wxtoolbargettoolclientdata">wxToolBar::GetToolClientData</A>.</UL></UL>
<P>
<I>shortHelpString</I><UL><UL>
Used for displaying a tooltip for the tool in the
Windows 95 implementation of wxButtonBar. Pass the empty string if this is not required.</UL></UL>
<P>
<I>longHelpString</I><UL><UL>
Used to displayer longer help, such as status line help.
Pass the empty string if this is not required.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
After you have added tools to a toolbar, you must call <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A> in
order to have the tools appear.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaraddseparator">wxToolBar::AddSeparator</A>,
<A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A>,<P>
<HR>
<A NAME="wxtoolbarcreatetools"></A>
<H3>wxToolBar::CreateTools</H3>
<P>
<B>bool</B> <B>CreateTools</B>()<P>
This function is implemented for some toolbar classes to create the tools and display them.
The portable way of calling it is to call <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A> after
you have added tools and separators.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>, <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A><P>
<HR>
<A NAME="wxtoolbardrawtool"></A>
<H3>wxToolBar::DrawTool</H3>
<P>
<B>void</B> <B>DrawTool</B>(<B>wxMemoryDC& </B><I>memDC</I>, <B>wxToolBarTool* </B><I>tool</I>)<P>
Draws the specified tool onto the window using the given memory device context.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>memDC</I><UL><UL>
A memory DC to be used for drawing the tool.</UL></UL>
<P>
<I>tool</I><UL><UL>
Tool to be drawn.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
For internal use only.<P>
<HR>
<A NAME="wxtoolbarenabletool"></A>
<H3>wxToolBar::EnableTool</H3>
<P>
<B>void</B> <B>EnableTool</B>(<B>int </B><I>toolIndex</I>, <B>const bool</B><I> enable</I>)<P>
Enables or disables the tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
Tool to enable or disable.</UL></UL>
<P>
<I>enable</I><UL><UL>
If TRUE, enables the tool, otherwise disables it.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
For wxToolBarSimple, does nothing. Some other implementations
will change the visible state of the tool to indicate that it is disabled.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoolenabled">wxToolBar::GetToolEnabled</A>,
<A HREF="wx249.htm#wxtoolbartoggletool">wxToolBar::ToggleTool</A><P>
<HR>
<A NAME="wxtoolbarfindtoolforposition"></A>
<H3>wxToolBar::FindToolForPosition</H3>
<P>
<B>wxToolBarTool*</B> <B>FindToolForPosition</B>(<B>const float</B><I> x</I>, <B>const float</B><I> y</I>) <B>const</B><P>
Finds a tool for the given mouse position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>x</I><UL><UL>
X position.</UL></UL>
<P>
<I>y</I><UL><UL>
Y position.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
A pointer to a tool if a tool is found, or NULL otherwise.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Used internally, and should not need to be used by the programmer.<P>
<HR>
<A NAME="wxtoolbargettoolsize"></A>
<H3>wxToolBar::GetToolSize</H3>
<P>
<B>wxSize</B> <B>GetToolSize</B>()<P>
Returns the size of a whole button, which is usually larger than a tool bitmap because
of added 3D effects.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsettoolbitmapsize">wxToolBar::SetToolBitmapSize</A>,
<A HREF="wx249.htm#wxtoolbargettoolbitmapsize">wxToolBar::GetToolBitmapSize</A><P>
<HR>
<A NAME="wxtoolbargettoolbitmapsize"></A>
<H3>wxToolBar::GetToolBitmapSize</H3>
<P>
<B>wxSize</B> <B>GetToolBitmapSize</B>()<P>
Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Note that this is the size of the bitmap you pass to <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>,
and not the eventual size of the tool button.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsettoolbitmapsize">wxToolBar::SetToolBitmapSize</A>,
<A HREF="wx249.htm#wxtoolbargettoolsize">wxToolBar::GetToolSize</A><P>
<HR>
<A NAME="wxtoolbargetmargins"></A>
<H3>wxToolBar::GetMargins</H3>
<P>
<B>wxSize</B> <B>GetMargins</B>() <B>const</B><P>
Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsetmargins">wxToolBar::SetMargins</A><P>
<HR>
<A NAME="wxtoolbargetmaxsize"></A>
<H3>wxToolBar::GetMaxSize</H3>
<P>
<B>void</B> <B>GetMaxSize</B>(<B>float*</B><I> w</I>, <B>float*</B><I> h</I>) <B>const</B><P>
Gets the maximum size taken up by the tools after layout, including margins.
This can be used to size a frame around the toolbar window.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>w</I><UL><UL>
Receives the maximum horizontal size.</UL></UL>
<P>
<I>h</I><UL><UL>
Receives the maximum vertical size.</UL></UL>
<P>
<HR>
<A NAME="wxtoolbargettoolclientdata"></A>
<H3>wxToolBar::GetToolClientData</H3>
<P>
<B>wxObject*</B> <B>GetToolClientData</B>(<B>int </B><I>toolIndex</I>) <B>const</B><P>
Get any client data associated with the tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
Index of the tool, as passed to <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
Client data, or NULL if there is none.<P>
<HR>
<A NAME="wxtoolbargettoolenabled"></A>
<H3>wxToolBar::GetToolEnabled</H3>
<P>
<B>bool</B> <B>GetToolEnabled</B>(<B>int </B><I>toolIndex</I>) <B>const</B><P>
Called to determine whether a tool is enabled (responds to user input).<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
Index of the tool in question.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the tool is enabled, FALSE otherwise.<P>
<HR>
<A NAME="wxtoolbargettoollonghelp"></A>
<H3>wxToolBar::GetToolLongHelp</H3>
<P>
<B>wxString</B> <B>GetToolLongHelp</B>(<B>int </B><I>toolIndex</I>) <B>const</B><P>
Returns the long help for the given tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The tool in question.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsettoollonghelp">wxToolBar::SetToolLongHelp</A>,
<A HREF="wx249.htm#wxtoolbarsettoolshorthelp">wxToolBar::SetToolShortHelp</A><P>
<HR>
<A NAME="wxtoolbargettoolpacking"></A>
<H3>wxToolBar::GetToolPacking</H3>
<P>
<B>int</B> <B>GetToolPacking</B>() <B>const</B><P>
Returns the value used for packing tools.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsettoolpacking">wxToolBar::SetToolPacking</A><P>
<HR>
<A NAME="wxtoolbargettoolseparation"></A>
<H3>wxToolBar::GetToolSeparation</H3>
<P>
<B>int</B> <B>GetToolSeparation</B>() <B>const</B><P>
Returns the default separator size.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbarsettoolseparation">wxToolBar::SetToolSeparation</A><P>
<HR>
<A NAME="wxtoolbargettoolshorthelp"></A>
<H3>wxToolBar::GetToolShortHelp</H3>
<P>
<B>wxString</B> <B>GetToolShortHelp</B>(<B>int </B><I>toolIndex</I>) <B>const</B><P>
Returns the short help for the given tool.<P>
Returns the long help for the given tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The tool in question.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoollonghelp">wxToolBar::GetToolLongHelp</A>,
<A HREF="wx249.htm#wxtoolbarsettoolshorthelp">wxToolBar::SetToolShortHelp</A><P>
<HR>
<A NAME="wxtoolbargettoolstate"></A>
<H3>wxToolBar::GetToolState</H3>
<P>
<B>bool</B> <B>GetToolState</B>(<B>int </B><I>toolIndex</I>) <B>const</B><P>
Gets the on/off state of a toggle tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The tool in question.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the tool is toggled on, FALSE otherwise.<P>
<HR>
<A NAME="wxtoolbarlayout"></A>
<H3>wxToolBar::Layout</H3>
<P>
<B>void</B> <B>Layout</B>()<P>
Called by the application after the tools have been added to
automatically lay the tools out on the window. If you have given
absolute positions when adding the tools, do not call this.<P>
This function is only implemented for some toolbar classes.
The portable way of calling it is to call <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A> after
you have added tools and separators.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>, <A HREF="wx249.htm#wxtoolbarrealize">wxToolBar::Realize</A><P>
<HR>
<A NAME="wxtoolbaronleftclick"></A>
<H3>wxToolBar::OnLeftClick</H3>
<P>
<B>bool</B> <B>OnLeftClick</B>(<B>int</B><I> toolIndex</I>, <B>bool</B><I> toggleDown</I>)<P>
Called when the user clicks on a tool with the left mouse button.<P>
This is the old way of detecting tool clicks; although it will still work,
you should use the EVT_MENU or EVT_TOOL macro instead.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The identifier passed to <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>.</UL></UL>
<P>
<I>toggleDown</I><UL><UL>
TRUE if the tool is a toggle and the toggle is down, otherwise is FALSE.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
If the tool is a toggle and this function returns FALSE, the toggle
toggle state (internal and visual) will not be changed. This provides a way of
specifying that toggle operations are not permitted in some circumstances.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaronmouseenter">wxToolBar::OnMouseEnter</A>,
<A HREF="wx249.htm#wxtoolbaronrightclick">wxToolBar::OnRightClick</A><P>
<HR>
<A NAME="wxtoolbaronmouseenter"></A>
<H3>wxToolBar::OnMouseEnter</H3>
<P>
<B>void</B> <B>OnMouseEnter</B>(<B>int</B><I> toolIndex</I>)<P>
This is called when the mouse cursor moves into a tool or out of
the toolbar.<P>
This is the old way of detecting mouse enter events; although it will still work,
you should use the EVT_TOOL_ENTER macro instead.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
Greater than -1 if the mouse cursor has moved into the tool,
or -1 if the mouse cursor has moved. The
programmer can override this to provide extra information about the tool,
such as a short description on the status line.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWindows may not be able to
detect it. Therefore this function may not always be called when expected.<P>
<HR>
<A NAME="wxtoolbaronrightclick"></A>
<H3>wxToolBar::OnRightClick</H3>
<P>
<B>void</B> <B>OnRightClick</B>(<B>int</B><I> toolIndex</I>, <B>float</B><I> x</I>, <B>float</B><I> y</I>)<P>
Called when the user clicks on a tool with the right mouse button. The
programmer should override this function to detect right tool clicks.<P>
This is the old way of detecting tool right clicks; although it will still work,
you should use the EVT_TOOL_RCLICKED macro instead.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The identifier passed to <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>.</UL></UL>
<P>
<I>x</I><UL><UL>
The x position of the mouse cursor.</UL></UL>
<P>
<I>y</I><UL><UL>
The y position of the mouse cursor.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
A typical use of this member might be to pop up a menu.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaronmouseenter">wxToolBar::OnMouseEnter</A>,
<A HREF="wx249.htm#wxtoolbaronleftclick">wxToolBar::OnLeftClick</A><P>
<HR>
<A NAME="wxtoolbarrealize"></A>
<H3>wxToolBar::Realize</H3>
<P>
<B>bool</B> <B>Realize</B>()<P>
This function should be called after you have added tools. It
calls, according to the implementation,
either <A HREF="wx249.htm#wxtoolbarcreatetools">wxToolBar::CreateTools</A> or
<A HREF="wx249.htm#wxtoolbarlayout">wxToolBar::Layout</A>.<P>
If you are using absolute positions for your tools when using a wxToolBarSimple object,
do not call this function. You must call it at all other times.<P>
<HR>
<A NAME="wxtoolbarsettoolbitmapsize"></A>
<H3>wxToolBar::SetToolBitmapSize</H3>
<P>
<B>void</B> <B>SetToolBitmapSize</B>(<B>const wxSize&</B><I> size</I>)<P>
Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>size</I><UL><UL>
The size of the bitmaps in the toolbar.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This should be called to tell the toolbar what the tool bitmap size is. Call
it before you add tools.<P>
Note that this is the size of the bitmap you pass to <A HREF="wx249.htm#wxtoolbaraddtool">wxToolBar::AddTool</A>,
and not the eventual size of the tool button.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoolbitmapsize">wxToolBar::GetToolBitmapSize</A>,
<A HREF="wx249.htm#wxtoolbargettoolsize">wxToolBar::GetToolSize</A><P>
<HR>
<A NAME="wxtoolbarsetmargins"></A>
<H3>wxToolBar::SetMargins</H3>
<P>
<B>void</B> <B>SetMargins</B>(<B>const wxSize&</B><I> size</I>)<P>
<B>void</B> <B>SetMargins</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>)<P>
Set the values to be used as margins for the toolbar.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>size</I><UL><UL>
Margin size.</UL></UL>
<P>
<I>x</I><UL><UL>
Left margin, right margin and inter-tool separation value.</UL></UL>
<P>
<I>y</I><UL><UL>
Top margin, bottom margin and inter-tool separation value.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This must be called before the tools are added if absolute positioning is to be used, and the
default (zero-size) margins are to be overridden.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargetmargins">wxToolBar::GetMargins</A>, <A HREF="wx205.htm#wxsize">wxSize</A><P>
<HR>
<A NAME="wxtoolbarsettoollonghelp"></A>
<H3>wxToolBar::SetToolLongHelp</H3>
<P>
<B>void</B> <B>SetToolLongHelp</B>(<B>int </B><I>toolIndex</I>, <B>const wxString& </B><I>helpString</I>)<P>
Sets the long help for the given tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The tool in question.</UL></UL>
<P>
<I>helpString</I><UL><UL>
A string for the long help.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
You might use the long help for displaying the tool purpose on the status line.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoollonghelp">wxToolBar::GetToolLongHelp</A>,
<A HREF="wx249.htm#wxtoolbarsettoolshorthelp">wxToolBar::SetToolShortHelp</A>,<P>
<HR>
<A NAME="wxtoolbarsettoolpacking"></A>
<H3>wxToolBar::SetToolPacking</H3>
<P>
<B>void</B> <B>SetToolPacking</B>(<B>int</B><I> packing</I>)<P>
Sets the value used for spacing tools. The default value is 1.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>packing</I><UL><UL>
The value for packing.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The packing is used for spacing in the vertical direction if the toolbar is horizontal,
and for spacing in the horizontal direction if the toolbar is vertical.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoolpacking">wxToolBar::GetToolPacking</A><P>
<HR>
<A NAME="wxtoolbarsettoolshorthelp"></A>
<H3>wxToolBar::SetToolShortHelp</H3>
<P>
<B>void</B> <B>SetToolShortHelp</B>(<B>int </B><I>toolIndex</I>, <B>const wxString& </B><I>helpString</I>)<P>
Sets the short help for the given tool.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
The tool in question.</UL></UL>
<P>
<I>helpString</I><UL><UL>
The string for the short help.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
An application might use short help for identifying the tool purpose in a tooltip.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoolshorthelp">wxToolBar::GetToolShortHelp</A>, <A HREF="wx249.htm#wxtoolbarsettoollonghelp">wxToolBar::SetToolLongHelp</A><P>
<HR>
<A NAME="wxtoolbarsettoolseparation"></A>
<H3>wxToolBar::SetToolSeparation</H3>
<P>
<B>void</B> <B>SetToolSeparation</B>(<B>int</B><I> separation</I>)<P>
Sets the default separator size. The default value is 5.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>separation</I><UL><UL>
The separator size.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbaraddseparator">wxToolBar::AddSeparator</A><P>
<HR>
<A NAME="wxtoolbartoggletool"></A>
<H3>wxToolBar::ToggleTool</H3>
<P>
<B>void</B> <B>ToggleTool</B>(<B>int </B><I>toolIndex</I>, <B>const bool</B><I> toggle</I>)<P>
Toggles a tool on or off.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>toolIndex</I><UL><UL>
Tool in question.</UL></UL>
<P>
<I>toggle</I><UL><UL>
If TRUE, toggles the tool on, otherwise toggles it off.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Only applies to a tool that has been specified as a toggle tool.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx249.htm#wxtoolbargettoolstate">wxToolBar::GetToolState</A><P>
</BODY></HTML>
|