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