Implement support for wxRIBBON_PANEL_EXT_BUTTON wxRibbonPanel style.

Show the "extension button" in the ribbon panel if this style is specified.

Also generate a specific event if this button is clicked.

Closes #14283.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-03 19:17:09 +00:00
parent 07c7226468
commit 0a7ee6e0f4
9 changed files with 322 additions and 6 deletions

View File

@@ -776,7 +776,24 @@ public:
const wxRibbonPanel* wnd,
wxSize size,
wxPoint* client_offset) = 0;
/**
Calculate the position and size of the panel extension button.
@param dc
A device context to use if one is required for size calculations.
@param wnd
The ribbon panel in question.
@param rect
The panel rectangle from which calculate extension button rectangle.
@since 2.9.4
*/
virtual wxRect GetPanelExtButtonArea(
wxDC& dc,
const wxRibbonPanel* wnd,
wxRect rect) = 0;
/**
Calculate the size of a wxRibbonGallery control for a given client
size. This should increment the given size by enough to fit the gallery

View File

@@ -6,6 +6,41 @@
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/**
@class wxRibbonPanelEvent
Event used to indicate various actions relating to a wxRibbonPanel.
See wxRibbonPanel for available event types.
@since 2.9.4
@library{wxribbon}
@category{events,ribbon}
@see wxRibbonPanel
*/
class wxRibbonPanelEvent : public wxCommandEvent
{
public:
/**
Constructor.
*/
wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
int win_id = 0,
wxRibbonPanel* panel = NULL)
/**
Returns the panel relating to this event.
*/
wxRibbonPanel* GetPanel();
/**
Sets the page relating to this event.
*/
void SetPanel(wxRibbonPanel* page);
};
/**
@class wxRibbonPanel
@@ -53,6 +88,11 @@
toolbar rows to take full advantage of this wrapping behaviour.
@endStyleTable
@beginEventEmissionTable{wxRibbonPanelEvent}
@event{EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(id, func)}
Triggered when the user activate the panel extension button.
@endEventTable
@library{wxribbon}
@category{ribbon}
*/
@@ -123,6 +163,18 @@ public:
wxBitmap& GetMinimisedIcon();
const wxBitmap& GetMinimisedIcon() const;
/**
Test if the panel has an extension button.
Such button is shown in the top right corner of the panel if
@c wxRIBBON_PANEL_EXT_BUTTON style is used for it.
@since 2.9.4
@return @true if the panel and its wxRibbonBar allow it in their styles.
*/
virtual bool HasExtButton() const;
/**
Query if the panel is currently minimised.
*/
@@ -140,6 +192,16 @@ public:
*/
bool IsHovered() const;
/**
Query if the mouse is currently hovered over the extension button.
Extension button is only shown for panels with @c
wxRIBBON_PANEL_EXT_BUTTON style.
@since 2.9.4
*/
bool IsExtButtonHovered() const;
/**
Query if the panel can automatically minimise itself at small sizes.
*/