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 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
|
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/toolbar.h
// Purpose: Documentation of wxAuiToolBar and related classes.
// Created: 2011-01-17
// Copyright: (c) 2011 wxWidgets development team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/**
wxAuiToolBarStyle is part of the wxAUI class framework, used to define the appearance of a wxAuiToolBar.
See also @ref overview_aui.
@library{wxaui}
@category{aui}
*/
enum wxAuiToolBarStyle
{
/**
Shows the text in the toolbar buttons; by default only icons are shown.
*/
wxAUI_TB_TEXT = 1 << 0,
/**
Don't show tooltips on wxAuiToolBar items.
*/
wxAUI_TB_NO_TOOLTIPS = 1 << 1,
/**
Do not auto-resize the wxAuiToolBar.
*/
wxAUI_TB_NO_AUTORESIZE = 1 << 2,
/**
Shows a gripper on the wxAuiToolBar.
*/
wxAUI_TB_GRIPPER = 1 << 3,
/**
The wxAuiToolBar can contain overflow items.
*/
wxAUI_TB_OVERFLOW = 1 << 4,
/**
Using this style forces the toolbar to be vertical and be only dockable to the left or right sides of the window whereas by default it can be horizontal or vertical and be docked anywhere.
*/
wxAUI_TB_VERTICAL = 1 << 5,
/**
Shows the text and the icons alongside, not vertically stacked. This style must be used with wxAUI_TB_TEXT
*/
wxAUI_TB_HORZ_LAYOUT = 1 << 6,
/**
Analogous to wxAUI_TB_VERTICAL, but forces the toolbar to be horizontal, docking to the top or bottom of the window.
*/
wxAUI_TB_HORIZONTAL = 1 << 7,
/**
Draw a plain background (based on parent) instead of the default gradient background.
@since 2.9.5
*/
wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
/**
Shows the text alongside the icons, not vertically stacked.
*/
wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
/**
Shows the text in the toolbar buttons; by default only icons are shown.
*/
wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
/**
By default only icons are shown.
*/
wxAUI_TB_DEFAULT_STYLE = 0
};
/**
wxAuiToolBarArtSetting
@library{wxaui}
@category{aui}
*/
enum wxAuiToolBarArtSetting
{
/**
wxAuiToolBar seperator size.
*/
wxAUI_TBART_SEPARATOR_SIZE = 0,
/**
wxAuiToolBar gripper size.
*/
wxAUI_TBART_GRIPPER_SIZE = 1,
/**
Overflow button size in wxAuiToolBar.
*/
wxAUI_TBART_OVERFLOW_SIZE = 2
};
/**
wxAuiToolBarToolTextOrientation
@library{wxaui}
@category{aui}
*/
enum wxAuiToolBarToolTextOrientation
{
/**
Text in wxAuiToolBar items is left aligned, currently unused/unimplemented.
*/
wxAUI_TBTOOL_TEXT_LEFT = 0,
/**
Text in wxAuiToolBar items is right aligned.
*/
wxAUI_TBTOOL_TEXT_RIGHT = 1,
/**
Text in wxAuiToolBar items is top aligned, currently unused/unimplemented.
*/
wxAUI_TBTOOL_TEXT_TOP = 2,
/**
Text in wxAuiToolBar items is bottom aligned.
*/
wxAUI_TBTOOL_TEXT_BOTTOM = 3
};
/**
@class wxAuiToolBarEvent
wxAuiToolBarEvent is used for the events generated by @ref wxAuiToolBar.
@library{wxaui}
@category{aui}
*/
class wxAuiToolBarEvent : public wxNotifyEvent
{
public:
/**
Returns whether the drop down menu has been clicked.
*/
bool IsDropDownClicked() const;
/**
Returns the point where the user clicked with the mouse.
*/
wxPoint GetClickPoint() const;
/**
Returns the wxAuiToolBarItem rectangle bounding the mouse click point.
*/
wxRect GetItemRect() const;
/**
Returns the wxAuiToolBarItem identifier.
*/
int GetToolId() const;
};
/**
@class wxAuiToolBarItem
wxAuiToolBarItem is part of the wxAUI class framework, representing a toolbar element.
See also @ref wxAuiToolBar and @ref overview_aui.
It has a unique id (except for the separators which always have id = -1), the
style (telling whether it is a normal button, separator or a control), the
state (toggled or not, enabled or not) and short and long help strings. The
default implementations use the short help string for the tooltip text which
is popped up when the mouse pointer enters the tool and the long help string
for the applications status bar (currently not implemented).
@library{wxaui}
@category{aui}
*/
class wxAuiToolBarItem
{
public:
/**
Default Constructor
*/
wxAuiToolBarItem();
/**
Assigns the properties of the wxAuiToolBarItem "c" to this.
*/
wxAuiToolBarItem(const wxAuiToolBarItem& c);
/**
Assigns the properties of the wxAuiToolBarItem "c" to this, returning a pointer to this.
*/
wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c);
/**
Assigns the properties of the wxAuiToolBarItem "c" to this.
*/
void Assign(const wxAuiToolBarItem& c);
/**
Assigns a window to the toolbar item.
*/
void SetWindow(wxWindow* w);
/**
Returns the wxWindow* associated to the toolbar item.
*/
wxWindow* GetWindow();
/**
Sets the toolbar item identifier.
*/
void SetId(int new_id);
/**
Returns the toolbar item identifier.
*/
int GetId() const;
/**
Sets the wxAuiToolBarItem kind.
*/
void SetKind(int new_kind);
/**
Returns the toolbar item kind.
*/
int GetKind() const;
/**
*/
void SetState(int new_state);
/**
*/
int GetState() const;
/**
*/
void SetSizerItem(wxSizerItem* s);
/**
*/
wxSizerItem* GetSizerItem() const;
/**
*/
void SetLabel(const wxString& s);
/**
*/
const wxString& GetLabel() const;
/**
*/
void SetBitmap(const wxBitmap& bmp);
/**
*/
const wxBitmap& GetBitmap() const;
/**
*/
void SetDisabledBitmap(const wxBitmap& bmp);
/**
*/
const wxBitmap& GetDisabledBitmap() const;
/**
*/
void SetHoverBitmap(const wxBitmap& bmp);
/**
*/
const wxBitmap& GetHoverBitmap() const;
/**
*/
void SetShortHelp(const wxString& s);
/**
*/
const wxString& GetShortHelp() const;
/**
*/
void SetLongHelp(const wxString& s);
/**
*/
const wxString& GetLongHelp() const;
/**
*/
void SetMinSize(const wxSize& s);
/**
*/
const wxSize& GetMinSize() const;
/**
*/
void SetSpacerPixels(int s);
/**
*/
int GetSpacerPixels() const;
/**
*/
void SetProportion(int p);
/**
*/
int GetProportion() const;
/**
*/
void SetActive(bool b);
/**
*/
bool IsActive() const;
/**
Set whether this tool has a drop down button.
This is only valid for wxITEM_NORMAL tools.
*/
void SetHasDropDown(bool b);
/**
Returns whether the toolbar item has an associated drop down button.
*/
bool HasDropDown() const;
/**
*/
void SetSticky(bool b);
/**
*/
bool IsSticky() const;
/**
*/
void SetUserData(long l);
/**
*/
long GetUserData() const;
/**
*/
void SetAlignment(int l);
/**
*/
int GetAlignment() const;
};
/**
@class wxAuiToolBarArt
wxAuiToolBarArt is part of the wxAUI class framework.
See also @ref wxAuiToolBar and @ref overview_aui.
@library{wxaui}
@category{aui}
*/
class wxAuiToolBarArt
{
public:
wxAuiToolBarArt();
virtual wxAuiToolBarArt* Clone() = 0;
virtual void SetFlags(unsigned int flags) = 0;
virtual unsigned int GetFlags() = 0;
virtual void SetFont(const wxFont& font) = 0;
virtual wxFont GetFont() = 0;
virtual void SetTextOrientation(int orientation) = 0;
virtual int GetTextOrientation() = 0;
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawPlainBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawDropDownButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawControlLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawSeparator(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawGripper(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawOverflowButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect,
int state) = 0;
virtual wxSize GetLabelSize(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) = 0;
virtual wxSize GetToolSize(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) = 0;
virtual int GetElementSize(int element_id) = 0;
virtual void SetElementSize(int element_id, int size) = 0;
virtual int ShowDropDown(
wxWindow* wnd,
const wxAuiToolBarItemArray& items) = 0;
};
/**
@class wxAuiDefaultToolBarArt
wxAuiDefaultToolBarArt is part of the wxAUI class framework.
See also @ref wxAuiToolBarArt , @ref wxAuiToolBar and @ref overview_aui.
@library{wxaui}
@category{aui}
*/
class wxAuiDefaultToolBarArt : public wxAuiToolBarArt
{
public:
wxAuiDefaultToolBarArt();
virtual ~wxAuiDefaultToolBarArt();
virtual wxAuiToolBarArt* Clone();
virtual void SetFlags(unsigned int flags);
virtual unsigned int GetFlags();
virtual void SetFont(const wxFont& font);
virtual wxFont GetFont();
virtual void SetTextOrientation(int orientation);
virtual int GetTextOrientation();
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawPlainBackground(wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect);
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect);
virtual void DrawDropDownButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect);
virtual void DrawControlLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect);
virtual void DrawSeparator(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawGripper(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawOverflowButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect,
int state);
virtual wxSize GetLabelSize(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item);
virtual wxSize GetToolSize(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item);
virtual int GetElementSize(int element);
virtual void SetElementSize(int element_id, int size);
virtual int ShowDropDown(wxWindow* wnd,
const wxAuiToolBarItemArray& items);
};
/**
@class wxAuiToolBar
wxAuiToolBar is a dockable toolbar, part of the wxAUI class framework.
See also @ref overview_aui.
@beginStyleTable
@style{wxAUI_TB_TEXT}
@style{wxAUI_TB_NO_TOOLTIPS}
@style{wxAUI_TB_NO_AUTORESIZE}
@style{wxAUI_TB_GRIPPER}
@style{wxAUI_TB_OVERFLOW}
@style{wxAUI_TB_VERTICAL}
using this style forces the toolbar to be vertical and
be only dockable to the left or right sides of the window
whereas by default it can be horizontal or vertical and
be docked anywhere
@style{wxAUI_TB_HORZ_LAYOUT}
@style{wxAUI_TB_HORIZONTAL}
analogous to wxAUI_TB_VERTICAL, but forces the toolbar
to be horizontal
@style{wxAUI_TB_PLAIN_BACKGROUND}
Draw a plain background (based on parent) instead of the
default gradient background.
@style{wxAUI_TB_HORZ_TEXT}
Equivalent to wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT
@style{wxAUI_TB_DEFAULT_STYLE}
The default is to have no styles
@endStyleTable
@beginEventEmissionTable{wxAuiToolBarEvent}
@event{EVT_AUITOOLBAR_TOOL_DROPDOWN(id, func)}
Process a wxEVT_AUITOOLBAR_TOOL_DROPDOWN event
@event{EVT_AUITOOLBAR_OVERFLOW_CLICK(id, func)}
Process a wxEVT_AUITOOLBAR_OVERFLOW_CLICK event
@event{EVT_AUITOOLBAR_RIGHT_CLICK(id, func)}
Process a wxEVT_AUITOOLBAR_RIGHT_CLICK event
@event{EVT_AUITOOLBAR_MIDDLE_CLICK(id, func)}
Process a wxEVT_AUITOOLBAR_MIDDLE_CLICK event
@event{EVT_AUITOOLBAR_BEGIN_DRAG(id, func)}
Process a wxEVT_AUITOOLBAR_BEGIN_DRAG event
@endEventTable
@library{wxaui}
@category{aui}
*/
class wxAuiToolBar : public wxControl
{
public:
/**
Default constructor, use Create() later.
@since 2.9.5
*/
wxAuiToolBar();
/**
Constructor creating and initializing the object.
*/
wxAuiToolBar(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& position = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_TB_DEFAULT_STYLE);
/**
Really create wxAuiToolBar created using default constructor.
@since 2.9.5
*/
bool Create(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_TB_DEFAULT_STYLE);
virtual ~wxAuiToolBar();
void SetWindowStyleFlag(long style);
long GetWindowStyleFlag() const;
void SetArtProvider(wxAuiToolBarArt* art);
wxAuiToolBarArt* GetArtProvider() const;
bool SetFont(const wxFont& font);
wxAuiToolBarItem* AddTool(int tool_id,
const wxString& label,
const wxBitmap& bitmap,
const wxString& short_help_string = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL);
wxAuiToolBarItem* AddTool(int tool_id,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& disabled_bitmap,
wxItemKind kind,
const wxString& short_help_string,
const wxString& long_help_string,
wxObject* client_data);
wxAuiToolBarItem* AddTool(int tool_id,
const wxBitmap& bitmap,
const wxBitmap& disabled_bitmap,
bool toggle = false,
wxObject* client_data = NULL,
const wxString& short_help_string = wxEmptyString,
const wxString& long_help_string = wxEmptyString);
wxAuiToolBarItem* AddLabel(int tool_id,
const wxString& label = wxEmptyString,
const int width = -1);
wxAuiToolBarItem* AddControl(wxControl* control,
const wxString& label = wxEmptyString);
wxAuiToolBarItem* AddSeparator();
wxAuiToolBarItem* AddSpacer(int pixels);
wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
bool Realize();
wxControl* FindControl(int window_id);
wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
wxAuiToolBarItem* FindToolByIndex(int idx) const;
wxAuiToolBarItem* FindTool(int tool_id) const;
void ClearTools();
void Clear();
bool DeleteTool(int tool_id);
bool DeleteByIndex(int tool_id);
size_t GetToolCount() const;
int GetToolPos(int tool_id) const;
int GetToolIndex(int tool_id) const;
bool GetToolFits(int tool_id) const;
wxRect GetToolRect(int tool_id) const;
bool GetToolFitsByIndex(int tool_id) const;
bool GetToolBarFits() const;
void SetMargins(const wxSize& size);
void SetMargins(int x, int y);
void SetMargins(int left, int right, int top, int bottom);
void SetToolBitmapSize(const wxSize& size);
wxSize GetToolBitmapSize() const;
bool GetOverflowVisible() const;
void SetOverflowVisible(bool visible);
bool GetGripperVisible() const;
void SetGripperVisible(bool visible);
void ToggleTool(int tool_id, bool state);
bool GetToolToggled(int tool_id) const;
void EnableTool(int tool_id, bool state);
bool GetToolEnabled(int tool_id) const;
/**
Set whether the specified toolbar item has a drop down button.
This is only valid for wxITEM_NORMAL tools.
@see wxAuiToolBarItem::SetHasDropDown()
*/
void SetToolDropDown(int tool_id, bool dropdown);
/**
Returns whether the specified toolbar item has an associated drop down
button.
@see wxAuiToolBarItem::HasDropDown()
*/
bool GetToolDropDown(int tool_id) const;
void SetToolBorderPadding(int padding);
int GetToolBorderPadding() const;
void SetToolTextOrientation(int orientation);
int GetToolTextOrientation() const;
void SetToolPacking(int packing);
int GetToolPacking() const;
void SetToolProportion(int tool_id, int proportion);
int GetToolProportion(int tool_id) const;
void SetToolSeparation(int separation);
int GetToolSeparation() const;
void SetToolSticky(int tool_id, bool sticky);
bool GetToolSticky(int tool_id) const;
wxString GetToolLabel(int tool_id) const;
void SetToolLabel(int tool_id, const wxString& label);
wxBitmap GetToolBitmap(int tool_id) const;
void SetToolBitmap(int tool_id, const wxBitmap& bitmap);
wxString GetToolShortHelp(int tool_id) const;
void SetToolShortHelp(int tool_id, const wxString& help_string);
wxString GetToolLongHelp(int tool_id) const;
void SetToolLongHelp(int tool_id, const wxString& help_string);
void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
const wxAuiToolBarItemArray& append);
/** get size of hint rectangle for a particular dock location */
wxSize GetHintSize(int dock_direction) const;
bool IsPaneValid(const wxAuiPaneInfo& pane) const;
};
|