1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ribbon/panel.h
3 // Purpose: interface of wxRibbonPage
4 // Author: Peter Cawley
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
12 Serves as a container for a group of (ribbon) controls. A wxRibbonPage will
13 typically have panels for children, with the controls for that page placed
16 A panel adds a border and label to a group of controls, and can be
17 minimised (either automatically to conserve space, or manually by the user).
22 @style{wxRIBBON_PANEL_DEFAULT_STYLE}
23 Defined as no other flags set.
24 @style{wxRIBBON_PANEL_NO_AUTO_MINIMISE}
25 Prevents the panel from automatically minimising to conserve screen
27 @style{wxRIBBON_PANEL_EXT_BUTTON}
28 Causes an extension button to be shown in the panel's chrome (if the
29 bar in which it is contained has wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
30 set). The behaviour of this button is application controlled, but
31 typically will show an extended drop-down menu relating to the
33 @style{wxRIBBON_PANEL_MINIMISE_BUTTON}
34 Causes a (de)minimise button to be shown in the panel's chrome (if
35 the bar in which it is contained has the
36 wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS style set). This flag is
37 typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a
38 panel which the user always has manual control over when it
45 class wxRibbonPanel
: public wxRibbonControl
50 With this constructor, Create() should be called in order to create
56 Constructs a ribbon panel.
59 Pointer to a parent window, which is typically a wxRibbonPage,
60 though it can be any window.
64 Label to be used in the wxRibbonPanel's chrome.
66 Icon to be used in place of the panel's children when the panel
69 The initial position of the panel. Not relevant when the parent is
70 a ribbon page, as the position and size of the panel will be
73 The initial size of the panel. Not relevant when the parent is a
74 ribbon page, as the position and size of the panel will be
77 Style flags for the panel.
79 wxRibbonPanel(wxWindow
* parent
,
80 wxWindowID id
= wxID_ANY
,
81 const wxString
& label
= wxEmptyString
,
82 const wxBitmap
& minimised_icon
= wxNullBitmap
,
83 const wxPoint
& pos
= wxDefaultPosition
,
84 const wxSize
& size
= wxDefaultSize
,
85 long style
= wxRIBBON_PANEL_DEFAULT_STYLE
);
88 Create a ribbon panel in two-step ribbon panel construction.
89 Should only be called when the default constructor is used, and
90 arguments have the same meaning as in the full constructor.
92 bool Create(wxWindow
* parent
,
93 wxWindowID id
= wxID_ANY
,
94 const wxString
& label
= wxEmptyString
,
95 const wxBitmap
& icon
= wxNullBitmap
,
96 const wxPoint
& pos
= wxDefaultPosition
,
97 const wxSize
& size
= wxDefaultSize
,
98 long style
= wxRIBBON_PANEL_DEFAULT_STYLE
);
103 virtual ~wxRibbonPanel();
106 Get the bitmap to be used in place of the panel children when it is
109 wxBitmap
& GetMinimisedIcon();
110 const wxBitmap
& GetMinimisedIcon() const;
113 Query if the panel is currently minimised.
115 bool IsMinimised() const;
118 Query if the panel would be minimised at a given size.
120 bool IsMinimised(wxSize at_size
) const;
123 Query is the mouse is currently hovered over the panel.
124 @return @true if the cursor is within the bounds of the panel (i.e.
125 hovered over the panel or one of its children), @false otherwise.
127 bool IsHovered() const;
130 Query if the panel can automatically minimise itself at small sizes.
132 bool CanAutoMinimise() const;
135 Show the panel externally expanded.
137 When a panel is minimised, it can be shown full-size in a pop-out
138 window, which is refered to as being (externally) expanded. Note that
139 when a panel is expanded, there exist two panels - the original panel
140 (which is refered to as the dummy panel) and the expanded panel. The
141 original is termed a dummy as it sits in the ribbon bar doing nothing,
142 while the expanded panel holds the panel children.
144 @return @true if the panel was expanded, @false if it was not (possibly
145 due to it not being minimised, or already being expanded).
148 @see GetExpandedPanel()
153 Hide the panel's external expansion.
155 @return @true if the panel was un-expanded, @false if it was not
156 (normally due to it not being expanded in the first place).
159 @see GetExpandedPanel()
164 Set the art provider to be used. Normally called automatically by
165 wxRibbonPage when the panel is created, or the art provider changed on the
168 The new art provider will be propagated to the children of the panel.
170 void SetArtProvider(wxRibbonArtProvider
* art
);
173 Realize all children of the panel.
178 Get the dummy panel of an expanded panel.
180 Note that this should be called on an expanded panel to get the dummy
181 associated with it - it will return NULL when called on the dummy
185 @see GetExpandedPanel()
187 wxRibbonPanel
* GetExpandedDummy();
190 Get the expanded panel of a dummy panel.
192 Note that this should be called on a dummy panel to get the expanded
193 panel associated with it - it will return NULL when called on the
194 expanded panel itself.
197 @see GetExpandedDummy()
199 wxRibbonPanel
* GetExpandedPanel();