]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sizer.h
(blind) fix for Metrowerks/Win32 compilation
[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/window.h"
22 #include "wx/frame.h"
23 #include "wx/dialog.h"
24 #include "wx/bookctrl.h"
25
26 //---------------------------------------------------------------------------
27 // classes
28 //---------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxSizerItem;
31 class WXDLLEXPORT wxSizer;
32 class WXDLLEXPORT wxBoxSizer;
33
34
35 // ----------------------------------------------------------------------------
36 // wxSizerFlags: flags used for an item in the sizer
37 // ----------------------------------------------------------------------------
38
39 class WXDLLEXPORT wxSizerFlags
40 {
41 public:
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
95 private:
96 int m_proportion;
97 int m_flags;
98 int m_borderInPixels;
99 };
100
101
102 //---------------------------------------------------------------------------
103 // wxSizerItem
104 //---------------------------------------------------------------------------
105
106 class WXDLLEXPORT wxSizerItem: public wxObject
107 {
108 public:
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 }
124
125 // window
126 wxSizerItem( wxWindow *window,
127 int proportion,
128 int flag,
129 int border,
130 wxObject* userData );
131
132 // subsizer
133 wxSizerItem( wxSizer *sizer,
134 int proportion,
135 int flag,
136 int border,
137 wxObject* userData );
138
139 // spacer
140 wxSizerItem( int width,
141 int height,
142 int proportion,
143 int flag,
144 int border,
145 wxObject* userData);
146
147 wxSizerItem();
148 virtual ~wxSizerItem();
149
150 virtual void DeleteWindows();
151
152 // Enable deleting the SizerItem without destroying the contained sizer.
153 void DetachSizer()
154 { m_sizer = 0; }
155
156 virtual wxSize GetSize() const;
157 virtual wxSize CalcMin();
158 virtual void SetDimension( wxPoint pos, wxSize size );
159
160 wxSize GetMinSize() const
161 { return m_minSize; }
162 wxSize GetMinSizeWithBorder() const;
163
164 void SetMinSize(const wxSize& size)
165 {
166 if (IsWindow()) m_window->SetMinSize(size);
167 m_minSize = size;
168 }
169 void SetMinSize( int x, int y )
170 { SetMinSize(wxSize(x, y)); }
171 void SetInitSize( int x, int y )
172 { SetMinSize(wxSize(x, y)); }
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; }
180 void SetRatio( float ratio )
181 { m_ratio = ratio; }
182 float GetRatio() const
183 { return m_ratio; }
184
185 bool IsWindow() const;
186 bool IsSizer() const;
187 bool IsSpacer() const;
188
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; }
197 void SetFlag( int flag )
198 { m_flag = flag; }
199 int GetFlag() const
200 { return m_flag; }
201 void SetBorder( int border )
202 { m_border = border; }
203 int GetBorder() const
204 { return m_border; }
205
206 wxWindow *GetWindow() const
207 { return m_window; }
208 void SetWindow( wxWindow *window )
209 { m_window = window; m_minSize = window->GetSize(); }
210 wxSizer *GetSizer() const
211 { return m_sizer; }
212 void SetSizer( wxSizer *sizer )
213 { m_sizer = sizer; }
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 );
220 bool IsShown() const
221 { return m_show; }
222
223 wxObject* GetUserData() const
224 { return m_userData; }
225 wxPoint GetPosition() const
226 { return m_pos; }
227
228 protected:
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
236 wxWindow *m_window;
237 wxSizer *m_sizer;
238 wxSize m_size;
239 wxPoint m_pos;
240 wxSize m_minSize;
241 int m_proportion;
242 int m_border;
243 int m_flag;
244
245 // If true, then this item is considered in the layout
246 // calculation. Otherwise, it is skipped over.
247 bool m_show;
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.
252 float m_ratio;
253
254 wxObject *m_userData;
255
256 private:
257 DECLARE_CLASS(wxSizerItem)
258 DECLARE_NO_COPY_CLASS(wxSizerItem)
259 };
260
261 WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
262
263
264 //---------------------------------------------------------------------------
265 // wxSizer
266 //---------------------------------------------------------------------------
267
268 class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer
269 {
270 public:
271 wxSizer();
272 ~wxSizer();
273
274 // methods for adding elements to the sizer: there are Add/Insert/Prepend
275 // overloads for each of window/sizer/spacer/wxSizerItem
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 );
292 inline void Add( wxWindow *window, const wxSizerFlags& flags );
293 inline void Add( wxSizer *sizer, const wxSizerFlags& flags );
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 );
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 );
324 virtual void Insert( size_t index, wxSizerItem *item );
325
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 );
345 inline void Prepend( wxWindow *window, const wxSizerFlags& flags );
346 inline void Prepend( wxSizer *sizer, const wxSizerFlags& flags );
347 inline void Prepend( wxSizerItem *item );
348
349 inline void PrependSpacer(int size);
350 inline void PrependStretchSpacer(int prop = 1);
351
352
353 // Deprecated in 2.6 since historically it does not delete the window,
354 // use Detach instead.
355 wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
356 virtual bool Remove( wxSizer *sizer );
357 virtual bool Remove( int index );
358
359 virtual bool Detach( wxWindow *window );
360 virtual bool Detach( wxSizer *sizer );
361 virtual bool Detach( int index );
362
363 virtual void Clear( bool delete_windows = false );
364 virtual void DeleteWindows();
365
366 void SetMinSize( int width, int height )
367 { DoSetMinSize( width, height ); }
368 void SetMinSize( wxSize size )
369 { DoSetMinSize( size.x, size.y ); }
370
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 ); }
376
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 ); }
382
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 ); }
387
388 wxSize GetSize() const
389 { return m_size; }
390 wxPoint GetPosition() const
391 { return m_position; }
392
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
401 wxSize Fit( wxWindow *window );
402 void FitInside( wxWindow *window );
403 void SetSizeHints( wxWindow *window );
404 void SetVirtualSizeHints( wxWindow *window );
405
406 wxSizerItemList& GetChildren()
407 { return m_children; }
408
409 void SetDimension( int x, int y, int width, int height );
410
411 // Manage whether individual scene items are considered
412 // in the layout calculations or not.
413 bool Show( wxWindow *window, bool show = true, bool recursive = false );
414 bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
415 bool Show( size_t index, bool show = true );
416
417 bool Hide( wxSizer *sizer, bool recursive = false )
418 { return Show( sizer, false, recursive ); }
419 bool Hide( wxWindow *window, bool recursive = false )
420 { return Show( window, false, recursive ); }
421 bool Hide( size_t index )
422 { return Show( index, false ); }
423
424 bool IsShown( wxWindow *window ) const;
425 bool IsShown( wxSizer *sizer ) const;
426 bool IsShown( size_t index ) const;
427
428 // Recursively call wxWindow::Show () on all sizer items.
429 virtual void ShowItems (bool show);
430
431 protected:
432 wxSize m_size;
433 wxSize m_minSize;
434 wxPoint m_position;
435 wxSizerItemList m_children;
436
437 wxSize GetMaxWindowSize( wxWindow *window ) const;
438 wxSize GetMinWindowSize( wxWindow *window );
439 wxSize GetMaxClientSize( wxWindow *window ) const;
440 wxSize GetMinClientSize( wxWindow *window );
441 wxSize FitSize( wxWindow *window );
442 wxSize VirtualFitSize( wxWindow *window );
443
444 virtual void DoSetMinSize( int width, int height );
445 virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
446 virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
447 virtual bool DoSetItemMinSize( size_t index, int width, int height );
448
449 private:
450 DECLARE_CLASS(wxSizer)
451 };
452
453 //---------------------------------------------------------------------------
454 // wxGridSizer
455 //---------------------------------------------------------------------------
456
457 class WXDLLEXPORT wxGridSizer: public wxSizer
458 {
459 public:
460 wxGridSizer( int rows, int cols, int vgap, int hgap );
461 wxGridSizer( int cols, int vgap = 0, int hgap = 0 );
462
463 virtual void RecalcSizes();
464 virtual wxSize CalcMin();
465
466 void SetCols( int cols ) { m_cols = cols; }
467 void SetRows( int rows ) { m_rows = rows; }
468 void SetVGap( int gap ) { m_vgap = gap; }
469 void SetHGap( int gap ) { m_hgap = gap; }
470 int GetCols() const { return m_cols; }
471 int GetRows() const { return m_rows; }
472 int GetVGap() const { return m_vgap; }
473 int GetHGap() const { return m_hgap; }
474
475 protected:
476 int m_rows;
477 int m_cols;
478 int m_vgap;
479 int m_hgap;
480
481 // return the number of total items and the number of columns and rows
482 int CalcRowsCols(int& rows, int& cols) const;
483
484 void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
485
486 private:
487 DECLARE_CLASS(wxGridSizer)
488 };
489
490 //---------------------------------------------------------------------------
491 // wxFlexGridSizer
492 //---------------------------------------------------------------------------
493
494 // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible"
495 // direction
496 enum wxFlexSizerGrowMode
497 {
498 // don't resize the cells in non-flexible direction at all
499 wxFLEX_GROWMODE_NONE,
500
501 // uniformly resize only the specified ones (default)
502 wxFLEX_GROWMODE_SPECIFIED,
503
504 // uniformly resize all cells
505 wxFLEX_GROWMODE_ALL
506 };
507
508 class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer
509 {
510 public:
511 // ctors/dtor
512 wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
513 wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
514 virtual ~wxFlexGridSizer();
515
516
517 // set the rows/columns which will grow (the others will remain of the
518 // constant initial size)
519 void AddGrowableRow( size_t idx, int proportion = 0 );
520 void RemoveGrowableRow( size_t idx );
521 void AddGrowableCol( size_t idx, int proportion = 0 );
522 void RemoveGrowableCol( size_t idx );
523
524
525 // the sizer cells may grow in both directions, not grow at all or only
526 // grow in one direction but not the other
527
528 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
529 void SetFlexibleDirection(int direction) { m_flexDirection = direction; }
530 int GetFlexibleDirection() const { return m_flexDirection; }
531
532 // note that the grow mode only applies to the direction which is not
533 // flexible
534 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; }
535 wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; }
536
537 // Read-only access to the row heights and col widths arrays
538 const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
539 const wxArrayInt& GetColWidths() const { return m_colWidths; }
540
541 // implementation
542 virtual void RecalcSizes();
543 virtual wxSize CalcMin();
544
545 protected:
546 void AdjustForFlexDirection();
547 void AdjustForGrowables(const wxSize& sz, const wxSize& minsz,
548 int nrows, int ncols);
549
550 // the heights/widths of all rows/columns
551 wxArrayInt m_rowHeights,
552 m_colWidths;
553
554 // indices of the growable columns and rows
555 wxArrayInt m_growableRows,
556 m_growableCols;
557
558 // proportion values of the corresponding growable rows and columns
559 wxArrayInt m_growableRowsProportions,
560 m_growableColsProportions;
561
562 // parameters describing whether the growable cells should be resized in
563 // both directions or only one
564 int m_flexDirection;
565 wxFlexSizerGrowMode m_growMode;
566
567 // saves CalcMin result to optimize RecalcSizes
568 wxSize m_calculatedMinSize;
569
570 private:
571 DECLARE_CLASS(wxFlexGridSizer)
572 DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
573 };
574
575 //---------------------------------------------------------------------------
576 // wxBoxSizer
577 //---------------------------------------------------------------------------
578
579 class WXDLLEXPORT wxBoxSizer: public wxSizer
580 {
581 public:
582 wxBoxSizer( int orient );
583
584 void RecalcSizes();
585 wxSize CalcMin();
586
587 int GetOrientation() const
588 { return m_orient; }
589
590 void SetOrientation(int orient)
591 { m_orient = orient; }
592
593 protected:
594 int m_orient;
595 int m_stretchable;
596 int m_minWidth;
597 int m_minHeight;
598 int m_fixedWidth;
599 int m_fixedHeight;
600
601 private:
602 DECLARE_CLASS(wxBoxSizer)
603 };
604
605 //---------------------------------------------------------------------------
606 // wxStaticBoxSizer
607 //---------------------------------------------------------------------------
608
609 #if wxUSE_STATBOX
610
611 class WXDLLEXPORT wxStaticBox;
612
613 class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
614 {
615 public:
616 wxStaticBoxSizer( wxStaticBox *box, int orient );
617
618 void RecalcSizes();
619 wxSize CalcMin();
620
621 wxStaticBox *GetStaticBox() const
622 { return m_staticBox; }
623
624 // override to hide/show the static box as well
625 virtual void ShowItems (bool show);
626
627 protected:
628 wxStaticBox *m_staticBox;
629
630 private:
631 DECLARE_CLASS(wxStaticBoxSizer)
632 DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
633 };
634
635 #endif // wxUSE_STATBOX
636
637
638 #if WXWIN_COMPATIBILITY_2_4
639 // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
640 // don't do anything. wxBookCtrl::DoGetBestSize does the job now.
641
642 // ----------------------------------------------------------------------------
643 // wxBookCtrlSizer
644 // ----------------------------------------------------------------------------
645
646 #if wxUSE_BOOKCTRL
647
648 // this sizer works with wxNotebook/wxListbook/... and sizes the control to
649 // fit its pages
650 class WXDLLEXPORT wxBookCtrl;
651
652 class WXDLLEXPORT wxBookCtrlSizer : public wxSizer
653 {
654 public:
655 wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) );
656
657 wxBookCtrl *GetControl() const { return m_bookctrl; }
658
659 virtual void RecalcSizes();
660 virtual wxSize CalcMin();
661
662 protected:
663 // this protected ctor lets us mark the real one above as deprecated
664 // and still have warning-free build of the library itself:
665 wxBookCtrlSizer() {}
666
667 wxBookCtrl *m_bookctrl;
668
669 private:
670 DECLARE_CLASS(wxBookCtrlSizer)
671 DECLARE_NO_COPY_CLASS(wxBookCtrlSizer)
672 };
673
674
675 #if wxUSE_NOTEBOOK
676
677 // before wxBookCtrl we only had wxNotebookSizer, keep it for backwards
678 // compatibility
679 class WXDLLEXPORT wxNotebook;
680
681 class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer
682 {
683 public:
684 wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) );
685
686 wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; }
687
688 private:
689 DECLARE_CLASS(wxNotebookSizer)
690 DECLARE_NO_COPY_CLASS(wxNotebookSizer)
691 };
692
693 #endif // wxUSE_NOTEBOOK
694
695 #endif // wxUSE_BOOKCTRL
696
697 #endif // WXWIN_COMPATIBILITY_2_4
698
699 // ----------------------------------------------------------------------------
700 // inline functions implementation
701 // ----------------------------------------------------------------------------
702
703 inline void
704 wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
705 {
706 Add( new wxSizerItem( window, proportion, flag, border, userData ) );
707 }
708
709 inline void
710 wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
711 {
712 Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
713 }
714
715 inline void
716 wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
717 {
718 Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
719 }
720
721 inline void
722 wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
723 {
724 Add( new wxSizerItem(window, flags) );
725 }
726
727 inline void
728 wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
729 {
730 Add( new wxSizerItem(sizer, flags) );
731 }
732
733 inline void
734 wxSizer::Add( wxSizerItem *item )
735 {
736 Insert( m_children.GetCount(), item );
737 }
738
739 inline void
740 wxSizer::AddSpacer(int size)
741 {
742 Add(size, size);
743 }
744
745 inline void
746 wxSizer::AddStretchSpacer(int prop)
747 {
748 Add(0, 0, prop);
749 }
750
751 inline void
752 wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
753 {
754 Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
755 }
756
757 inline void
758 wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
759 {
760 Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
761 }
762
763 inline void
764 wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
765 {
766 Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
767 }
768
769 inline void
770 wxSizer::Prepend( wxSizerItem *item )
771 {
772 Insert( 0, item );
773 }
774
775 inline void
776 wxSizer::PrependSpacer(int size)
777 {
778 Prepend(size, size);
779 }
780
781 inline void
782 wxSizer::PrependStretchSpacer(int prop)
783 {
784 Prepend(0, 0, prop);
785 }
786
787 inline void
788 wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
789 {
790 Prepend( new wxSizerItem(window, flags) );
791 }
792
793 inline void
794 wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
795 {
796 Prepend( new wxSizerItem(sizer, flags) );
797 }
798
799 inline void
800 wxSizer::Insert( size_t index,
801 wxWindow *window,
802 int proportion,
803 int flag,
804 int border,
805 wxObject* userData )
806 {
807 Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
808 }
809
810 inline void
811 wxSizer::Insert( size_t index,
812 wxSizer *sizer,
813 int proportion,
814 int flag,
815 int border,
816 wxObject* userData )
817 {
818 Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
819 }
820
821 inline void
822 wxSizer::Insert( size_t index,
823 int width,
824 int height,
825 int proportion,
826 int flag,
827 int border,
828 wxObject* userData )
829 {
830 Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
831 }
832
833 inline void
834 wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
835 {
836 Insert( index, new wxSizerItem(window, flags) );
837 }
838
839 inline void
840 wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
841 {
842 Insert( index, new wxSizerItem(sizer, flags) );
843 }
844
845 inline void
846 wxSizer::InsertSpacer(size_t index, int size)
847 {
848 Insert(index, size, size);
849 }
850
851 inline void
852 wxSizer::InsertStretchSpacer(size_t index, int prop)
853 {
854 Insert(index, 0, 0, prop);
855 }
856
857
858 #endif // __WXSIZER_H__
859