]> git.saurik.com Git - wxWidgets.git/blame - include/wx/sizer.h
MutexGui calls in WakeUpIdle are not needed under GTK2, fixing the long-standing...
[wxWidgets.git] / include / wx / sizer.h
CommitLineData
5279a24d
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: sizer.h
a4ab8ed5 3// Purpose: provide wxSizer class for layout
5279a24d 4// Author: Robert Roebling and Robin Dunn
5f813ad6 5// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags)
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
30class WXDLLEXPORT wxSizerItem;
31class WXDLLEXPORT wxSizer;
32class WXDLLEXPORT wxBoxSizer;
5279a24d 33
5f813ad6
VZ
34
35// ----------------------------------------------------------------------------
36// wxSizerFlags: flags used for an item in the sizer
37// ----------------------------------------------------------------------------
38
39class WXDLLEXPORT wxSizerFlags
40{
41public:
42 // construct the flags object initialized with the given proportion (0 by
43 // default)
44 wxSizerFlags(int proportion = 0) : m_proportion(proportion)
45 {
46 m_flags = 0;
47 m_borderInPixels = 0;
48 }
49
50 // setters for all sizer flags, they all return the object itself so that
51 // calls to them can be chained
52
53 wxSizerFlags& Proportion(int proportion)
54 {
55 m_proportion = proportion;
56 return *this;
57 }
58
59 wxSizerFlags& Align(int alignment) // combination of wxAlignment values
60 {
61 m_flags &= wxALL;
62 m_flags |= alignment;
63
64 return *this;
65 }
66
67 // some shortcuts for Align()
68 wxSizerFlags& Expand() { return Align(wxEXPAND); }
69 wxSizerFlags& Centre() { return Align(wxCENTRE); }
70 wxSizerFlags& Center() { return Centre(); }
71
72
73 wxSizerFlags& Border(int direction, int borderInPixels)
74 {
75 m_flags &= ~wxALL;
76 m_flags |= direction;
77
78 m_borderInPixels = borderInPixels;
79
80 return *this;
81 }
82
83 wxSizerFlags& Border(int direction = wxALL)
84 {
85 // FIXME: default border size shouldn't be hardcoded
86 return Border(direction, 5);
87 }
88
89
90 // accessors for wxSizer only
91 int GetProportion() const { return m_proportion; }
92 int GetFlags() const { return m_flags; }
93 int GetBorderInPixels() const { return m_borderInPixels; }
94
95private:
96 int m_proportion;
97 int m_flags;
98 int m_borderInPixels;
99};
100
101
5279a24d 102//---------------------------------------------------------------------------
3417c2cd 103// wxSizerItem
5279a24d
RR
104//---------------------------------------------------------------------------
105
3417c2cd 106class WXDLLEXPORT wxSizerItem: public wxObject
5279a24d
RR
107{
108public:
5f813ad6
VZ
109 // window with flags
110 wxSizerItem(wxWindow *window, const wxSizerFlags& flags)
111 {
112 Init(flags);
113
114 m_window = window;
115 }
116
117 // sizer with flags
118 wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags)
119 {
120 Init(flags);
121
122 m_sizer = sizer;
123 }
df5ddbca
RR
124
125 // window
12a3f227
RL
126 wxSizerItem( wxWindow *window,
127 int proportion,
128 int flag,
129 int border,
130 wxObject* userData );
df5ddbca
RR
131
132 // subsizer
12a3f227
RL
133 wxSizerItem( wxSizer *sizer,
134 int proportion,
135 int flag,
136 int border,
137 wxObject* userData );
df5ddbca 138
5f813ad6
VZ
139 // spacer
140 wxSizerItem( int width,
141 int height,
142 int proportion,
143 int flag,
144 int border,
145 wxObject* userData);
146
20b35a69
RD
147 wxSizerItem();
148 virtual ~wxSizerItem();
dc259b79 149
84f7908b 150 virtual void DeleteWindows();
df5ddbca 151
96fdbb60
RL
152 // Enable deleting the SizerItem without destroying the contained sizer.
153 void DetachSizer()
154 { m_sizer = 0; }
155
9cbee2ce 156 virtual wxSize GetSize() const;
df5ddbca
RR
157 virtual wxSize CalcMin();
158 virtual void SetDimension( wxPoint pos, wxSize size );
159
9cbee2ce 160 wxSize GetMinSize() const
df5ddbca 161 { return m_minSize; }
ba763a45
RD
162 wxSize GetMinSizeWithBorder() const;
163
1eba2193
RD
164 void SetMinSize(const wxSize& size)
165 {
ba763a45 166 if (IsWindow()) m_window->SetMinSize(size);
8b2bac62 167 m_minSize = size;
1eba2193
RD
168 }
169 void SetMinSize( int x, int y )
8b2bac62 170 { SetMinSize(wxSize(x, y)); }
12a3f227 171 void SetInitSize( int x, int y )
1eba2193 172 { SetMinSize(wxSize(x, y)); }
df5ddbca
RR
173
174 void SetRatio( int width, int height )
175 // if either of dimensions is zero, ratio is assumed to be 1
176 // to avoid "divide by zero" errors
177 { m_ratio = (width && height) ? ((float) width / (float) height) : 1; }
178 void SetRatio( wxSize size )
179 { m_ratio = (size.x && size.y) ? ((float) size.x / (float) size.y) : 1; }
2aab8f16 180 void SetRatio( float ratio )
df5ddbca 181 { m_ratio = ratio; }
2aab8f16 182 float GetRatio() const
df5ddbca
RR
183 { return m_ratio; }
184
9cbee2ce
RL
185 bool IsWindow() const;
186 bool IsSizer() const;
187 bool IsSpacer() const;
2aab8f16 188
12a3f227
RL
189 // Deprecated in 2.6, use {G,S}etProportion instead.
190 wxDEPRECATED( void SetOption( int option ) );
191 wxDEPRECATED( int GetOption() const );
192
193 void SetProportion( int proportion )
194 { m_proportion = proportion; }
195 int GetProportion() const
196 { return m_proportion; }
df5ddbca
RR
197 void SetFlag( int flag )
198 { m_flag = flag; }
12a3f227
RL
199 int GetFlag() const
200 { return m_flag; }
df5ddbca
RR
201 void SetBorder( int border )
202 { m_border = border; }
12a3f227
RL
203 int GetBorder() const
204 { return m_border; }
df5ddbca
RR
205
206 wxWindow *GetWindow() const
207 { return m_window; }
208 void SetWindow( wxWindow *window )
1621c234 209 { m_window = window; m_minSize = window->GetSize(); }
df5ddbca
RR
210 wxSizer *GetSizer() const
211 { return m_sizer; }
212 void SetSizer( wxSizer *sizer )
213 { m_sizer = sizer; }
12a3f227
RL
214 const wxSize &GetSpacer() const
215 { return m_size; }
216 void SetSpacer( const wxSize &size )
217 { m_size = size; m_minSize = size; }
218
219 void Show ( bool show );
2b5f62a0
VZ
220 bool IsShown() const
221 { return m_show; }
12a3f227 222
9cbee2ce 223 wxObject* GetUserData() const
df5ddbca 224 { return m_userData; }
9cbee2ce 225 wxPoint GetPosition() const
df5ddbca 226 { return m_pos; }
0c0d686f 227
c62ac5b6 228protected:
5f813ad6
VZ
229 // common part of several ctors
230 void Init();
231
232 // common part of ctors taking wxSizerFlags
233 void Init(const wxSizerFlags& flags);
234
235
df5ddbca
RR
236 wxWindow *m_window;
237 wxSizer *m_sizer;
238 wxSize m_size;
239 wxPoint m_pos;
240 wxSize m_minSize;
12a3f227 241 int m_proportion;
df5ddbca
RR
242 int m_border;
243 int m_flag;
2b5f62a0 244
e0d8fb45 245 // If true, then this item is considered in the layout
dc259b79 246 // calculation. Otherwise, it is skipped over.
2b5f62a0 247 bool m_show;
12a3f227
RL
248
249 // Aspect ratio can always be calculated from m_size,
250 // but this would cause precision loss when the window
251 // is shrunk. It is safer to preserve the initial value.
df5ddbca 252 float m_ratio;
2b5f62a0 253
df5ddbca 254 wxObject *m_userData;
2aab8f16 255
9cbee2ce 256private:
4393b50c 257 DECLARE_CLASS(wxSizerItem)
22f3361e 258 DECLARE_NO_COPY_CLASS(wxSizerItem)
c62ac5b6 259};
5279a24d 260
12a3f227
RL
261WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
262
5f813ad6 263
5279a24d 264//---------------------------------------------------------------------------
3417c2cd 265// wxSizer
5279a24d
RR
266//---------------------------------------------------------------------------
267
2aab8f16 268class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer
5279a24d
RR
269{
270public:
f6bcfd97
BP
271 wxSizer();
272 ~wxSizer();
273
436ae7cf
VZ
274 // methods for adding elements to the sizer: there are Add/Insert/Prepend
275 // overloads for each of window/sizer/spacer/wxSizerItem
8e32ea1c
VZ
276 inline void Add( wxWindow *window,
277 int proportion = 0,
278 int flag = 0,
279 int border = 0,
280 wxObject* userData = NULL );
281 inline void Add( wxSizer *sizer,
282 int proportion = 0,
283 int flag = 0,
284 int border = 0,
285 wxObject* userData = NULL );
286 inline void Add( int width,
287 int height,
288 int proportion = 0,
289 int flag = 0,
290 int border = 0,
291 wxObject* userData = NULL );
5f813ad6
VZ
292 inline void Add( wxWindow *window, const wxSizerFlags& flags );
293 inline void Add( wxSizer *sizer, const wxSizerFlags& flags );
8e32ea1c
VZ
294 inline void Add( wxSizerItem *item );
295
296 inline void AddSpacer(int size);
297 inline void AddStretchSpacer(int prop = 1);
298
299 inline void Insert( size_t index,
300 wxWindow *window,
301 int proportion = 0,
302 int flag = 0,
303 int border = 0,
304 wxObject* userData = NULL );
305 inline void Insert( size_t index,
306 wxSizer *sizer,
307 int proportion = 0,
308 int flag = 0,
309 int border = 0,
310 wxObject* userData = NULL );
311 inline void Insert( size_t index,
312 int width,
313 int height,
314 int proportion = 0,
315 int flag = 0,
316 int border = 0,
317 wxObject* userData = NULL );
5f813ad6
VZ
318 inline void Insert( size_t index,
319 wxWindow *window,
320 const wxSizerFlags& flags );
321 inline void Insert( size_t index,
322 wxSizer *sizer,
323 const wxSizerFlags& flags );
436ae7cf
VZ
324 virtual void Insert( size_t index, wxSizerItem *item );
325
8e32ea1c
VZ
326 inline void InsertSpacer(size_t index, int size);
327 inline void InsertStretchSpacer(size_t index, int prop = 1);
328
329 inline void Prepend( wxWindow *window,
330 int proportion = 0,
331 int flag = 0,
332 int border = 0,
333 wxObject* userData = NULL );
334 inline void Prepend( wxSizer *sizer,
335 int proportion = 0,
336 int flag = 0,
337 int border = 0,
338 wxObject* userData = NULL );
339 inline void Prepend( int width,
340 int height,
341 int proportion = 0,
342 int flag = 0,
343 int border = 0,
344 wxObject* userData = NULL );
5f813ad6
VZ
345 inline void Prepend( wxWindow *window, const wxSizerFlags& flags );
346 inline void Prepend( wxSizer *sizer, const wxSizerFlags& flags );
8e32ea1c
VZ
347 inline void Prepend( wxSizerItem *item );
348
349 inline void PrependSpacer(int size);
350 inline void PrependStretchSpacer(int prop = 1);
351
749bb9f1 352
12a3f227
RL
353 // Deprecated in 2.6 since historically it does not delete the window,
354 // use Detach instead.
355 wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
f6bcfd97 356 virtual bool Remove( wxSizer *sizer );
e0d8fb45 357 virtual bool Remove( int index );
00976fe5 358
12a3f227 359 virtual bool Detach( wxWindow *window );
00976fe5 360 virtual bool Detach( wxSizer *sizer );
e0d8fb45 361 virtual bool Detach( int index );
00976fe5 362
e0d8fb45 363 virtual void Clear( bool delete_windows = false );
84f7908b 364 virtual void DeleteWindows();
f6bcfd97
BP
365
366 void SetMinSize( int width, int height )
367 { DoSetMinSize( width, height ); }
368 void SetMinSize( wxSize size )
369 { DoSetMinSize( size.x, size.y ); }
1e6feb95 370
f6bcfd97
BP
371 /* Searches recursively */
372 bool SetItemMinSize( wxWindow *window, int width, int height )
373 { return DoSetItemMinSize( window, width, height ); }
374 bool SetItemMinSize( wxWindow *window, wxSize size )
375 { return DoSetItemMinSize( window, size.x, size.y ); }
1e6feb95 376
f6bcfd97
BP
377 /* Searches recursively */
378 bool SetItemMinSize( wxSizer *sizer, int width, int height )
379 { return DoSetItemMinSize( sizer, width, height ); }
380 bool SetItemMinSize( wxSizer *sizer, wxSize size )
381 { return DoSetItemMinSize( sizer, size.x, size.y ); }
1e6feb95 382
12a3f227
RL
383 bool SetItemMinSize( size_t index, int width, int height )
384 { return DoSetItemMinSize( index, width, height ); }
385 bool SetItemMinSize( size_t index, wxSize size )
386 { return DoSetItemMinSize( index, size.x, size.y ); }
1e6feb95 387
9cbee2ce 388 wxSize GetSize() const
f6bcfd97 389 { return m_size; }
9cbee2ce 390 wxPoint GetPosition() const
f6bcfd97 391 { return m_position; }
1e6feb95 392
f6bcfd97
BP
393 /* Calculate the minimal size or return m_minSize if bigger. */
394 wxSize GetMinSize();
395
396 virtual void RecalcSizes() = 0;
397 virtual wxSize CalcMin() = 0;
398
399 virtual void Layout();
400
e5251d4f 401 wxSize Fit( wxWindow *window );
566d84a7 402 void FitInside( wxWindow *window );
f6bcfd97 403 void SetSizeHints( wxWindow *window );
566d84a7 404 void SetVirtualSizeHints( wxWindow *window );
f6bcfd97 405
12a3f227 406 wxSizerItemList& GetChildren()
f6bcfd97
BP
407 { return m_children; }
408
409 void SetDimension( int x, int y, int width, int height );
0c0d686f 410
9f13661f
WS
411 wxSizerItem* GetItem( wxWindow *window, bool recursive = false );
412 wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false );
413 wxSizerItem* GetItem( size_t index );
414
12a3f227 415 // Manage whether individual scene items are considered
2b5f62a0 416 // in the layout calculations or not.
8b2bac62
WS
417 bool Show( wxWindow *window, bool show = true, bool recursive = false );
418 bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
419 bool Show( size_t index, bool show = true );
12a3f227 420
8b2bac62
WS
421 bool Hide( wxSizer *sizer, bool recursive = false )
422 { return Show( sizer, false, recursive ); }
423 bool Hide( wxWindow *window, bool recursive = false )
424 { return Show( window, false, recursive ); }
425 bool Hide( size_t index )
426 { return Show( index, false ); }
2b5f62a0 427
9cbee2ce
RL
428 bool IsShown( wxWindow *window ) const;
429 bool IsShown( wxSizer *sizer ) const;
430 bool IsShown( size_t index ) const;
dc259b79 431
2b5f62a0 432 // Recursively call wxWindow::Show () on all sizer items.
eb2a7883 433 virtual void ShowItems (bool show);
2b5f62a0 434
f6bcfd97 435protected:
12a3f227
RL
436 wxSize m_size;
437 wxSize m_minSize;
438 wxPoint m_position;
439 wxSizerItemList m_children;
f6bcfd97 440
9cbee2ce 441 wxSize GetMaxWindowSize( wxWindow *window ) const;
f6bcfd97 442 wxSize GetMinWindowSize( wxWindow *window );
9cbee2ce 443 wxSize GetMaxClientSize( wxWindow *window ) const;
566d84a7 444 wxSize GetMinClientSize( wxWindow *window );
65ba4113 445 wxSize FitSize( wxWindow *window );
566d84a7 446 wxSize VirtualFitSize( wxWindow *window );
65ba4113 447
f6bcfd97
BP
448 virtual void DoSetMinSize( int width, int height );
449 virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
450 virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
12a3f227 451 virtual bool DoSetItemMinSize( size_t index, int width, int height );
1e6feb95 452
9cbee2ce 453private:
4393b50c 454 DECLARE_CLASS(wxSizer)
f6bcfd97 455};
c62ac5b6 456
f6bcfd97
BP
457//---------------------------------------------------------------------------
458// wxGridSizer
459//---------------------------------------------------------------------------
0c0d686f 460
f6bcfd97
BP
461class WXDLLEXPORT wxGridSizer: public wxSizer
462{
463public:
464 wxGridSizer( int rows, int cols, int vgap, int hgap );
465 wxGridSizer( int cols, int vgap = 0, int hgap = 0 );
1e6feb95 466
5d76f462
VZ
467 virtual void RecalcSizes();
468 virtual wxSize CalcMin();
f6bcfd97
BP
469
470 void SetCols( int cols ) { m_cols = cols; }
471 void SetRows( int rows ) { m_rows = rows; }
472 void SetVGap( int gap ) { m_vgap = gap; }
473 void SetHGap( int gap ) { m_hgap = gap; }
9cbee2ce
RL
474 int GetCols() const { return m_cols; }
475 int GetRows() const { return m_rows; }
476 int GetVGap() const { return m_vgap; }
477 int GetHGap() const { return m_hgap; }
1e6feb95 478
f6bcfd97
BP
479protected:
480 int m_rows;
481 int m_cols;
482 int m_vgap;
483 int m_hgap;
1e6feb95 484
0ca5105b
VZ
485 // return the number of total items and the number of columns and rows
486 int CalcRowsCols(int& rows, int& cols) const;
487
f6bcfd97 488 void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
1e6feb95 489
9cbee2ce 490private:
4393b50c 491 DECLARE_CLASS(wxGridSizer)
f6bcfd97 492};
5279a24d 493
f6bcfd97
BP
494//---------------------------------------------------------------------------
495// wxFlexGridSizer
496//---------------------------------------------------------------------------
0c0d686f 497
5d76f462
VZ
498// the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible"
499// direction
500enum wxFlexSizerGrowMode
501{
502 // don't resize the cells in non-flexible direction at all
503 wxFLEX_GROWMODE_NONE,
504
505 // uniformly resize only the specified ones (default)
506 wxFLEX_GROWMODE_SPECIFIED,
507
508 // uniformly resize all cells
509 wxFLEX_GROWMODE_ALL
510};
511
f6bcfd97
BP
512class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer
513{
514public:
5d76f462 515 // ctors/dtor
f6bcfd97
BP
516 wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
517 wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
5d76f462 518 virtual ~wxFlexGridSizer();
1e6feb95 519
1e6feb95 520
5d76f462
VZ
521 // set the rows/columns which will grow (the others will remain of the
522 // constant initial size)
e8800dcf 523 void AddGrowableRow( size_t idx, int proportion = 0 );
f6bcfd97 524 void RemoveGrowableRow( size_t idx );
e8800dcf 525 void AddGrowableCol( size_t idx, int proportion = 0 );
f6bcfd97 526 void RemoveGrowableCol( size_t idx );
0c0d686f 527
1e6feb95 528
5d76f462
VZ
529 // the sizer cells may grow in both directions, not grow at all or only
530 // grow in one direction but not the other
531
532 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
533 void SetFlexibleDirection(int direction) { m_flexDirection = direction; }
534 int GetFlexibleDirection() const { return m_flexDirection; }
535
536 // note that the grow mode only applies to the direction which is not
537 // flexible
538 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; }
539 wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; }
540
fc1fcd0e
RD
541 // Read-only access to the row heights and col widths arrays
542 const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
543 const wxArrayInt& GetColWidths() const { return m_colWidths; }
8b2bac62 544
5d76f462
VZ
545 // implementation
546 virtual void RecalcSizes();
547 virtual wxSize CalcMin();
548
549protected:
20b35a69
RD
550 void AdjustForFlexDirection();
551 void AdjustForGrowables(const wxSize& sz, const wxSize& minsz,
552 int nrows, int ncols);
8b2bac62 553
5d76f462
VZ
554 // the heights/widths of all rows/columns
555 wxArrayInt m_rowHeights,
556 m_colWidths;
557
558 // indices of the growable columns and rows
559 wxArrayInt m_growableRows,
560 m_growableCols;
561
e8800dcf
VZ
562 // proportion values of the corresponding growable rows and columns
563 wxArrayInt m_growableRowsProportions,
564 m_growableColsProportions;
565
5d76f462
VZ
566 // parameters describing whether the growable cells should be resized in
567 // both directions or only one
568 int m_flexDirection;
569 wxFlexSizerGrowMode m_growMode;
1e6feb95 570
ba763a45
RD
571 // saves CalcMin result to optimize RecalcSizes
572 wxSize m_calculatedMinSize;
573
9cbee2ce 574private:
4393b50c 575 DECLARE_CLASS(wxFlexGridSizer)
22f3361e 576 DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
c62ac5b6
RR
577};
578
579//---------------------------------------------------------------------------
92afa2b1 580// wxBoxSizer
c62ac5b6
RR
581//---------------------------------------------------------------------------
582
92afa2b1 583class WXDLLEXPORT wxBoxSizer: public wxSizer
61d514bb
RR
584{
585public:
f6bcfd97 586 wxBoxSizer( int orient );
0c0d686f 587
f6bcfd97
BP
588 void RecalcSizes();
589 wxSize CalcMin();
0c0d686f 590
9cbee2ce 591 int GetOrientation() const
f6bcfd97 592 { return m_orient; }
0c0d686f 593
b657b4c9
JS
594 void SetOrientation(int orient)
595 { m_orient = orient; }
596
61d514bb
RR
597protected:
598 int m_orient;
599 int m_stretchable;
600 int m_minWidth;
601 int m_minHeight;
602 int m_fixedWidth;
603 int m_fixedHeight;
1e6feb95 604
9cbee2ce 605private:
4393b50c 606 DECLARE_CLASS(wxBoxSizer)
61d514bb 607};
0c0d686f 608
27ea1d8a
RR
609//---------------------------------------------------------------------------
610// wxStaticBoxSizer
611//---------------------------------------------------------------------------
612
1e6feb95
VZ
613#if wxUSE_STATBOX
614
615class WXDLLEXPORT wxStaticBox;
616
27ea1d8a
RR
617class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
618{
619public:
f6bcfd97 620 wxStaticBoxSizer( wxStaticBox *box, int orient );
0c0d686f 621
f6bcfd97
BP
622 void RecalcSizes();
623 wxSize CalcMin();
0c0d686f 624
9cbee2ce 625 wxStaticBox *GetStaticBox() const
f6bcfd97 626 { return m_staticBox; }
0c0d686f 627
eb2a7883
VZ
628 // override to hide/show the static box as well
629 virtual void ShowItems (bool show);
630
27ea1d8a 631protected:
f6bcfd97 632 wxStaticBox *m_staticBox;
1e6feb95 633
9cbee2ce 634private:
4393b50c 635 DECLARE_CLASS(wxStaticBoxSizer)
22f3361e 636 DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
27ea1d8a
RR
637};
638
1e6feb95
VZ
639#endif // wxUSE_STATBOX
640
adbf2d73
VS
641
642#if WXWIN_COMPATIBILITY_2_4
643// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
644// don't do anything. wxBookCtrl::DoGetBestSize does the job now.
645
ade4eb65
VZ
646// ----------------------------------------------------------------------------
647// wxBookCtrlSizer
648// ----------------------------------------------------------------------------
83edc0a5 649
ade4eb65 650#if wxUSE_BOOKCTRL
65e4f9b9 651
8e32ea1c 652// this sizer works with wxNotebook/wxListbook/... and sizes the control to
ade4eb65
VZ
653// fit its pages
654class WXDLLEXPORT wxBookCtrl;
1e6feb95 655
ade4eb65 656class WXDLLEXPORT wxBookCtrlSizer : public wxSizer
83edc0a5 657{
83edc0a5 658public:
adbf2d73 659 wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) );
83edc0a5 660
adbf2d73 661 wxBookCtrl *GetControl() const { return m_bookctrl; }
8b2bac62 662
ade4eb65
VZ
663 virtual void RecalcSizes();
664 virtual wxSize CalcMin();
83edc0a5 665
83edc0a5 666protected:
adbf2d73 667 // this protected ctor lets us mark the real one above as deprecated
749bb9f1 668 // and still have warning-free build of the library itself:
adbf2d73 669 wxBookCtrlSizer() {}
8b2bac62 670
ade4eb65
VZ
671 wxBookCtrl *m_bookctrl;
672
673private:
674 DECLARE_CLASS(wxBookCtrlSizer)
675 DECLARE_NO_COPY_CLASS(wxBookCtrlSizer)
676};
677
678
679#if wxUSE_NOTEBOOK
680
681// before wxBookCtrl we only had wxNotebookSizer, keep it for backwards
682// compatibility
683class WXDLLEXPORT wxNotebook;
684
685class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer
686{
687public:
adbf2d73 688 wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) );
ade4eb65
VZ
689
690 wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; }
1e6feb95 691
9cbee2ce 692private:
4393b50c 693 DECLARE_CLASS(wxNotebookSizer)
22f3361e 694 DECLARE_NO_COPY_CLASS(wxNotebookSizer)
83edc0a5
RR
695};
696
1e6feb95 697#endif // wxUSE_NOTEBOOK
65e4f9b9 698
ade4eb65
VZ
699#endif // wxUSE_BOOKCTRL
700
adbf2d73
VS
701#endif // WXWIN_COMPATIBILITY_2_4
702
8e32ea1c
VZ
703// ----------------------------------------------------------------------------
704// inline functions implementation
705// ----------------------------------------------------------------------------
706
707inline void
708wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
709{
710 Add( new wxSizerItem( window, proportion, flag, border, userData ) );
711}
712
713inline void
714wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
715{
716 Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
717}
718
719inline void
720wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
721{
722 Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
723}
724
5f813ad6
VZ
725inline void
726wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
727{
728 Add( new wxSizerItem(window, flags) );
729}
730
731inline void
732wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
733{
734 Add( new wxSizerItem(sizer, flags) );
735}
736
8e32ea1c
VZ
737inline void
738wxSizer::Add( wxSizerItem *item )
739{
740 Insert( m_children.GetCount(), item );
741}
742
743inline void
744wxSizer::AddSpacer(int size)
745{
746 Add(size, size);
747}
748
749inline void
750wxSizer::AddStretchSpacer(int prop)
751{
752 Add(0, 0, prop);
753}
754
755inline void
756wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
757{
758 Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
759}
760
761inline void
762wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
763{
764 Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
765}
766
767inline void
768wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
769{
770 Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
771}
772
773inline void
774wxSizer::Prepend( wxSizerItem *item )
775{
776 Insert( 0, item );
777}
778
779inline void
780wxSizer::PrependSpacer(int size)
781{
782 Prepend(size, size);
783}
784
785inline void
786wxSizer::PrependStretchSpacer(int prop)
787{
788 Prepend(0, 0, prop);
789}
790
5f813ad6
VZ
791inline void
792wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
793{
794 Prepend( new wxSizerItem(window, flags) );
795}
796
797inline void
798wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
799{
800 Prepend( new wxSizerItem(sizer, flags) );
801}
802
8e32ea1c
VZ
803inline void
804wxSizer::Insert( size_t index,
5f813ad6
VZ
805 wxWindow *window,
806 int proportion,
807 int flag,
808 int border,
809 wxObject* userData )
8e32ea1c
VZ
810{
811 Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
812}
813
814inline void
815wxSizer::Insert( size_t index,
5f813ad6
VZ
816 wxSizer *sizer,
817 int proportion,
818 int flag,
819 int border,
820 wxObject* userData )
8e32ea1c
VZ
821{
822 Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
823}
824
825inline void
826wxSizer::Insert( size_t index,
5f813ad6
VZ
827 int width,
828 int height,
829 int proportion,
830 int flag,
831 int border,
832 wxObject* userData )
8e32ea1c
VZ
833{
834 Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
835}
836
5f813ad6
VZ
837inline void
838wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
839{
840 Insert( index, new wxSizerItem(window, flags) );
841}
842
843inline void
844wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
845{
846 Insert( index, new wxSizerItem(sizer, flags) );
847}
848
8e32ea1c
VZ
849inline void
850wxSizer::InsertSpacer(size_t index, int size)
851{
852 Insert(index, size, size);
853}
854
855inline void
856wxSizer::InsertStretchSpacer(size_t index, int prop)
857{
858 Insert(index, 0, 0, prop);
859}
860
adbf2d73 861
ade4eb65 862#endif // __WXSIZER_H__
65e4f9b9 863