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