]>
Commit | Line | Data |
---|---|---|
3c3ead1d PC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: ribbon/panel.h | |
3 | // Purpose: interface of wxRibbonPage | |
4 | // Author: Peter Cawley | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | /////////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxRibbonPanel | |
11 | ||
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 | |
14 | on the panels. | |
8d3d5f06 | 15 | |
3c3ead1d PC |
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). | |
b95d4051 | 18 | |
8d3d5f06 JS |
19 | Non ribbon controls can be placed on a panel using wxSizers to manage |
20 | layout. Panel size is governed by the sizer's minimum calculated size and | |
21 | the parent wxRibbonPage's dimensions. For functional and aesthetic reasons | |
140091e5 PC |
22 | it is recommended that ribbon and non ribbon controls are not mixed in one |
23 | panel. | |
8d3d5f06 | 24 | |
3c3ead1d | 25 | @sa wxRibbonPage |
8d3d5f06 | 26 | |
3c3ead1d PC |
27 | @beginStyleTable |
28 | @style{wxRIBBON_PANEL_DEFAULT_STYLE} | |
29 | Defined as no other flags set. | |
30 | @style{wxRIBBON_PANEL_NO_AUTO_MINIMISE} | |
31 | Prevents the panel from automatically minimising to conserve screen | |
32 | space. | |
33 | @style{wxRIBBON_PANEL_EXT_BUTTON} | |
34 | Causes an extension button to be shown in the panel's chrome (if the | |
35 | bar in which it is contained has wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS | |
36 | set). The behaviour of this button is application controlled, but | |
37 | typically will show an extended drop-down menu relating to the | |
38 | panel. | |
39 | @style{wxRIBBON_PANEL_MINIMISE_BUTTON} | |
40 | Causes a (de)minimise button to be shown in the panel's chrome (if | |
41 | the bar in which it is contained has the | |
42 | wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS style set). This flag is | |
43 | typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a | |
44 | panel which the user always has manual control over when it | |
45 | minimises. | |
8d3d5f06 JS |
46 | @style{wxRIBBON_PANEL_STRETCH} |
47 | Stretches a single panel to fit the parent page. | |
3c3ead1d PC |
48 | @endStyleTable |
49 | ||
50 | @library{wxribbon} | |
51 | @category{ribbon} | |
52 | */ | |
53 | class wxRibbonPanel : public wxRibbonControl | |
54 | { | |
55 | public: | |
56 | /** | |
8d3d5f06 | 57 | Default constructor. |
3c3ead1d PC |
58 | With this constructor, Create() should be called in order to create |
59 | the ribbon panel. | |
60 | */ | |
61 | wxRibbonPanel(); | |
62 | ||
63 | /** | |
64 | Constructs a ribbon panel. | |
8d3d5f06 | 65 | |
3c3ead1d PC |
66 | @param parent |
67 | Pointer to a parent window, which is typically a wxRibbonPage, | |
68 | though it can be any window. | |
69 | @param id | |
70 | Window identifier. | |
71 | @param label | |
72 | Label to be used in the wxRibbonPanel's chrome. | |
73 | @param minimised_icon | |
74 | Icon to be used in place of the panel's children when the panel | |
75 | is minimised. | |
76 | @param pos | |
77 | The initial position of the panel. Not relevant when the parent is | |
78 | a ribbon page, as the position and size of the panel will be | |
79 | dictated by the page. | |
80 | @param size | |
81 | The initial size of the panel. Not relevant when the parent is a | |
82 | ribbon page, as the position and size of the panel will be | |
83 | dictated by the page. | |
84 | @param style | |
85 | Style flags for the panel. | |
86 | */ | |
87 | wxRibbonPanel(wxWindow* parent, | |
88 | wxWindowID id = wxID_ANY, | |
89 | const wxString& label = wxEmptyString, | |
90 | const wxBitmap& minimised_icon = wxNullBitmap, | |
91 | const wxPoint& pos = wxDefaultPosition, | |
92 | const wxSize& size = wxDefaultSize, | |
93 | long style = wxRIBBON_PANEL_DEFAULT_STYLE); | |
8d3d5f06 | 94 | |
3c3ead1d PC |
95 | /** |
96 | Create a ribbon panel in two-step ribbon panel construction. | |
97 | Should only be called when the default constructor is used, and | |
98 | arguments have the same meaning as in the full constructor. | |
99 | */ | |
100 | bool Create(wxWindow* parent, | |
101 | wxWindowID id = wxID_ANY, | |
102 | const wxString& label = wxEmptyString, | |
103 | const wxBitmap& icon = wxNullBitmap, | |
104 | const wxPoint& pos = wxDefaultPosition, | |
105 | const wxSize& size = wxDefaultSize, | |
106 | long style = wxRIBBON_PANEL_DEFAULT_STYLE); | |
107 | ||
108 | /** | |
109 | Destructor. | |
110 | */ | |
111 | virtual ~wxRibbonPanel(); | |
112 | ||
113 | /** | |
114 | Get the bitmap to be used in place of the panel children when it is | |
115 | minimised. | |
116 | */ | |
117 | wxBitmap& GetMinimisedIcon(); | |
118 | const wxBitmap& GetMinimisedIcon() const; | |
8d3d5f06 | 119 | |
3c3ead1d PC |
120 | /** |
121 | Query if the panel is currently minimised. | |
122 | */ | |
123 | bool IsMinimised() const; | |
8d3d5f06 | 124 | |
3c3ead1d PC |
125 | /** |
126 | Query if the panel would be minimised at a given size. | |
127 | */ | |
128 | bool IsMinimised(wxSize at_size) const; | |
8d3d5f06 | 129 | |
3c3ead1d PC |
130 | /** |
131 | Query is the mouse is currently hovered over the panel. | |
132 | @return @true if the cursor is within the bounds of the panel (i.e. | |
133 | hovered over the panel or one of its children), @false otherwise. | |
134 | */ | |
135 | bool IsHovered() const; | |
8d3d5f06 | 136 | |
3c3ead1d PC |
137 | /** |
138 | Query if the panel can automatically minimise itself at small sizes. | |
139 | */ | |
140 | bool CanAutoMinimise() const; | |
8d3d5f06 | 141 | |
3c3ead1d PC |
142 | /** |
143 | Show the panel externally expanded. | |
8d3d5f06 | 144 | |
3c3ead1d | 145 | When a panel is minimised, it can be shown full-size in a pop-out |
d13b34d3 | 146 | window, which is referred to as being (externally) expanded. Note that |
3c3ead1d | 147 | when a panel is expanded, there exist two panels - the original panel |
d13b34d3 | 148 | (which is referred to as the dummy panel) and the expanded panel. The |
3c3ead1d PC |
149 | original is termed a dummy as it sits in the ribbon bar doing nothing, |
150 | while the expanded panel holds the panel children. | |
8d3d5f06 | 151 | |
3c3ead1d PC |
152 | @return @true if the panel was expanded, @false if it was not (possibly |
153 | due to it not being minimised, or already being expanded). | |
8d3d5f06 | 154 | |
3c3ead1d PC |
155 | @see HideExpanded() |
156 | @see GetExpandedPanel() | |
157 | */ | |
158 | bool ShowExpanded(); | |
8d3d5f06 | 159 | |
3c3ead1d PC |
160 | /** |
161 | Hide the panel's external expansion. | |
8d3d5f06 | 162 | |
3c3ead1d PC |
163 | @return @true if the panel was un-expanded, @false if it was not |
164 | (normally due to it not being expanded in the first place). | |
8d3d5f06 | 165 | |
3c3ead1d PC |
166 | @see HideExpanded() |
167 | @see GetExpandedPanel() | |
168 | */ | |
169 | bool HideExpanded(); | |
170 | ||
171 | /** | |
172 | Set the art provider to be used. Normally called automatically by | |
173 | wxRibbonPage when the panel is created, or the art provider changed on the | |
174 | page. | |
8d3d5f06 | 175 | |
3c3ead1d PC |
176 | The new art provider will be propagated to the children of the panel. |
177 | */ | |
178 | void SetArtProvider(wxRibbonArtProvider* art); | |
8d3d5f06 | 179 | |
3c3ead1d PC |
180 | /** |
181 | Realize all children of the panel. | |
182 | */ | |
183 | bool Realize(); | |
8d3d5f06 | 184 | |
3c3ead1d PC |
185 | /** |
186 | Get the dummy panel of an expanded panel. | |
8d3d5f06 | 187 | |
3c3ead1d PC |
188 | Note that this should be called on an expanded panel to get the dummy |
189 | associated with it - it will return NULL when called on the dummy | |
190 | itself. | |
8d3d5f06 | 191 | |
3c3ead1d PC |
192 | @see ShowExpanded() |
193 | @see GetExpandedPanel() | |
194 | */ | |
195 | wxRibbonPanel* GetExpandedDummy(); | |
8d3d5f06 | 196 | |
3c3ead1d PC |
197 | /** |
198 | Get the expanded panel of a dummy panel. | |
8d3d5f06 | 199 | |
3c3ead1d PC |
200 | Note that this should be called on a dummy panel to get the expanded |
201 | panel associated with it - it will return NULL when called on the | |
202 | expanded panel itself. | |
8d3d5f06 | 203 | |
3c3ead1d PC |
204 | @see ShowExpanded() |
205 | @see GetExpandedDummy() | |
206 | */ | |
207 | wxRibbonPanel* GetExpandedPanel(); | |
208 | }; |