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