Add help button support to wxRibbonBar.

Optionally show standard "Help" question mark button in the ribbon top right
corner and generate the appropriate event for it.

Closes #14576.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-09-15 23:19:59 +00:00
parent 66815259f5
commit 42d7394119
13 changed files with 472 additions and 42 deletions

View File

@@ -661,6 +661,47 @@ public:
wxRibbonButtonKind kind,
long state) = 0;
/**
Draw toggle button on wxRibbonBar. This should draw a small toggle button
at top right corner of ribbon bar.
@param dc
The device context to draw onto.
@param wnd
The window which is being drawn onto, which is always the panel
whose background and chrome is being drawn. The panel label and
other panel attributes can be obtained by querying this.
@param rect
The rectangle within which to draw.
@param mode
The wxRibbonDisplayMode which should be applied to display button
@since 2.9.5
*/
virtual void DrawToggleButton(wxDC& dc,
wxRibbonBar* wnd,
const wxRect& rect,
wxRibbonDisplayMode mode) = 0;
/**
Draw help button on wxRibbonBar. This should draw a help button
at top right corner of ribbon bar.
@param dc
The device context to draw onto.
@param wnd
The window which is being drawn onto, which is always the panel
whose background and chrome is being drawn. The panel label and
other panel attributes can be obtained by querying this.
@param rect
The rectangle within which to draw.
@since 2.9.5
*/
virtual void DrawHelpButton(wxDC& dc,
wxRibbonBar* wnd,
const wxRect& rect) = 0;
/**
Calculate the ideal and minimum width (in pixels) of a tab in a ribbon
bar.
@@ -961,4 +1002,24 @@ public:
bool is_first,
bool is_last,
wxRect* dropdown_region) = 0;
/**
Calculate the position and size of the ribbon's toggle button.
@param rect
The ribbon bar rectangle from which calculate toggle button rectangle.
@since 2.9.5
*/
virtual wxRect GetBarToggleButtonArea(const wxRect& rect) = 0;
/**
Calculate the position and size of the ribbon's help button.
@param rect
The ribbon bar rectangle from which calculate help button rectangle.
@since 2.9.5
*/
virtual wxRect GetRibbonHelpButtonArea(const wxRect& rect) = 0;
};

View File

@@ -65,7 +65,7 @@ public:
@style{wxRIBBON_BAR_DEFAULT_STYLE}
Defined as wxRIBBON_BAR_FLOW_HORIZONTAL |
wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
wxRIBBON_BAR_SHOW_TOGGLE_BUTTON.
wxRIBBON_BAR_SHOW_TOGGLE_BUTTON | wxRIBBON_BAR_SHOW_HELP_BUTTON.
@style{wxRIBBON_BAR_FOLDBAR_STYLE}
Defined as wxRIBBON_BAR_FLOW_VERTICAL | wxRIBBON_BAR_SHOW_PAGE_ICONS
| wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
@@ -87,6 +87,9 @@ public:
@style{wxRIBBON_BAR_SHOW_TOGGLE_BUTTON}
Causes a toggle button to appear on the ribbon bar at top-right corner.
This style is new since wxWidgets 2.9.5.
@style{wxRIBBON_BAR_SHOW_HELP_BUTTON)
Causes a help button to appear on the ribbon bar at the top-right corner.
This style is new since wxWidgets 2.9.5.
@endStyleTable
@@ -107,9 +110,12 @@ public:
Triggered when the right mouse button is released on a tab.
@event{EVT_RIBBONBAR_TAB_LEFT_DCLICK(id, func)}
Triggered when the left mouse button is double clicked on a tab.
@event{EVT_RIBBONBAR_TOGGLE_BUTTON_CLICK(id, func)}
@event{EVT_RIBBONBAR_TOGGLED(id, func)}
Triggered when the button triggering the ribbon bar is clicked. This
event is new since wxWidgets 2.9.5.
@event{EVT_RIBBONBAR_HELP_CLICK(id, func)}
Triggered when the help button is clicked. This even is new since
wxWidgets 2.9.5.
@endEventTable
@library{wxribbon}