]>
Commit | Line | Data |
---|---|---|
5279a24d RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sizer.h | |
a4ab8ed5 | 3 | // Purpose: provide wxSizer class for layout |
5279a24d | 4 | // Author: Robert Roebling and Robin Dunn |
566d84a7 | 5 | // Modified by: Ron Lee |
0c0d686f | 6 | // Created: |
5279a24d | 7 | // RCS-ID: $Id$ |
a4ab8ed5 | 8 | // Copyright: (c) Robin Dunn, Robert Roebling |
65571936 | 9 | // Licence: wxWindows licence |
5279a24d RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __WXSIZER_H__ | |
13 | #define __WXSIZER_H__ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
5279a24d RR |
16 | #pragma interface "sizer.h" |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #include "wx/window.h" | |
22 | #include "wx/frame.h" | |
23 | #include "wx/dialog.h" | |
24 | ||
25 | //--------------------------------------------------------------------------- | |
26 | // classes | |
27 | //--------------------------------------------------------------------------- | |
28 | ||
446e5259 VS |
29 | class WXDLLEXPORT wxSizerItem; |
30 | class WXDLLEXPORT wxSizer; | |
31 | class WXDLLEXPORT wxBoxSizer; | |
5279a24d RR |
32 | |
33 | //--------------------------------------------------------------------------- | |
3417c2cd | 34 | // wxSizerItem |
5279a24d RR |
35 | //--------------------------------------------------------------------------- |
36 | ||
3417c2cd | 37 | class WXDLLEXPORT wxSizerItem: public wxObject |
5279a24d RR |
38 | { |
39 | public: | |
df5ddbca | 40 | // spacer |
12a3f227 RL |
41 | wxSizerItem( int width, |
42 | int height, | |
43 | int proportion, | |
44 | int flag, | |
45 | int border, | |
46 | wxObject* userData); | |
df5ddbca RR |
47 | |
48 | // window | |
12a3f227 RL |
49 | wxSizerItem( wxWindow *window, |
50 | int proportion, | |
51 | int flag, | |
52 | int border, | |
53 | wxObject* userData ); | |
df5ddbca RR |
54 | |
55 | // subsizer | |
12a3f227 RL |
56 | wxSizerItem( wxSizer *sizer, |
57 | int proportion, | |
58 | int flag, | |
59 | int border, | |
60 | wxObject* userData ); | |
df5ddbca | 61 | |
20b35a69 RD |
62 | wxSizerItem(); |
63 | virtual ~wxSizerItem(); | |
dc259b79 | 64 | |
84f7908b | 65 | virtual void DeleteWindows(); |
df5ddbca | 66 | |
96fdbb60 RL |
67 | // Enable deleting the SizerItem without destroying the contained sizer. |
68 | void DetachSizer() | |
69 | { m_sizer = 0; } | |
70 | ||
9cbee2ce | 71 | virtual wxSize GetSize() const; |
df5ddbca RR |
72 | virtual wxSize CalcMin(); |
73 | virtual void SetDimension( wxPoint pos, wxSize size ); | |
74 | ||
9cbee2ce | 75 | wxSize GetMinSize() const |
df5ddbca | 76 | { return m_minSize; } |
ba763a45 RD |
77 | wxSize GetMinSizeWithBorder() const; |
78 | ||
1eba2193 RD |
79 | void SetMinSize(const wxSize& size) |
80 | { | |
ba763a45 | 81 | if (IsWindow()) m_window->SetMinSize(size); |
1eba2193 RD |
82 | m_minSize = size; |
83 | } | |
84 | void SetMinSize( int x, int y ) | |
85 | { SetMinSize(wxSize(x, y)); } | |
12a3f227 | 86 | void SetInitSize( int x, int y ) |
1eba2193 | 87 | { SetMinSize(wxSize(x, y)); } |
df5ddbca RR |
88 | |
89 | void SetRatio( int width, int height ) | |
90 | // if either of dimensions is zero, ratio is assumed to be 1 | |
91 | // to avoid "divide by zero" errors | |
92 | { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } | |
93 | void SetRatio( wxSize size ) | |
94 | { m_ratio = (size.x && size.y) ? ((float) size.x / (float) size.y) : 1; } | |
2aab8f16 | 95 | void SetRatio( float ratio ) |
df5ddbca | 96 | { m_ratio = ratio; } |
2aab8f16 | 97 | float GetRatio() const |
df5ddbca RR |
98 | { return m_ratio; } |
99 | ||
9cbee2ce RL |
100 | bool IsWindow() const; |
101 | bool IsSizer() const; | |
102 | bool IsSpacer() const; | |
2aab8f16 | 103 | |
12a3f227 RL |
104 | // Deprecated in 2.6, use {G,S}etProportion instead. |
105 | wxDEPRECATED( void SetOption( int option ) ); | |
106 | wxDEPRECATED( int GetOption() const ); | |
107 | ||
108 | void SetProportion( int proportion ) | |
109 | { m_proportion = proportion; } | |
110 | int GetProportion() const | |
111 | { return m_proportion; } | |
df5ddbca RR |
112 | void SetFlag( int flag ) |
113 | { m_flag = flag; } | |
12a3f227 RL |
114 | int GetFlag() const |
115 | { return m_flag; } | |
df5ddbca RR |
116 | void SetBorder( int border ) |
117 | { m_border = border; } | |
12a3f227 RL |
118 | int GetBorder() const |
119 | { return m_border; } | |
df5ddbca RR |
120 | |
121 | wxWindow *GetWindow() const | |
122 | { return m_window; } | |
123 | void SetWindow( wxWindow *window ) | |
1621c234 | 124 | { m_window = window; m_minSize = window->GetSize(); } |
df5ddbca RR |
125 | wxSizer *GetSizer() const |
126 | { return m_sizer; } | |
127 | void SetSizer( wxSizer *sizer ) | |
128 | { m_sizer = sizer; } | |
12a3f227 RL |
129 | const wxSize &GetSpacer() const |
130 | { return m_size; } | |
131 | void SetSpacer( const wxSize &size ) | |
132 | { m_size = size; m_minSize = size; } | |
133 | ||
134 | void Show ( bool show ); | |
2b5f62a0 VZ |
135 | bool IsShown() const |
136 | { return m_show; } | |
12a3f227 | 137 | |
9cbee2ce | 138 | wxObject* GetUserData() const |
df5ddbca | 139 | { return m_userData; } |
9cbee2ce | 140 | wxPoint GetPosition() const |
df5ddbca | 141 | { return m_pos; } |
0c0d686f | 142 | |
c62ac5b6 | 143 | protected: |
df5ddbca RR |
144 | wxWindow *m_window; |
145 | wxSizer *m_sizer; | |
146 | wxSize m_size; | |
147 | wxPoint m_pos; | |
148 | wxSize m_minSize; | |
12a3f227 | 149 | int m_proportion; |
df5ddbca RR |
150 | int m_border; |
151 | int m_flag; | |
2b5f62a0 | 152 | |
e0d8fb45 | 153 | // If true, then this item is considered in the layout |
dc259b79 | 154 | // calculation. Otherwise, it is skipped over. |
2b5f62a0 | 155 | bool m_show; |
12a3f227 RL |
156 | |
157 | // Aspect ratio can always be calculated from m_size, | |
158 | // but this would cause precision loss when the window | |
159 | // is shrunk. It is safer to preserve the initial value. | |
df5ddbca | 160 | float m_ratio; |
2b5f62a0 | 161 | |
df5ddbca | 162 | wxObject *m_userData; |
2aab8f16 | 163 | |
9cbee2ce | 164 | private: |
4393b50c | 165 | DECLARE_CLASS(wxSizerItem) |
22f3361e | 166 | DECLARE_NO_COPY_CLASS(wxSizerItem) |
c62ac5b6 | 167 | }; |
5279a24d | 168 | |
12a3f227 RL |
169 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); |
170 | ||
171 | ||
5279a24d | 172 | //--------------------------------------------------------------------------- |
3417c2cd | 173 | // wxSizer |
5279a24d RR |
174 | //--------------------------------------------------------------------------- |
175 | ||
2aab8f16 | 176 | class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer |
5279a24d RR |
177 | { |
178 | public: | |
f6bcfd97 BP |
179 | wxSizer(); |
180 | ~wxSizer(); | |
181 | ||
182 | /* These should be called Append() really. */ | |
12a3f227 RL |
183 | virtual void Add( wxWindow *window, |
184 | int proportion = 0, | |
185 | int flag = 0, | |
186 | int border = 0, | |
187 | wxObject* userData = NULL ); | |
188 | virtual void Add( wxSizer *sizer, | |
189 | int proportion = 0, | |
190 | int flag = 0, | |
191 | int border = 0, | |
192 | wxObject* userData = NULL ); | |
193 | virtual void Add( int width, | |
194 | int height, | |
195 | int proportion = 0, | |
196 | int flag = 0, | |
197 | int border = 0, | |
198 | wxObject* userData = NULL ); | |
199 | virtual void Add( wxSizerItem *item ); | |
200 | ||
201 | virtual void Insert( size_t index, | |
202 | wxWindow *window, | |
203 | int proportion = 0, | |
204 | int flag = 0, | |
205 | int border = 0, | |
206 | wxObject* userData = NULL ); | |
207 | virtual void Insert( size_t index, | |
208 | wxSizer *sizer, | |
209 | int proportion = 0, | |
210 | int flag = 0, | |
211 | int border = 0, | |
212 | wxObject* userData = NULL ); | |
213 | virtual void Insert( size_t index, | |
214 | int width, | |
215 | int height, | |
216 | int proportion = 0, | |
217 | int flag = 0, | |
218 | int border = 0, | |
219 | wxObject* userData = NULL ); | |
220 | virtual void Insert( size_t index, | |
221 | wxSizerItem *item ); | |
222 | ||
223 | virtual void Prepend( wxWindow *window, | |
224 | int proportion = 0, | |
225 | int flag = 0, | |
226 | int border = 0, | |
227 | wxObject* userData = NULL ); | |
228 | virtual void Prepend( wxSizer *sizer, | |
229 | int proportion = 0, | |
230 | int flag = 0, | |
231 | int border = 0, | |
232 | wxObject* userData = NULL ); | |
233 | virtual void Prepend( int width, | |
234 | int height, | |
235 | int proportion = 0, | |
236 | int flag = 0, | |
237 | int border = 0, | |
238 | wxObject* userData = NULL ); | |
239 | virtual void Prepend( wxSizerItem *item ); | |
240 | ||
241 | // Deprecated in 2.6 since historically it does not delete the window, | |
242 | // use Detach instead. | |
243 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
f6bcfd97 | 244 | virtual bool Remove( wxSizer *sizer ); |
e0d8fb45 | 245 | virtual bool Remove( int index ); |
00976fe5 | 246 | |
12a3f227 | 247 | virtual bool Detach( wxWindow *window ); |
00976fe5 | 248 | virtual bool Detach( wxSizer *sizer ); |
e0d8fb45 | 249 | virtual bool Detach( int index ); |
00976fe5 | 250 | |
e0d8fb45 | 251 | virtual void Clear( bool delete_windows = false ); |
84f7908b | 252 | virtual void DeleteWindows(); |
f6bcfd97 BP |
253 | |
254 | void SetMinSize( int width, int height ) | |
255 | { DoSetMinSize( width, height ); } | |
256 | void SetMinSize( wxSize size ) | |
257 | { DoSetMinSize( size.x, size.y ); } | |
1e6feb95 | 258 | |
f6bcfd97 BP |
259 | /* Searches recursively */ |
260 | bool SetItemMinSize( wxWindow *window, int width, int height ) | |
261 | { return DoSetItemMinSize( window, width, height ); } | |
262 | bool SetItemMinSize( wxWindow *window, wxSize size ) | |
263 | { return DoSetItemMinSize( window, size.x, size.y ); } | |
1e6feb95 | 264 | |
f6bcfd97 BP |
265 | /* Searches recursively */ |
266 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) | |
267 | { return DoSetItemMinSize( sizer, width, height ); } | |
268 | bool SetItemMinSize( wxSizer *sizer, wxSize size ) | |
269 | { return DoSetItemMinSize( sizer, size.x, size.y ); } | |
1e6feb95 | 270 | |
12a3f227 RL |
271 | bool SetItemMinSize( size_t index, int width, int height ) |
272 | { return DoSetItemMinSize( index, width, height ); } | |
273 | bool SetItemMinSize( size_t index, wxSize size ) | |
274 | { return DoSetItemMinSize( index, size.x, size.y ); } | |
1e6feb95 | 275 | |
9cbee2ce | 276 | wxSize GetSize() const |
f6bcfd97 | 277 | { return m_size; } |
9cbee2ce | 278 | wxPoint GetPosition() const |
f6bcfd97 | 279 | { return m_position; } |
1e6feb95 | 280 | |
f6bcfd97 BP |
281 | /* Calculate the minimal size or return m_minSize if bigger. */ |
282 | wxSize GetMinSize(); | |
283 | ||
284 | virtual void RecalcSizes() = 0; | |
285 | virtual wxSize CalcMin() = 0; | |
286 | ||
287 | virtual void Layout(); | |
288 | ||
e5251d4f | 289 | wxSize Fit( wxWindow *window ); |
566d84a7 | 290 | void FitInside( wxWindow *window ); |
f6bcfd97 | 291 | void SetSizeHints( wxWindow *window ); |
566d84a7 | 292 | void SetVirtualSizeHints( wxWindow *window ); |
f6bcfd97 | 293 | |
12a3f227 | 294 | wxSizerItemList& GetChildren() |
f6bcfd97 BP |
295 | { return m_children; } |
296 | ||
297 | void SetDimension( int x, int y, int width, int height ); | |
0c0d686f | 298 | |
12a3f227 | 299 | // Manage whether individual scene items are considered |
2b5f62a0 | 300 | // in the layout calculations or not. |
e0d8fb45 VZ |
301 | void Show( wxWindow *window, bool show = true ); |
302 | void Show( wxSizer *sizer, bool show = true ); | |
303 | void Show( size_t index, bool show = true ); | |
12a3f227 | 304 | |
2b5f62a0 | 305 | void Hide( wxSizer *sizer ) |
e0d8fb45 | 306 | { Show( sizer, false ); } |
12a3f227 | 307 | void Hide( wxWindow *window ) |
e0d8fb45 | 308 | { Show( window, false ); } |
12a3f227 | 309 | void Hide( size_t index ) |
e0d8fb45 | 310 | { Show( index, false ); } |
2b5f62a0 | 311 | |
9cbee2ce RL |
312 | bool IsShown( wxWindow *window ) const; |
313 | bool IsShown( wxSizer *sizer ) const; | |
314 | bool IsShown( size_t index ) const; | |
dc259b79 | 315 | |
2b5f62a0 | 316 | // Recursively call wxWindow::Show () on all sizer items. |
eb2a7883 | 317 | virtual void ShowItems (bool show); |
2b5f62a0 | 318 | |
f6bcfd97 | 319 | protected: |
12a3f227 RL |
320 | wxSize m_size; |
321 | wxSize m_minSize; | |
322 | wxPoint m_position; | |
323 | wxSizerItemList m_children; | |
f6bcfd97 | 324 | |
9cbee2ce | 325 | wxSize GetMaxWindowSize( wxWindow *window ) const; |
f6bcfd97 | 326 | wxSize GetMinWindowSize( wxWindow *window ); |
9cbee2ce | 327 | wxSize GetMaxClientSize( wxWindow *window ) const; |
566d84a7 | 328 | wxSize GetMinClientSize( wxWindow *window ); |
65ba4113 | 329 | wxSize FitSize( wxWindow *window ); |
566d84a7 | 330 | wxSize VirtualFitSize( wxWindow *window ); |
65ba4113 | 331 | |
f6bcfd97 BP |
332 | virtual void DoSetMinSize( int width, int height ); |
333 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
334 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
12a3f227 | 335 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); |
1e6feb95 | 336 | |
9cbee2ce | 337 | private: |
4393b50c | 338 | DECLARE_CLASS(wxSizer) |
f6bcfd97 | 339 | }; |
c62ac5b6 | 340 | |
f6bcfd97 BP |
341 | //--------------------------------------------------------------------------- |
342 | // wxGridSizer | |
343 | //--------------------------------------------------------------------------- | |
0c0d686f | 344 | |
f6bcfd97 BP |
345 | class WXDLLEXPORT wxGridSizer: public wxSizer |
346 | { | |
347 | public: | |
348 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
349 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
1e6feb95 | 350 | |
5d76f462 VZ |
351 | virtual void RecalcSizes(); |
352 | virtual wxSize CalcMin(); | |
f6bcfd97 BP |
353 | |
354 | void SetCols( int cols ) { m_cols = cols; } | |
355 | void SetRows( int rows ) { m_rows = rows; } | |
356 | void SetVGap( int gap ) { m_vgap = gap; } | |
357 | void SetHGap( int gap ) { m_hgap = gap; } | |
9cbee2ce RL |
358 | int GetCols() const { return m_cols; } |
359 | int GetRows() const { return m_rows; } | |
360 | int GetVGap() const { return m_vgap; } | |
361 | int GetHGap() const { return m_hgap; } | |
1e6feb95 | 362 | |
f6bcfd97 BP |
363 | protected: |
364 | int m_rows; | |
365 | int m_cols; | |
366 | int m_vgap; | |
367 | int m_hgap; | |
1e6feb95 | 368 | |
0ca5105b VZ |
369 | // return the number of total items and the number of columns and rows |
370 | int CalcRowsCols(int& rows, int& cols) const; | |
371 | ||
f6bcfd97 | 372 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); |
1e6feb95 | 373 | |
9cbee2ce | 374 | private: |
4393b50c | 375 | DECLARE_CLASS(wxGridSizer) |
f6bcfd97 | 376 | }; |
5279a24d | 377 | |
f6bcfd97 BP |
378 | //--------------------------------------------------------------------------- |
379 | // wxFlexGridSizer | |
380 | //--------------------------------------------------------------------------- | |
0c0d686f | 381 | |
5d76f462 VZ |
382 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" |
383 | // direction | |
384 | enum wxFlexSizerGrowMode | |
385 | { | |
386 | // don't resize the cells in non-flexible direction at all | |
387 | wxFLEX_GROWMODE_NONE, | |
388 | ||
389 | // uniformly resize only the specified ones (default) | |
390 | wxFLEX_GROWMODE_SPECIFIED, | |
391 | ||
392 | // uniformly resize all cells | |
393 | wxFLEX_GROWMODE_ALL | |
394 | }; | |
395 | ||
f6bcfd97 BP |
396 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer |
397 | { | |
398 | public: | |
5d76f462 | 399 | // ctors/dtor |
f6bcfd97 BP |
400 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); |
401 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
5d76f462 | 402 | virtual ~wxFlexGridSizer(); |
1e6feb95 | 403 | |
1e6feb95 | 404 | |
5d76f462 VZ |
405 | // set the rows/columns which will grow (the others will remain of the |
406 | // constant initial size) | |
e8800dcf | 407 | void AddGrowableRow( size_t idx, int proportion = 0 ); |
f6bcfd97 | 408 | void RemoveGrowableRow( size_t idx ); |
e8800dcf | 409 | void AddGrowableCol( size_t idx, int proportion = 0 ); |
f6bcfd97 | 410 | void RemoveGrowableCol( size_t idx ); |
0c0d686f | 411 | |
1e6feb95 | 412 | |
5d76f462 VZ |
413 | // the sizer cells may grow in both directions, not grow at all or only |
414 | // grow in one direction but not the other | |
415 | ||
416 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
417 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
418 | int GetFlexibleDirection() const { return m_flexDirection; } | |
419 | ||
420 | // note that the grow mode only applies to the direction which is not | |
421 | // flexible | |
422 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
423 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
424 | ||
fc1fcd0e RD |
425 | // Read-only access to the row heights and col widths arrays |
426 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
427 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
428 | ||
5d76f462 VZ |
429 | // implementation |
430 | virtual void RecalcSizes(); | |
431 | virtual wxSize CalcMin(); | |
432 | ||
433 | protected: | |
20b35a69 RD |
434 | void AdjustForFlexDirection(); |
435 | void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, | |
436 | int nrows, int ncols); | |
437 | ||
5d76f462 VZ |
438 | // the heights/widths of all rows/columns |
439 | wxArrayInt m_rowHeights, | |
440 | m_colWidths; | |
441 | ||
442 | // indices of the growable columns and rows | |
443 | wxArrayInt m_growableRows, | |
444 | m_growableCols; | |
445 | ||
e8800dcf VZ |
446 | // proportion values of the corresponding growable rows and columns |
447 | wxArrayInt m_growableRowsProportions, | |
448 | m_growableColsProportions; | |
449 | ||
5d76f462 VZ |
450 | // parameters describing whether the growable cells should be resized in |
451 | // both directions or only one | |
452 | int m_flexDirection; | |
453 | wxFlexSizerGrowMode m_growMode; | |
1e6feb95 | 454 | |
ba763a45 RD |
455 | // saves CalcMin result to optimize RecalcSizes |
456 | wxSize m_calculatedMinSize; | |
457 | ||
9cbee2ce | 458 | private: |
4393b50c | 459 | DECLARE_CLASS(wxFlexGridSizer) |
22f3361e | 460 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) |
c62ac5b6 RR |
461 | }; |
462 | ||
463 | //--------------------------------------------------------------------------- | |
92afa2b1 | 464 | // wxBoxSizer |
c62ac5b6 RR |
465 | //--------------------------------------------------------------------------- |
466 | ||
92afa2b1 | 467 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
468 | { |
469 | public: | |
f6bcfd97 | 470 | wxBoxSizer( int orient ); |
0c0d686f | 471 | |
f6bcfd97 BP |
472 | void RecalcSizes(); |
473 | wxSize CalcMin(); | |
0c0d686f | 474 | |
9cbee2ce | 475 | int GetOrientation() const |
f6bcfd97 | 476 | { return m_orient; } |
0c0d686f | 477 | |
b657b4c9 JS |
478 | void SetOrientation(int orient) |
479 | { m_orient = orient; } | |
480 | ||
61d514bb RR |
481 | protected: |
482 | int m_orient; | |
483 | int m_stretchable; | |
484 | int m_minWidth; | |
485 | int m_minHeight; | |
486 | int m_fixedWidth; | |
487 | int m_fixedHeight; | |
1e6feb95 | 488 | |
9cbee2ce | 489 | private: |
4393b50c | 490 | DECLARE_CLASS(wxBoxSizer) |
61d514bb | 491 | }; |
0c0d686f | 492 | |
27ea1d8a RR |
493 | //--------------------------------------------------------------------------- |
494 | // wxStaticBoxSizer | |
495 | //--------------------------------------------------------------------------- | |
496 | ||
1e6feb95 VZ |
497 | #if wxUSE_STATBOX |
498 | ||
499 | class WXDLLEXPORT wxStaticBox; | |
500 | ||
27ea1d8a RR |
501 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer |
502 | { | |
503 | public: | |
f6bcfd97 | 504 | wxStaticBoxSizer( wxStaticBox *box, int orient ); |
0c0d686f | 505 | |
f6bcfd97 BP |
506 | void RecalcSizes(); |
507 | wxSize CalcMin(); | |
0c0d686f | 508 | |
9cbee2ce | 509 | wxStaticBox *GetStaticBox() const |
f6bcfd97 | 510 | { return m_staticBox; } |
0c0d686f | 511 | |
eb2a7883 VZ |
512 | // override to hide/show the static box as well |
513 | virtual void ShowItems (bool show); | |
514 | ||
27ea1d8a | 515 | protected: |
f6bcfd97 | 516 | wxStaticBox *m_staticBox; |
1e6feb95 | 517 | |
9cbee2ce | 518 | private: |
4393b50c | 519 | DECLARE_CLASS(wxStaticBoxSizer) |
22f3361e | 520 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) |
27ea1d8a RR |
521 | }; |
522 | ||
1e6feb95 VZ |
523 | #endif // wxUSE_STATBOX |
524 | ||
adbf2d73 VS |
525 | |
526 | #if WXWIN_COMPATIBILITY_2_4 | |
527 | // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they | |
528 | // don't do anything. wxBookCtrl::DoGetBestSize does the job now. | |
529 | ||
ade4eb65 VZ |
530 | // ---------------------------------------------------------------------------- |
531 | // wxBookCtrlSizer | |
532 | // ---------------------------------------------------------------------------- | |
83edc0a5 | 533 | |
ade4eb65 | 534 | #if wxUSE_BOOKCTRL |
65e4f9b9 | 535 | |
ade4eb65 VZ |
536 | // this sizer works with wxNotebook/wxListbook/... and sizes the control to |
537 | // fit its pages | |
538 | class WXDLLEXPORT wxBookCtrl; | |
1e6feb95 | 539 | |
ade4eb65 | 540 | class WXDLLEXPORT wxBookCtrlSizer : public wxSizer |
83edc0a5 | 541 | { |
83edc0a5 | 542 | public: |
adbf2d73 | 543 | wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) ); |
83edc0a5 | 544 | |
adbf2d73 VS |
545 | wxBookCtrl *GetControl() const { return m_bookctrl; } |
546 | ||
ade4eb65 VZ |
547 | virtual void RecalcSizes(); |
548 | virtual wxSize CalcMin(); | |
83edc0a5 | 549 | |
83edc0a5 | 550 | protected: |
adbf2d73 VS |
551 | // this protected ctor lets us mark the real one above as deprecated |
552 | // and still has warning-free build of the library itself: | |
553 | wxBookCtrlSizer() {} | |
554 | ||
ade4eb65 VZ |
555 | wxBookCtrl *m_bookctrl; |
556 | ||
557 | private: | |
558 | DECLARE_CLASS(wxBookCtrlSizer) | |
559 | DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) | |
560 | }; | |
561 | ||
562 | ||
563 | #if wxUSE_NOTEBOOK | |
564 | ||
565 | // before wxBookCtrl we only had wxNotebookSizer, keep it for backwards | |
566 | // compatibility | |
567 | class WXDLLEXPORT wxNotebook; | |
568 | ||
569 | class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer | |
570 | { | |
571 | public: | |
adbf2d73 | 572 | wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); |
ade4eb65 VZ |
573 | |
574 | wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } | |
1e6feb95 | 575 | |
9cbee2ce | 576 | private: |
4393b50c | 577 | DECLARE_CLASS(wxNotebookSizer) |
22f3361e | 578 | DECLARE_NO_COPY_CLASS(wxNotebookSizer) |
83edc0a5 RR |
579 | }; |
580 | ||
1e6feb95 | 581 | #endif // wxUSE_NOTEBOOK |
65e4f9b9 | 582 | |
ade4eb65 VZ |
583 | #endif // wxUSE_BOOKCTRL |
584 | ||
adbf2d73 VS |
585 | #endif // WXWIN_COMPATIBILITY_2_4 |
586 | ||
587 | ||
ade4eb65 | 588 | #endif // __WXSIZER_H__ |
65e4f9b9 | 589 |