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