]>
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. | |
15 | ||
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 | |
140091e5 PC |
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 | |
22 | it is recommended that ribbon and non ribbon controls are not mixed in one | |
23 | panel. | |
3c3ead1d PC |
24 | |
25 | @sa wxRibbonPage | |
26 | ||
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. | |
46 | @endStyleTable | |
47 | ||
48 | @library{wxribbon} | |
49 | @category{ribbon} | |
50 | */ | |
51 | class wxRibbonPanel : public wxRibbonControl | |
52 | { | |
53 | public: | |
54 | /** | |
55 | Default constructor. | |
56 | With this constructor, Create() should be called in order to create | |
57 | the ribbon panel. | |
58 | */ | |
59 | wxRibbonPanel(); | |
60 | ||
61 | /** | |
62 | Constructs a ribbon panel. | |
63 | ||
64 | @param parent | |
65 | Pointer to a parent window, which is typically a wxRibbonPage, | |
66 | though it can be any window. | |
67 | @param id | |
68 | Window identifier. | |
69 | @param label | |
70 | Label to be used in the wxRibbonPanel's chrome. | |
71 | @param minimised_icon | |
72 | Icon to be used in place of the panel's children when the panel | |
73 | is minimised. | |
74 | @param pos | |
75 | The initial position of the panel. Not relevant when the parent is | |
76 | a ribbon page, as the position and size of the panel will be | |
77 | dictated by the page. | |
78 | @param size | |
79 | The initial size of the panel. Not relevant when the parent is a | |
80 | ribbon page, as the position and size of the panel will be | |
81 | dictated by the page. | |
82 | @param style | |
83 | Style flags for the panel. | |
84 | */ | |
85 | wxRibbonPanel(wxWindow* parent, | |
86 | wxWindowID id = wxID_ANY, | |
87 | const wxString& label = wxEmptyString, | |
88 | const wxBitmap& minimised_icon = wxNullBitmap, | |
89 | const wxPoint& pos = wxDefaultPosition, | |
90 | const wxSize& size = wxDefaultSize, | |
91 | long style = wxRIBBON_PANEL_DEFAULT_STYLE); | |
92 | ||
93 | /** | |
94 | Create a ribbon panel in two-step ribbon panel construction. | |
95 | Should only be called when the default constructor is used, and | |
96 | arguments have the same meaning as in the full constructor. | |
97 | */ | |
98 | bool Create(wxWindow* parent, | |
99 | wxWindowID id = wxID_ANY, | |
100 | const wxString& label = wxEmptyString, | |
101 | const wxBitmap& icon = wxNullBitmap, | |
102 | const wxPoint& pos = wxDefaultPosition, | |
103 | const wxSize& size = wxDefaultSize, | |
104 | long style = wxRIBBON_PANEL_DEFAULT_STYLE); | |
105 | ||
106 | /** | |
107 | Destructor. | |
108 | */ | |
109 | virtual ~wxRibbonPanel(); | |
110 | ||
111 | /** | |
112 | Get the bitmap to be used in place of the panel children when it is | |
113 | minimised. | |
114 | */ | |
115 | wxBitmap& GetMinimisedIcon(); | |
116 | const wxBitmap& GetMinimisedIcon() const; | |
117 | ||
118 | /** | |
119 | Query if the panel is currently minimised. | |
120 | */ | |
121 | bool IsMinimised() const; | |
122 | ||
123 | /** | |
124 | Query if the panel would be minimised at a given size. | |
125 | */ | |
126 | bool IsMinimised(wxSize at_size) const; | |
127 | ||
128 | /** | |
129 | Query is the mouse is currently hovered over the panel. | |
130 | @return @true if the cursor is within the bounds of the panel (i.e. | |
131 | hovered over the panel or one of its children), @false otherwise. | |
132 | */ | |
133 | bool IsHovered() const; | |
134 | ||
135 | /** | |
136 | Query if the panel can automatically minimise itself at small sizes. | |
137 | */ | |
138 | bool CanAutoMinimise() const; | |
139 | ||
140 | /** | |
141 | Show the panel externally expanded. | |
142 | ||
143 | When a panel is minimised, it can be shown full-size in a pop-out | |
d13b34d3 | 144 | window, which is referred to as being (externally) expanded. Note that |
3c3ead1d | 145 | when a panel is expanded, there exist two panels - the original panel |
d13b34d3 | 146 | (which is referred to as the dummy panel) and the expanded panel. The |
3c3ead1d PC |
147 | original is termed a dummy as it sits in the ribbon bar doing nothing, |
148 | while the expanded panel holds the panel children. | |
149 | ||
150 | @return @true if the panel was expanded, @false if it was not (possibly | |
151 | due to it not being minimised, or already being expanded). | |
152 | ||
153 | @see HideExpanded() | |
154 | @see GetExpandedPanel() | |
155 | */ | |
156 | bool ShowExpanded(); | |
157 | ||
158 | /** | |
159 | Hide the panel's external expansion. | |
160 | ||
161 | @return @true if the panel was un-expanded, @false if it was not | |
162 | (normally due to it not being expanded in the first place). | |
163 | ||
164 | @see HideExpanded() | |
165 | @see GetExpandedPanel() | |
166 | */ | |
167 | bool HideExpanded(); | |
168 | ||
169 | /** | |
170 | Set the art provider to be used. Normally called automatically by | |
171 | wxRibbonPage when the panel is created, or the art provider changed on the | |
172 | page. | |
173 | ||
174 | The new art provider will be propagated to the children of the panel. | |
175 | */ | |
176 | void SetArtProvider(wxRibbonArtProvider* art); | |
177 | ||
178 | /** | |
179 | Realize all children of the panel. | |
180 | */ | |
181 | bool Realize(); | |
182 | ||
183 | /** | |
184 | Get the dummy panel of an expanded panel. | |
185 | ||
186 | Note that this should be called on an expanded panel to get the dummy | |
187 | associated with it - it will return NULL when called on the dummy | |
188 | itself. | |
189 | ||
190 | @see ShowExpanded() | |
191 | @see GetExpandedPanel() | |
192 | */ | |
193 | wxRibbonPanel* GetExpandedDummy(); | |
194 | ||
195 | /** | |
196 | Get the expanded panel of a dummy panel. | |
197 | ||
198 | Note that this should be called on a dummy panel to get the expanded | |
199 | panel associated with it - it will return NULL when called on the | |
200 | expanded panel itself. | |
201 | ||
202 | @see ShowExpanded() | |
203 | @see GetExpandedDummy() | |
204 | */ | |
205 | wxRibbonPanel* GetExpandedPanel(); | |
206 | }; |