]> git.saurik.com Git - wxWidgets.git/blame - interface/sizer.h
use wxEmptyString as default value to return from GetAttribute()
[wxWidgets.git] / interface / sizer.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: sizer.h
e54c96f1 3// Purpose: interface of wxStdDialogButtonSizer
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxStdDialogButtonSizer
11 @wxheader{sizer.h}
7c913512 12
23324ae1
FM
13 This class creates button layouts which conform to the standard button spacing
14 and ordering defined by the platform
15 or toolkit's user interface guidelines (if such things exist). By using this
16 class, you can ensure that all your
17 standard dialogs look correct on all major platforms. Currently it conforms to
18 the Windows, GTK+ and Mac OS X
19 human interface guidelines.
7c913512 20
23324ae1
FM
21 When there aren't interface guidelines defined for a particular platform or
22 toolkit, wxStdDialogButtonSizer reverts
7c913512
FM
23 to the Windows implementation.
24
23324ae1
FM
25 To use this class, first add buttons to the sizer by calling AddButton (or
26 SetAffirmativeButton, SetNegativeButton,
27 or SetCancelButton) and then call Realize in order to create the actual button
28 layout used. Other than these special
7c913512
FM
29 operations, this sizer works like any other sizer.
30
23324ae1
FM
31 If you add a button with wxID_SAVE, on Mac OS X the button will be renamed to
32 "Save" and
33 the wxID_NO button will be renamed to "Don't Save" in accordance with the Mac
34 OS X Human Interface Guidelines.
7c913512 35
23324ae1
FM
36 @library{wxcore}
37 @category{FIXME}
7c913512 38
e54c96f1 39 @see wxSizer, @ref overview_sizeroverview "Sizer overview",
23324ae1
FM
40 wxDialog::CreateButtonSizer
41*/
42class wxStdDialogButtonSizer : public wxBoxSizer
43{
44public:
45 /**
46 Constructor for a wxStdDialogButtonSizer.
47 */
48 wxStdDialogButtonSizer();
49
50 /**
51 Adds a button to the wxStdDialogButtonSizer. The button must have one of the
52 following identifiers:
23324ae1
FM
53 wxID_OK
54 wxID_YES
55 wxID_SAVE
56 wxID_APPLY
57 wxID_CLOSE
58 wxID_NO
59 wxID_CANCEL
60 wxID_HELP
61 wxID_CONTEXT_HELP
62 */
63 void AddButton(wxButton* button);
64
65 /**
66 Rearranges the buttons and applies proper spacing between buttons to make them
67 match the platform or toolkit's interface guidelines.
68 */
69 void Realize();
70
71 /**
72 Sets the affirmative button for the sizer. This allows you to use identifiers
73 other than the standard identifiers outlined above.
74 */
75 void SetAffirmativeButton(wxButton* button);
76
77 /**
78 Sets the cancel button for the sizer. This allows you to use identifiers other
79 than the standard identifiers outlined above.
80 */
81 void SetCancelButton(wxButton* button);
82
83 /**
84 Sets the negative button for the sizer. This allows you to use identifiers
85 other than the standard identifiers outlined above.
86 */
87 void SetNegativeButton(wxButton* button);
88};
89
90
e54c96f1 91
23324ae1
FM
92/**
93 @class wxSizerItem
94 @wxheader{sizer.h}
7c913512 95
23324ae1 96 The wxSizerItem class is used to track the position, size and other
5886ce02
VS
97 attributes of each item managed by a wxSizer. It is not usually necessary
98 to use this class because the sizer elements can also be identified by
99 their positions or window or sizer pointers but sometimes it may be more
100 convenient to use it directly.
7c913512 101
23324ae1 102 @library{wxcore}
5886ce02 103 @category{winlayout}
23324ae1
FM
104*/
105class wxSizerItem : public wxObject
106{
107public:
108 //@{
109 /**
110 Construct a sizer item for tracking a subsizer.
111 */
112 wxSizerItem(int width, int height, int proportion, int flag,
113 int border, wxObject* userData);
7c913512
FM
114 wxSizerItem(wxWindow* window, const wxSizerFlags& flags);
115 wxSizerItem(wxWindow* window, int proportion, int flag,
116 int border,
117 wxObject* userData);
118 wxSizerItem(wxSizer* window, const wxSizerFlags& flags);
119 wxSizerItem(wxSizer* sizer, int proportion, int flag,
120 int border,
121 wxObject* userData);
23324ae1
FM
122 //@}
123
124 /**
125 Deletes the user data and subsizer, if any.
126 */
127 ~wxSizerItem();
128
129 /**
130 Calculates the minimum desired size for the item, including any space
131 needed by borders.
132 */
133 wxSize CalcMin();
134
135 /**
136 Destroy the window or the windows in a subsizer, depending on the type
137 of item.
138 */
139 void DeleteWindows();
140
141 /**
142 Enable deleting the SizerItem without destroying the contained sizer.
143 */
144 void DetachSizer();
145
146 /**
147 Return the border attribute.
148 */
328f5751 149 int GetBorder() const;
23324ae1
FM
150
151 /**
152 Return the flags attribute.
5886ce02
VS
153
154 See @ref wxsizer_flags "wxSizer flags list" for details.
23324ae1 155 */
328f5751 156 int GetFlag() const;
23324ae1
FM
157
158 /**
159 Return the numeric id of wxSizerItem, or @c wxID_NONE if the id has
160 not been set.
161 */
328f5751 162 int GetId() const;
23324ae1
FM
163
164 /**
165 Get the minimum size needed for the item.
166 */
328f5751 167 wxSize GetMinSize() const;
23324ae1
FM
168
169 /**
170 What is the current position of the item, as set in the last Layout.
171 */
328f5751 172 wxPoint GetPosition() const;
23324ae1
FM
173
174 /**
175 Get the proportion item attribute.
176 */
328f5751 177 int GetProportion() const;
23324ae1
FM
178
179 /**
180 Get the ration item attribute.
181 */
328f5751 182 float GetRatio() const;
23324ae1
FM
183
184 /**
185 Get the rectangle of the item on the parent window, excluding borders.
186 */
187 wxRect GetRect();
188
189 /**
190 Get the current size of the item, as set in the last Layout.
191 */
328f5751 192 wxSize GetSize() const;
23324ae1
FM
193
194 /**
195 If this item is tracking a sizer, return it. @NULL otherwise.
196 */
328f5751 197 wxSizer* GetSizer() const;
23324ae1
FM
198
199 /**
200 If this item is tracking a spacer, return its size.
201 */
328f5751 202 const wxSize GetSpacer() const;
23324ae1
FM
203
204 /**
205 Get the userData item attribute.
206 */
328f5751 207 wxObject* GetUserData() const;
23324ae1
FM
208
209 /**
210 If this item is tracking a window then return it. @NULL otherwise.
211 */
328f5751 212 wxWindow* GetWindow() const;
23324ae1
FM
213
214 /**
01195a1b
VS
215 Returns @true if this item is a window or a spacer and it is shown or
216 if this item is a sizer and not all of its elements are hidden.
217
218 In other words, for sizer items, all of the child elements must be
219 hidden for the sizer itself to be considered hidden.
220
221 As an exception, if the @c wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was
222 used for this sizer item, then IsShown() always returns @true for it
223 (see wxSizerFlags::ReserveSpaceEvenIfHidden()).
23324ae1 224 */
328f5751 225 bool IsShown() const;
23324ae1
FM
226
227 /**
228 Is this item a sizer?
229 */
328f5751 230 bool IsSizer() const;
23324ae1
FM
231
232 /**
233 Is this item a spacer?
234 */
328f5751 235 bool IsSpacer() const;
23324ae1
FM
236
237 /**
238 Is this item a window?
239 */
328f5751 240 bool IsWindow() const;
23324ae1
FM
241
242 /**
243 Set the border item attribute.
244 */
245 void SetBorder(int border);
246
247 /**
248 Set the position and size of the space allocated to the sizer, and
249 adjust the position and size of the item to be within that space
250 taking alignment and borders into account.
251 */
252 void SetDimension(const wxPoint& pos, const wxSize& size);
253
254 /**
255 Set the flag item attribute.
256 */
257 void SetFlag(int flag);
258
259 /**
260 Sets the numeric id of the wxSizerItem to @e id.
261 */
262 void SetId(int id);
263
264 /**
3c4f71cc 265
23324ae1
FM
266 */
267 void SetInitSize(int x, int y);
268
269 /**
270 Set the proportion item attribute.
271 */
272 void SetProportion(int proportion);
273
274 //@{
275 /**
276 Set the ratio item attribute.
277 */
278 void SetRatio(int width, int height);
7c913512
FM
279 void SetRatio(wxSize size);
280 void SetRatio(float ratio);
23324ae1
FM
281 //@}
282
283 /**
284 Set the sizer tracked by this item.
285 */
286 void SetSizer(wxSizer* sizer);
287
288 /**
289 Set the size of the spacer tracked by this item.
290 */
291 void SetSpacer(const wxSize& size);
292
293 /**
294 Set the window to be tracked by thsi item.
295 */
296 void SetWindow(wxWindow* window);
297
298 /**
299 Set the show item attribute, which sizers use to determine if the item
300 is to be made part of the layout or not. If the item is tracking a
301 window then it is shown or hidden as needed.
302 */
303 void Show(bool show);
304};
305
306
e54c96f1 307
23324ae1
FM
308/**
309 @class wxSizerFlags
310 @wxheader{sizer.h}
7c913512
FM
311
312 Normally, when you add an item to a sizer via
23324ae1
FM
313 wxSizer::Add, you have to specify a lot of flags and
314 parameters which can be unwieldy. This is where wxSizerFlags comes in: it
315 allows you to specify all parameters using the named methods instead. For
316 example, instead of
7c913512 317
23324ae1 318 @code
5886ce02 319 sizer->Add(ctrl, 0, wxEXPAND | wxALL, 10);
23324ae1 320 @endcode
7c913512 321
23324ae1 322 you can now write
7c913512 323
23324ae1 324 @code
5886ce02 325 sizer->Add(ctrl, wxSizerFlags().Expand().Border(10));
23324ae1 326 @endcode
7c913512 327
23324ae1
FM
328 This is more readable and also allows you to create wxSizerFlags objects which
329 can be reused for several sizer items.
7c913512 330
23324ae1
FM
331 @code
332 wxSizerFlags flagsExpand(1);
333 flagsExpand.Expand().Border(10);
7c913512 334
5886ce02
VS
335 sizer->Add(ctrl1, flagsExpand);
336 sizer->Add(ctrl2, flagsExpand);
23324ae1 337 @endcode
7c913512 338
23324ae1
FM
339 Note that by specification, all methods of wxSizerFlags return the wxSizerFlags
340 object itself to allowing chaining multiple methods calls like in the examples
341 above.
7c913512 342
23324ae1 343 @library{wxcore}
5886ce02 344 @category{winlayout}
7c913512 345
e54c96f1 346 @see wxSizer
23324ae1 347*/
7c913512 348class wxSizerFlags
23324ae1
FM
349{
350public:
351 /**
352 Creates the wxSizer with the proportion specified by @e proportion.
353 */
354 wxSizerFlags(int proportion = 0);
355
356 /**
feaa1ecb
VS
357 Sets the alignment of this wxSizerFlags to @e align. Note that if this
358 method is not called, the wxSizerFlags has no specified alignment.
3c4f71cc 359
feaa1ecb 360 @see Top(), Left(), Right(), Bottom(), Centre()
23324ae1 361 */
feaa1ecb 362 wxSizerFlags& Align(int align = 0);
23324ae1 363
23324ae1 364 /**
feaa1ecb
VS
365 Sets the wxSizerFlags to have a border of a number of pixels specified
366 by @a borderinpixels with the directions specified by @e direction.
23324ae1 367 */
feaa1ecb
VS
368 wxSizerFlags& Border(int direction, int borderinpixels);
369
370 /**
371 Sets the wxSizerFlags to have a border with size as returned by
372 GetDefaultBorder().
373
374 @param direction Direction(s) to apply the border in.
375 */
376 wxSizerFlags& Border(int direction = wxALL);
23324ae1
FM
377
378 /**
feaa1ecb 379 Aligns the object to the bottom, shortcut for @c Align(wxALIGN_BOTTOM).
3c4f71cc 380
4cc4bfaf 381 @see Align()
23324ae1 382 */
feaa1ecb 383 wxSizerFlags& Bottom();
23324ae1
FM
384
385 /**
feaa1ecb
VS
386 Sets the object of the wxSizerFlags to center itself in the area it is
387 given.
23324ae1 388 */
feaa1ecb 389 wxSizerFlags& Center();
23324ae1
FM
390
391 /**
feaa1ecb 392 Center() for people with the other dialect of English.
23324ae1 393 */
feaa1ecb 394 wxSizerFlags& Centre();
23324ae1
FM
395
396 /**
feaa1ecb
VS
397 Sets the border in the given @a direction having twice the default
398 border size.
23324ae1 399 */
feaa1ecb 400 wxSizerFlags& DoubleBorder(int direction = wxALL);
23324ae1
FM
401
402 /**
feaa1ecb
VS
403 Sets the border in left and right directions having twice the default
404 border size.
23324ae1 405 */
feaa1ecb 406 wxSizerFlags& DoubleHorzBorder();
23324ae1
FM
407
408 /**
feaa1ecb
VS
409 Sets the object of the wxSizerFlags to expand to fill as much area as
410 it can.
23324ae1 411 */
feaa1ecb 412 wxSizerFlags& Expand();
23324ae1
FM
413
414 /**
feaa1ecb
VS
415 Set the @c wxFIXED_MINSIZE flag which indicates that the initial size
416 of the window should be also set as its minimal size.
23324ae1 417 */
feaa1ecb 418 wxSizerFlags& FixedMinSize();
23324ae1 419
01195a1b
VS
420 /**
421 Set the @c wxRESERVE_SPACE_EVEN_IF_HIDDEN flag. Normally wxSizers
422 don't allocate space for hidden windows or other items. This flag
423 overrides this behavior so that sufficient space is allocated for the
424 window even if it isn't visible. This makes it possible to dynamically
425 show and hide controls without resizing parent dialog, for example.
426
427 @since 2.8.8
428 */
429 wxSizerFlags& ReserveSpaceEvenIfHidden();
430
23324ae1
FM
431 /**
432 Returns the border used by default in Border() method.
433 */
434 static int GetDefaultBorder();
435
436 /**
437 Aligns the object to the left, shortcut for @c Align(wxALIGN_LEFT)
3c4f71cc 438
4cc4bfaf 439 @see Align()
23324ae1 440 */
feaa1ecb 441 wxSizerFlags& Left();
23324ae1
FM
442
443 /**
444 Sets the proportion of this wxSizerFlags to @e proportion
445 */
feaa1ecb 446 wxSizerFlags& Proportion(int proportion = 0);
23324ae1
FM
447
448 /**
449 Aligns the object to the right, shortcut for @c Align(wxALIGN_RIGHT)
3c4f71cc 450
4cc4bfaf 451 @see Align()
23324ae1 452 */
feaa1ecb 453 wxSizerFlags& Right();
23324ae1
FM
454
455 /**
456 Set the @c wx_SHAPED flag which indicates that the elements should
457 always keep the fixed width to height ratio equal to its original value.
458 */
feaa1ecb 459 wxSizerFlags& Shaped();
23324ae1
FM
460
461 /**
462 Aligns the object to the top, shortcut for @c Align(wxALIGN_TOP)
3c4f71cc 463
4cc4bfaf 464 @see Align()
23324ae1 465 */
feaa1ecb 466 wxSizerFlags& Top();
23324ae1
FM
467
468 /**
feaa1ecb
VS
469 Sets the border in the given @a direction having thrice the default
470 border size.
23324ae1 471 */
feaa1ecb 472 wxSizerFlags& TripleBorder(int direction = wxALL);
23324ae1
FM
473};
474
475
e54c96f1 476
23324ae1
FM
477/**
478 @class wxNotebookSizer
479 @wxheader{sizer.h}
7c913512 480
da0691a4
VS
481 @deprecated
482 This class is deprecated and should not be used in new code! It is no
23324ae1
FM
483 longer needed, wxNotebook control can be inserted
484 into any sizer class and its minimal size will be determined correctly.
7c913512 485
23324ae1 486 wxNotebookSizer is a specialized sizer to make sizers work in connection
da0691a4
VS
487 with using notebooks. This sizer is different from any other sizer as you
488 must not add any children to it - instead, it queries the notebook class
489 itself. The only thing this sizer does is to determine the size of the
490 biggest page of the notebook and report an adjusted minimal size to a more
491 toplevel sizer.
7c913512 492
23324ae1 493 @library{wxbase}
da0691a4 494 @category{winlayout}
7c913512 495
da0691a4
VS
496 @see wxSizer, wxNotebook,
497 @ref overview_sizer "Sizers overview"
23324ae1
FM
498*/
499class wxNotebookSizer : public wxSizer
500{
501public:
502 /**
503 Constructor. It takes an associated notebook as its only parameter.
504 */
505 wxNotebookSizer(wxNotebook* notebook);
506
507 /**
508 Returns the notebook associated with the sizer.
509 */
510 wxNotebook* GetNotebook();
511};
512
513
e54c96f1 514
23324ae1
FM
515/**
516 @class wxFlexGridSizer
517 @wxheader{sizer.h}
7c913512 518
23324ae1
FM
519 A flex grid sizer is a sizer which lays out its children in a two-dimensional
520 table with all table fields in one row having the same
521 height and all fields in one column having the same width, but all
522 rows or all columns are not necessarily the same height or width as in
523 the wxGridSizer.
7c913512 524
23324ae1
FM
525 Since wxWidgets 2.5.0, wxFlexGridSizer can also size items equally in one
526 direction but unequally ("flexibly") in the other. If the sizer is only
527 flexible in one direction (this can be changed using
528 wxFlexGridSizer::SetFlexibleDirection),
529 it needs to be decided how the sizer should grow in the other ("non-flexible")
530 direction in order to fill the available space. The
531 wxFlexGridSizer::SetNonFlexibleGrowMode method
532 serves this purpose.
7c913512 533
23324ae1
FM
534 @library{wxcore}
535 @category{winlayout}
7c913512 536
e54c96f1 537 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
23324ae1
FM
538*/
539class wxFlexGridSizer : public wxGridSizer
540{
541public:
542 //@{
543 /**
4cc4bfaf 544 Constructor for a wxGridSizer. @a rows and @a cols determine the number of
23324ae1
FM
545 columns and rows in the sizer - if either of the parameters is zero, it will be
546 calculated to form the total number of children in the sizer, thus making the
4cc4bfaf 547 sizer grow dynamically. @a vgap and @a hgap define extra space between
23324ae1
FM
548 all children.
549 */
550 wxFlexGridSizer(int rows, int cols, int vgap, int hgap);
7c913512 551 wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0);
23324ae1
FM
552 //@}
553
554 /**
4cc4bfaf 555 Specifies that column @a idx (starting from zero) should be grown if
23324ae1 556 there is extra space available to the sizer.
4cc4bfaf 557 The @a proportion parameter has the same meaning as the stretch factor for
e54c96f1 558 the sizers() except that if all proportions are 0,
23324ae1
FM
559 then all columns are resized equally (instead of not being resized at all).
560 */
561 void AddGrowableCol(size_t idx, int proportion = 0);
562
563 /**
564 Specifies that row idx (starting from zero) should be grown if there
565 is extra space available to the sizer.
23324ae1 566 See AddGrowableCol() for the description
4cc4bfaf 567 of @a proportion parameter.
23324ae1
FM
568 */
569 void AddGrowableRow(size_t idx, int proportion = 0);
570
571 /**
572 Returns a wxOrientation value that specifies whether the sizer flexibly
573 resizes its columns, rows, or both (default).
3c4f71cc 574
23324ae1 575 @returns One of the following values:
3c4f71cc 576
4cc4bfaf 577 @see SetFlexibleDirection()
23324ae1 578 */
328f5751 579 int GetFlexibleDirection() const;
23324ae1
FM
580
581 /**
582 Returns the value that specifies how the sizer grows in the "non-flexible"
583 direction if there is one.
3c4f71cc 584
23324ae1 585 @returns One of the following values:
3c4f71cc 586
4cc4bfaf
FM
587 @see SetFlexibleDirection(),
588 SetNonFlexibleGrowMode()
23324ae1 589 */
328f5751 590 int GetNonFlexibleGrowMode() const;
23324ae1
FM
591
592 /**
593 Specifies that column idx is no longer growable.
594 */
595 void RemoveGrowableCol(size_t idx);
596
597 /**
598 Specifies that row idx is no longer growable.
599 */
600 void RemoveGrowableRow(size_t idx);
601
602 /**
603 Specifies whether the sizer should flexibly resize its columns, rows, or
604 both. Argument @c direction can be @c wxVERTICAL, @c wxHORIZONTAL
605 or @c wxBOTH (which is the default value). Any other value is ignored. See
606 @ref getflexibledrection() GetFlexibleDirection for the
607 explanation of these values.
23324ae1
FM
608 Note that this method does not trigger relayout.
609 */
610 void SetFlexibleDirection(int direction);
611
612 /**
613 Specifies how the sizer should grow in the non-flexible direction if
614 there is one (so
615 SetFlexibleDirection() must have
4cc4bfaf 616 been called previously). Argument @a mode can be one of those documented in
23324ae1
FM
617 GetNonFlexibleGrowMode(), please
618 see there for their explanation.
23324ae1
FM
619 Note that this method does not trigger relayout.
620 */
621 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode);
622};
623
624
e54c96f1 625
23324ae1
FM
626/**
627 @class wxSizer
628 @wxheader{sizer.h}
7c913512 629
23324ae1
FM
630 wxSizer is the abstract base class used for laying out subwindows in a window.
631 You
632 cannot use wxSizer directly; instead, you will have to use one of the sizer
7c913512 633 classes derived from it. Currently there are wxBoxSizer,
23324ae1
FM
634 wxStaticBoxSizer,
635 wxGridSizer,
636 wxFlexGridSizer,
637 wxWrapSizer
638 and wxGridBagSizer.
7c913512 639
23324ae1
FM
640 The layout algorithm used by sizers in wxWidgets is closely related to layout
641 in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit.
642 It is
643 based upon the idea of the individual subwindows reporting their minimal
644 required
645 size and their ability to get stretched if the size of the parent window has
646 changed.
647 This will most often mean that the programmer does not set the original size of
648 a dialog in the beginning, rather the dialog will be assigned a sizer and this
649 sizer
650 will be queried about the recommended size. The sizer in turn will query its
651 children, which can be normal windows, empty space or other sizers, so that
652 a hierarchy of sizers can be constructed. Note that wxSizer does not derive
653 from wxWindow
654 and thus does not interfere with tab ordering and requires very little
655 resources compared
656 to a real window on screen.
7c913512 657
23324ae1
FM
658 What makes sizers so well fitted for use in wxWidgets is the fact that every
659 control
660 reports its own minimal size and the algorithm can handle differences in font
661 sizes
662 or different window (dialog item) sizes on different platforms without
663 problems. If e.g.
664 the standard font as well as the overall design of Motif widgets requires more
665 space than
666 on Windows, the initial dialog size will automatically be bigger on Motif than
667 on Windows.
7c913512 668
23324ae1 669 Sizers may also be used to control the layout of custom drawn items on the
5886ce02
VS
670 window. The Add(), Insert(), and Prepend() functions return a pointer to
671 the newly added wxSizerItem. Just add empty space of the desired size and
672 attributes, and then use the wxSizerItem::GetRect() method to determine
673 where the drawing operations should take place.
7c913512 674
23324ae1 675 Please notice that sizers, like child windows, are owned by the library and
5886ce02
VS
676 will be deleted by it which implies that they must be allocated on the
677 heap. However if you create a sizer and do not add it to another sizer or
678 window, the library wouldn't be able to delete such an orphan sizer and in
679 this, and only this, case it should be deleted explicitly.
7c913512 680
23324ae1
FM
681 @b wxPython note: If you wish to create a sizer class in wxPython you should
682 derive the class from @c wxPySizer in order to get Python-aware
683 capabilities for the various virtual methods.
7c913512 684
5886ce02
VS
685 @anchor wxsizer_flags
686 @par wxSizer flags
687 The "flag" argument accepted by wxSizeItem constructors and other
688 functions, e.g. wxSizer::Add(), is OR-combination of the following flags.
689 Two main behaviours are defined using these flags. One is the border around
690 a window: the border parameter determines the border width whereas the
691 flags given here determine which side(s) of the item that the border will
692 be added. The other flags determine how the sizer item behaves when the
693 space allotted to the sizer changes, and is somewhat dependent on the
694 specific kind of sizer used.
695 @beginDefList
696 @itemdef{wxTOP<br>
697 wxBOTTOM<br>
698 wxLEFT<br>
699 wxRIGHT<br>
700 wxALL,
701 These flags are used to specify which side(s) of the sizer item
702 the border width will apply to.}
703 @itemdef{wxEXPAND,
704 The item will be expanded to fill the space assigned to the item.}
705 @itemdef{wxSHAPED,
706 The item will be expanded as much as possible while also
707 maintaining its aspect ratio.}
708 @itemdef{wxFIXED_MINSIZE,
709 Normally wxSizers will use GetAdjustedBestSize() to determine what
710 the minimal size of window items should be, and will use that size
711 to calculate the layout. This allows layouts to adjust when an
712 item changes and its best size becomes different. If you would
713 rather have a window item stay the size it started with then use
714 wxFIXED_MINSIZE.}
01195a1b
VS
715 @itemdef{wxRESERVE_SPACE_EVEN_IF_HIDDEN,
716 Normally wxSizers don't allocate space for hidden windows or other
717 items. This flag overrides this behavior so that sufficient space
718 is allocated for the window even if it isn't visible. This makes
719 it possible to dynamically show and hide controls without resizing
720 parent dialog, for example. (Available since 2.8.8.)
721 }
5886ce02
VS
722 @itemdef{wxALIGN_CENTER<br>
723 wxALIGN_CENTRE<br>
724 wxALIGN_LEFT<br>
725 wxALIGN_RIGHT<br>
726 wxALIGN_TOP<br>
727 wxALIGN_BOTTOM<br>
728 wxALIGN_CENTER_VERTICAL<br>
729 wxALIGN_CENTRE_VERTICAL<br>
730 wxALIGN_CENTER_HORIZONTAL<br>
731 wxALIGN_CENTRE_HORIZONTAL,
732 The wxALIGN flags allow you to specify the alignment of the item
733 within the space allotted to it by the sizer, adjusted for the
734 border if any.}
735 @endDefList
736
737
23324ae1
FM
738 @library{wxcore}
739 @category{winlayout}
7c913512 740
e54c96f1 741 @see @ref overview_sizeroverview "Sizer overview"
23324ae1
FM
742*/
743class wxSizer : public wxObject
744{
745public:
746 /**
747 The constructor. Note that wxSizer is an abstract base class and may not
748 be instantiated.
749 */
750 wxSizer();
751
752 /**
753 The destructor.
754 */
755 ~wxSizer();
756
23324ae1 757 /**
5886ce02
VS
758 Appends a child to the sizer.
759
760 wxSizer itself is an abstract class, but the parameters are equivalent
761 in the derived classes that you will instantiate to use it so they are
762 described here:
3c4f71cc 763
7c913512 764 @param window
4cc4bfaf 765 The window to be added to the sizer. Its initial size (either set
5886ce02
VS
766 explicitly by the user or calculated internally when using
767 wxDefaultSize) is interpreted as the minimal and in many cases also
768 the initial size.
769 @param flags
770 A wxSizerFlags object that enables you to specify most of the above
771 parameters more conveniently.
772 */
773 wxSizerItem* Add(wxWindow* window, const wxSizerFlags& flags);
3c4f71cc 774
5886ce02
VS
775 /**
776 Appends a child to the sizer.
3c4f71cc 777
5886ce02
VS
778 wxSizer itself is an abstract class, but the parameters are equivalent
779 in the derived classes that you will instantiate to use it so they are
780 described here:
3c4f71cc 781
5886ce02
VS
782 @param window
783 The window to be added to the sizer. Its initial size (either set
784 explicitly by the user or calculated internally when using
785 wxDefaultSize) is interpreted as the minimal and in many cases also
786 the initial size.
787 @param proportion
788 Although the meaning of this parameter is undefined in wxSizer, it
789 is used in wxBoxSizer to indicate if a child of a sizer can change
790 its size in the main orientation of the wxBoxSizer - where 0 stands
791 for not changeable and a value of more than zero is interpreted
792 relative to the value of other children of the same wxBoxSizer. For
793 example, you might have a horizontal wxBoxSizer with three
794 children, two of which are supposed to change their size with the
795 sizer. Then the two stretchable windows would get a value of 1 each
796 to make them grow and shrink equally with the sizer's horizontal
797 dimension.
798 @param flag
799 OR-combination of flags affecting sizer's behavior. See
800 @ref wxsizer_flags "wxSizer flags list" for details.
801 @param border
802 Determines the border width, if the flag parameter is set to
803 include any border flag.
804 @param userData
805 Allows an extra object to be attached to the sizer item, for use in
806 derived classes when sizing information is more complex than the
807 proportion and flag will allow for.
808 */
809 wxSizerItem* Add(wxWindow* window, int proportion = 0,
810 int flag = 0,
811 int border = 0,
812 wxObject* userData = NULL);
3c4f71cc 813
5886ce02
VS
814 /**
815 Appends a child to the sizer.
3c4f71cc 816
5886ce02
VS
817 wxSizer itself is an abstract class, but the parameters are equivalent
818 in the derived classes that you will instantiate to use it so they are
819 described here:
3c4f71cc 820
5886ce02
VS
821 @param sizer
822 The (child-)sizer to be added to the sizer. This allows placing a
823 child sizer in a sizer and thus to create hierarchies of sizers
824 (typically a vertical box as the top sizer and several horizontal
825 boxes on the level beneath).
826 @param flags
827 A wxSizerFlags object that enables you to specify most of the above
828 parameters more conveniently.
829 */
830 wxSizerItem* Add(wxSizer* sizer, const wxSizerFlags& flags);
3c4f71cc 831
5886ce02
VS
832 /**
833 Appends a child to the sizer.
3c4f71cc 834
5886ce02
VS
835 wxSizer itself is an abstract class, but the parameters are equivalent
836 in the derived classes that you will instantiate to use it so they are
837 described here:
3c4f71cc 838
5886ce02
VS
839 @param sizer
840 The (child-)sizer to be added to the sizer. This allows placing a
841 child sizer in a sizer and thus to create hierarchies of sizers
842 (typically a vertical box as the top sizer and several horizontal
843 boxes on the level beneath).
844 @param proportion
845 Although the meaning of this parameter is undefined in wxSizer, it
846 is used in wxBoxSizer to indicate if a child of a sizer can change
847 its size in the main orientation of the wxBoxSizer - where 0 stands
848 for not changeable and a value of more than zero is interpreted
849 relative to the value of other children of the same wxBoxSizer. For
850 example, you might have a horizontal wxBoxSizer with three
851 children, two of which are supposed to change their size with the
852 sizer. Then the two stretchable windows would get a value of 1 each
853 to make them grow and shrink equally with the sizer's horizontal
854 dimension.
855 @param flag
856 OR-combination of flags affecting sizer's behavior. See
857 @ref wxsizer_flags "wxSizer flags list" for details.
4cc4bfaf 858 @param border
5886ce02
VS
859 Determines the border width, if the flag parameter is set to
860 include any border flag.
4cc4bfaf 861 @param userData
5886ce02
VS
862 Allows an extra object to be attached to the sizer item, for use in
863 derived classes when sizing information is more complex than the
864 proportion and flag will allow for.
23324ae1 865 */
7c913512
FM
866 wxSizerItem* Add(wxSizer* sizer, int proportion = 0,
867 int flag = 0,
868 int border = 0,
4cc4bfaf 869 wxObject* userData = NULL);
5886ce02
VS
870
871 /**
872 Appends a spacer child to the sizer.
873
874 wxSizer itself is an abstract class, but the parameters are equivalent
875 in the derived classes that you will instantiate to use it so they are
876 described here.
877
878 @a width and @a height specify the dimension of a spacer to be added to
879 the sizer. Adding spacers to sizers gives more flexibility in the
880 design of dialogs; imagine for example a horizontal box with two
881 buttons at the bottom of a dialog: you might want to insert a space
882 between the two buttons and make that space stretchable using the
883 proportion flag and the result will be that the left button will be
884 aligned with the left side of the dialog and the right button with the
885 right side - the space in between will shrink and grow with the dialog.
886
887 @param width
888 Width of the spacer.
889 @param height
890 Height of the spacer.
891 @param proportion
892 Although the meaning of this parameter is undefined in wxSizer, it
893 is used in wxBoxSizer to indicate if a child of a sizer can change
894 its size in the main orientation of the wxBoxSizer - where 0 stands
895 for not changeable and a value of more than zero is interpreted
896 relative to the value of other children of the same wxBoxSizer. For
897 example, you might have a horizontal wxBoxSizer with three
898 children, two of which are supposed to change their size with the
899 sizer. Then the two stretchable windows would get a value of 1 each
900 to make them grow and shrink equally with the sizer's horizontal
901 dimension.
902 @param flag
903 OR-combination of flags affecting sizer's behavior. See
904 @ref wxsizer_flags "wxSizer flags list" for details.
905 @param border
906 Determines the border width, if the flag parameter is set to
907 include any border flag.
908 @param userData
909 Allows an extra object to be attached to the sizer item, for use in
910 derived classes when sizing information is more complex than the
911 proportion and flag will allow for.
912 */
7c913512
FM
913 wxSizerItem* Add(int width, int height, int proportion = 0,
914 int flag = 0,
915 int border = 0,
4cc4bfaf 916 wxObject* userData = NULL);
23324ae1
FM
917
918 /**
919 Adds non-stretchable space to the sizer. More readable way of calling
920 wxSizer::Add(size, size, 0).
921 */
922 wxSizerItem* AddSpacer(int size);
923
924 /**
925 Adds stretchable space to the sizer. More readable way of calling
926 wxSizer::Add(0, 0, prop).
927 */
928 wxSizerItem* AddStretchSpacer(int prop = 1);
929
930 /**
931 This method is abstract and has to be overwritten by any derived class.
932 Here, the sizer will do the actual calculation of its children's minimal sizes.
933 */
934 wxSize CalcMin();
935
936 /**
4cc4bfaf 937 Detaches all children from the sizer. If @a delete_windows is @true then
23324ae1
FM
938 child windows will also be deleted.
939 */
4cc4bfaf 940 void Clear(bool delete_windows = false);
23324ae1
FM
941
942 /**
491a5ece
VS
943 Computes client area size for @a window so that it matches the sizer's
944 minimal size. Unlike GetMinSize(), this method accounts for other
945 constraints imposed on @e window, namely display's size (returned size
946 will never be too large for the display) and maximum window size if
947 previously set by wxWindow::SetMaxSize(). The returned value is
948 suitable for passing to wxWindow::SetClientSize() or
949 wxWindow::SetMinClientSize().
950
951 @since 2.8.8
952
4cc4bfaf 953 @see ComputeFittingWindowSize(), Fit()
23324ae1
FM
954 */
955 wxSize ComputeFittingClientSize(wxWindow* window);
956
957 /**
491a5ece
VS
958 Like ComputeFittingClientSize(), but converts the result into window
959 size. The returned value is suitable for passing to wxWindow::SetSize()
960 or wxWindow::SetMinSize().
961
962 @since 2.8.8
963
4cc4bfaf 964 @see ComputeFittingClientSize(), Fit()
23324ae1
FM
965 */
966 wxSize ComputeFittingWindowSize(wxWindow* window);
967
968 //@{
969 /**
4cc4bfaf 970 Detach a child from the sizer without destroying it. @a window is the window to
23324ae1 971 be
4cc4bfaf 972 detached, @a sizer is the equivalent sizer and @a index is the position of
23324ae1
FM
973 the child in the sizer, typically 0 for the first item. This method does not
974 cause any layout or resizing to take place, call Layout()
975 to update the layout "on screen" after detaching a child from the sizer.
23324ae1 976 Returns @true if the child item was found and detached, @false otherwise.
3c4f71cc 977
4cc4bfaf 978 @see Remove()
23324ae1
FM
979 */
980 bool Detach(wxWindow* window);
7c913512
FM
981 bool Detach(wxSizer* sizer);
982 bool Detach(size_t index);
23324ae1
FM
983 //@}
984
985 /**
4cc4bfaf 986 Tell the sizer to resize the @a window so that its client area matches the
23324ae1
FM
987 sizer's minimal size
988 (ComputeFittingClientSize() is called
989 to determine it).
990 This is commonly done in the constructor of the window
991 itself, see sample in the description
992 of wxBoxSizer. Returns the new window size.
3c4f71cc 993
4cc4bfaf 994 @see ComputeFittingClientSize(), ComputeFittingWindowSize()
23324ae1 995 */
4cc4bfaf 996 wxSize Fit(wxWindow* window);
23324ae1
FM
997
998 /**
4cc4bfaf 999 Tell the sizer to resize the virtual size of the @a window to match the sizer's
23324ae1
FM
1000 minimal size. This will not alter the on screen size of the window, but may
1001 cause
1002 the addition/removal/alteration of scrollbars required to view the virtual area
1003 in
1004 windows which manage it.
3c4f71cc 1005
4cc4bfaf 1006 @see wxScrolledWindow::SetScrollbars, SetVirtualSizeHints()
23324ae1
FM
1007 */
1008 void FitInside(wxWindow* window);
1009
1010 //@{
1011 /**
7c913512
FM
1012 Returns the list of the items in this sizer. The elements of type-safe
1013 wxList @c wxSizerItemList are objects of type
23324ae1
FM
1014 @ref overview_wxsizeritem "wxSizerItem *".
1015 */
1016 const wxSizerItemList GetChildren();
328f5751 1017 const wxSizerItemList GetChildren();
23324ae1
FM
1018 //@}
1019
1020 /**
1021 Returns the window this sizer is used in or @NULL if none.
1022 */
328f5751 1023 wxWindow* GetContainingWindow() const;
23324ae1
FM
1024
1025 //@{
1026 /**
4cc4bfaf 1027 Finds item of the sizer which holds given @e window, @a sizer or is located
23324ae1 1028 in sizer at position @e index.
4cc4bfaf 1029 Use parameter @a recursive to search in subsizers too.
23324ae1
FM
1030 Returns pointer to item or @NULL.
1031 */
4cc4bfaf
FM
1032 wxSizerItem* GetItem(wxWindow* window, bool recursive = false);
1033 wxSizerItem* GetItem(wxSizer* sizer, bool recursive = false);
1034 wxSizerItem* GetItem(size_t index);
23324ae1
FM
1035 //@}
1036
1037 /**
4cc4bfaf 1038 Finds item of the sizer which has the given @e id. This @a id is not the
23324ae1 1039 window id but the id of the wxSizerItem itself. This is mainly useful for
7c913512 1040 retrieving the sizers created from XRC resources.
4cc4bfaf 1041 Use parameter @a recursive to search in subsizers too.
23324ae1
FM
1042 Returns pointer to item or @NULL.
1043 */
4cc4bfaf 1044 wxSizerItem* GetItemById(int id, bool recursive = false);
23324ae1
FM
1045
1046 /**
1047 Returns the minimal size of the sizer. This is either the combined minimal
7c913512 1048 size of all the children and their borders or the minimal size set by
23324ae1 1049 SetMinSize(), depending on which is bigger.
23324ae1
FM
1050 Note that the returned value is client size, not window size.
1051 In particular, if you use the value to set toplevel window's minimal or
1052 actual size, use wxWindow::SetMinClientSize
1053 or wxWindow::SetClientSize, not
1054 wxWindow::SetMinSize
1055 or wxWindow::SetSize.
1056 */
1057 wxSize GetMinSize();
1058
1059 /**
1060 Returns the current position of the sizer.
1061 */
1062 wxPoint GetPosition();
1063
1064 /**
1065 Returns the current size of the sizer.
1066 */
1067 wxSize GetSize();
1068
1069 //@{
1070 /**
1071 Hides the @e window, @e sizer, or item at @e index.
1072 To make a sizer item disappear, use Hide() followed by Layout().
4cc4bfaf 1073 Use parameter @a recursive to hide elements found in subsizers.
23324ae1 1074 Returns @true if the child item was found, @false otherwise.
3c4f71cc 1075
4cc4bfaf 1076 @see IsShown(), Show()
23324ae1 1077 */
4cc4bfaf
FM
1078 bool Hide(wxWindow* window, bool recursive = false);
1079 bool Hide(wxSizer* sizer, bool recursive = false);
7c913512 1080 bool Hide(size_t index);
23324ae1
FM
1081 //@}
1082
1083 //@{
1084 /**
7c913512 1085 Insert a child into the sizer before any existing item at
3c4f71cc 1086
23324ae1 1087 See Add() for the meaning of the other parameters.
3c4f71cc 1088
5886ce02 1089 @param index The position this child should assume in the sizer.
23324ae1
FM
1090 */
1091 wxSizerItem* Insert(size_t index, wxWindow* window,
1092 const wxSizerFlags& flags);
7c913512
FM
1093 wxSizerItem* Insert(size_t index, wxWindow* window,
1094 int proportion = 0,
1095 int flag = 0,
1096 int border = 0,
4cc4bfaf 1097 wxObject* userData = NULL);
7c913512
FM
1098 wxSizerItem* Insert(size_t index, wxSizer* sizer,
1099 const wxSizerFlags& flags);
1100 wxSizerItem* Insert(size_t index, wxSizer* sizer,
1101 int proportion = 0,
1102 int flag = 0,
1103 int border = 0,
4cc4bfaf 1104 wxObject* userData = NULL);
7c913512
FM
1105 wxSizerItem* Insert(size_t index, int width, int height,
1106 int proportion = 0,
1107 int flag = 0,
1108 int border = 0,
4cc4bfaf 1109 wxObject* userData = NULL);
23324ae1
FM
1110 //@}
1111
1112 /**
1113 Inserts non-stretchable space to the sizer. More readable way of calling
1114 wxSizer::Insert(size, size, 0).
1115 */
1116 wxSizerItem* InsertSpacer(size_t index, int size);
1117
1118 /**
1119 Inserts stretchable space to the sizer. More readable way of calling
1120 wxSizer::Insert(0, 0, prop).
1121 */
1122 wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
1123
23324ae1 1124 /**
01195a1b 1125 Returns @true if the @e window is shown.
3c4f71cc 1126
01195a1b 1127 @see Hide(), Show(), wxSizerItem::IsShown()
23324ae1 1128 */
328f5751 1129 bool IsShown(wxWindow* window) const;
01195a1b
VS
1130
1131 /**
1132 Returns @true if the @e sizer is shown.
1133
1134 @see Hide(), Show(), wxSizerItem::IsShown()
1135 */
1136 bool IsShown(wxSizer* sizer) const;
1137
1138 /**
1139 Returns @true if the item at @a index is shown.
1140
1141 @see Hide(), Show(), wxSizerItem::IsShown()
1142 */
1143 bool IsShown(size_t index) const;
23324ae1
FM
1144
1145 /**
1146 Call this to force layout of the children anew, e.g. after having added a child
1147 to or removed a child (window, other sizer or space) from the sizer while
1148 keeping
1149 the current dimension.
1150 */
1151 void Layout();
1152
23324ae1
FM
1153 /**
1154 Same as Add(), but prepends the items to the beginning of the
1155 list of items (windows, subsizers or spaces) owned by this sizer.
1156 */
1157 wxSizerItem* Prepend(wxWindow* window, const wxSizerFlags& flags);
5886ce02
VS
1158
1159 /**
1160 Same as Add(), but prepends the items to the beginning of the
1161 list of items (windows, subsizers or spaces) owned by this sizer.
1162 */
7c913512
FM
1163 wxSizerItem* Prepend(wxWindow* window, int proportion = 0,
1164 int flag = 0,
1165 int border = 0,
4cc4bfaf 1166 wxObject* userData = NULL);
5886ce02
VS
1167
1168 /**
1169 Same as Add(), but prepends the items to the beginning of the
1170 list of items (windows, subsizers or spaces) owned by this sizer.
1171 */
7c913512
FM
1172 wxSizerItem* Prepend(wxSizer* sizer,
1173 const wxSizerFlags& flags);
5886ce02
VS
1174
1175 /**
1176 Same as Add(), but prepends the items to the beginning of the
1177 list of items (windows, subsizers or spaces) owned by this sizer.
1178 */
7c913512
FM
1179 wxSizerItem* Prepend(wxSizer* sizer, int proportion = 0,
1180 int flag = 0,
1181 int border = 0,
4cc4bfaf 1182 wxObject* userData = NULL);
5886ce02
VS
1183
1184 /**
1185 Same as Add(), but prepends the items to the beginning of the
1186 list of items (windows, subsizers or spaces) owned by this sizer.
1187 */
7c913512
FM
1188 wxSizerItem* Prepend(int width, int height,
1189 int proportion = 0,
1190 int flag = 0,
4cc4bfaf
FM
1191 int border = 0,
1192 wxObject* userData = NULL);
23324ae1
FM
1193
1194 /**
5886ce02
VS
1195 Prepends non-stretchable space to the sizer. More readable way of
1196 calling wxSizer::Prepend(size, size, 0).
23324ae1
FM
1197 */
1198 wxSizerItem* PrependSpacer(int size);
1199
1200 /**
1201 Prepends stretchable space to the sizer. More readable way of calling
1202 wxSizer::Prepend(0, 0, prop).
1203 */
1204 wxSizerItem* PrependStretchSpacer(int prop = 1);
1205
1206 /**
1207 This method is abstract and has to be overwritten by any derived class.
5886ce02
VS
1208 Here, the sizer will do the actual calculation of its children's
1209 positions and sizes.
23324ae1
FM
1210 */
1211 void RecalcSizes();
1212
23324ae1 1213 /**
5886ce02
VS
1214 Removes a child window from the sizer, but does @b not destroy it
1215 (because windows are owned by their parent window, not the sizer).
1216
1217 @deprecated
1218 The overload of this method taking a wxWindow* parameter
1219 is deprecated as it does not destroy the window as would usually be
1220 expected from Remove(). You should use Detach() in new code instead.
1221 There is currently no wxSizer method that will both detach and destroy
1222 a wxWindow item.
1223
1224 @note This method does not cause any layout or resizing to take
1225 place, call Layout() to update the layout "on screen" after
1226 removing a child from the sizer.
1227
1228 @return @true if the child item was found and removed, @false otherwise.
23324ae1
FM
1229 */
1230 bool Remove(wxWindow* window);
5886ce02
VS
1231
1232 /**
1233 Removes a sizer child from the sizer and destroys it.
1234
1235 @note This method does not cause any layout or resizing to take
1236 place, call Layout() to update the layout "on screen" after
1237 removing a child from the sizer.
1238
1239 @param sizer The wxSizer to be removed.
1240
1241 @return @true if the child item was found and removed, @false otherwise.
1242 */
7c913512 1243 bool Remove(wxSizer* sizer);
5886ce02
VS
1244
1245 /**
1246 Removes a child from the sizer and destroys it if it is a sizer or a
1247 spacer, but not if it is a window (because windows are owned by their
1248 parent window, not the sizer).
1249
1250 @note This method does not cause any layout or resizing to take
1251 place, call Layout() to update the layout "on screen" after
1252 removing a child from the sizer.
1253
1254 @param index The position of the child in the sizer, e.g. 0 for the
1255 first item.
1256
1257 @return @true if the child item was found and removed, @false otherwise.
1258 */
7c913512 1259 bool Remove(size_t index);
23324ae1
FM
1260
1261 //@{
1262 /**
4cc4bfaf 1263 Detaches the given @e oldwin, @a oldsz child from the sizer and
23324ae1 1264 replaces it with the given window, sizer, or wxSizerItem.
23324ae1
FM
1265 The detached child is removed @b only if it is a sizer or a spacer
1266 (because windows are owned by their parent window, not the sizer).
4cc4bfaf 1267 Use parameter @a recursive to search the given element recursively in subsizers.
3c4f71cc 1268
23324ae1
FM
1269 This method does not cause any layout or resizing to take place, call
1270 Layout() to update the layout "on screen" after replacing a
1271 child from the sizer.
23324ae1
FM
1272 Returns @true if the child item was found and removed, @false otherwise.
1273 */
1274 bool Replace(wxWindow* oldwin, wxWindow* newwin,
4cc4bfaf 1275 bool recursive = false);
7c913512 1276 bool Replace(wxSizer* oldsz, wxSizer* newsz,
4cc4bfaf 1277 bool recursive = false);
7c913512 1278 bool Remove(size_t oldindex, wxSizerItem* newitem);
23324ae1
FM
1279 //@}
1280
1281 /**
5886ce02
VS
1282 Call this to force the sizer to take the given dimension and thus force
1283 the items owned by the sizer to resize themselves according to the
1284 rules defined by the parameter in the Add() and Prepend() methods.
23324ae1
FM
1285 */
1286 void SetDimension(int x, int y, int width, int height);
1287
1288 //@{
1289 /**
1290 Set an item's minimum size by window, sizer, or position. The item will be
1291 found recursively
1292 in the sizer's descendants. This function enables an application to set the
1293 size of an item
1294 after initial creation.
1295 */
1296 void SetItemMinSize(wxWindow* window, int width, int height);
7c913512
FM
1297 void SetItemMinSize(wxSizer* sizer, int width, int height);
1298 void SetItemMinSize(size_t index, int width, int height);
23324ae1
FM
1299 //@}
1300
23324ae1 1301 /**
5886ce02
VS
1302 Call this to give the sizer a minimal size. Normally, the sizer will
1303 calculate its minimal size based purely on how much space its children
1304 need. After calling this method GetMinSize() will return either the
1305 minimal size as requested by its children or the minimal size set here,
1306 depending on which is bigger.
23324ae1 1307 */
7c913512 1308 void SetMinSize(const wxSize& size);
5886ce02
VS
1309
1310 /**
1311 @overload
1312 */
1313 void SetMinSize(int width, int height);
23324ae1
FM
1314
1315 /**
7c913512 1316 This method first calls Fit() and then
23324ae1 1317 wxTopLevelWindow::SetSizeHints on the @e window
4cc4bfaf 1318 passed to it. This only makes sense when @a window is actually a
23324ae1 1319 wxTopLevelWindow such as a wxFrame or a
7c913512 1320 wxDialog, since SetSizeHints only has any effect in these classes.
23324ae1 1321 It does nothing in normal windows or controls.
7c913512 1322 This method is implicitly used by wxWindow::SetSizerAndFit
23324ae1
FM
1323 which is commonly invoked in the constructor of a toplevel window itself (see
1324 the sample in the description of wxBoxSizer) if the
1325 toplevel window is resizable.
1326 */
1327 void SetSizeHints(wxWindow* window);
1328
1329 /**
4cc4bfaf 1330 Tell the sizer to set the minimal size of the @a window virtual area to match
23324ae1
FM
1331 the sizer's
1332 minimal size. For windows with managed scrollbars this will set them
1333 appropriately.
3c4f71cc 1334
4cc4bfaf 1335 @see wxScrolledWindow::SetScrollbars
23324ae1
FM
1336 */
1337 void SetVirtualSizeHints(wxWindow* window);
1338
1339 //@{
1340 /**
1341 Shows or hides the @e window, @e sizer, or item at @e index.
1342 To make a sizer item disappear or reappear, use Show() followed by Layout().
4cc4bfaf 1343 Use parameter @a recursive to show or hide elements found in subsizers.
23324ae1 1344 Returns @true if the child item was found, @false otherwise.
3c4f71cc 1345
4cc4bfaf 1346 @see Hide(), IsShown()
23324ae1 1347 */
4cc4bfaf
FM
1348 bool Show(wxWindow* window, bool show = true,
1349 bool recursive = false);
1350 bool Show(wxSizer* sizer, bool show = true,
1351 bool recursive = false);
1352 bool Show(size_t index, bool show = true);
23324ae1
FM
1353 //@}
1354};
1355
1356
e54c96f1 1357
23324ae1
FM
1358/**
1359 @class wxGridSizer
1360 @wxheader{sizer.h}
7c913512 1361
23324ae1
FM
1362 A grid sizer is a sizer which lays out its children in a two-dimensional
1363 table with all table fields having the same size,
1364 i.e. the width of each field is the width of the widest child,
1365 the height of each field is the height of the tallest child.
7c913512 1366
23324ae1
FM
1367 @library{wxcore}
1368 @category{winlayout}
7c913512 1369
e54c96f1 1370 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
23324ae1
FM
1371*/
1372class wxGridSizer : public wxSizer
1373{
1374public:
1375 //@{
1376 /**
4cc4bfaf 1377 Constructor for a wxGridSizer. @a rows and @a cols determine the number of
23324ae1
FM
1378 columns and rows in the sizer - if either of the parameters is zero, it will be
1379 calculated to form the total number of children in the sizer, thus making the
4cc4bfaf 1380 sizer grow dynamically. @a vgap and @a hgap define extra space between
23324ae1
FM
1381 all children.
1382 */
1383 wxGridSizer(int rows, int cols, int vgap, int hgap);
7c913512 1384 wxGridSizer(int cols, int vgap = 0, int hgap = 0);
23324ae1
FM
1385 //@}
1386
1387 /**
1388 Returns the number of columns in the sizer.
1389 */
1390 int GetCols();
1391
1392 /**
1393 Returns the horizontal gap (in pixels) between cells in the sizer.
1394 */
1395 int GetHGap();
1396
1397 /**
1398 Returns the number of rows in the sizer.
1399 */
1400 int GetRows();
1401
1402 /**
1403 Returns the vertical gap (in pixels) between the cells in the sizer.
1404 */
1405 int GetVGap();
1406
1407 /**
1408 Sets the number of columns in the sizer.
1409 */
1410 void SetCols(int cols);
1411
1412 /**
1413 Sets the horizontal gap (in pixels) between cells in the sizer.
1414 */
1415 void SetHGap(int gap);
1416
1417 /**
1418 Sets the number of rows in the sizer.
1419 */
1420 void SetRows(int rows);
1421
1422 /**
1423 Sets the vertical gap (in pixels) between the cells in the sizer.
1424 */
1425 void SetVGap(int gap);
1426};
1427
1428
e54c96f1 1429
23324ae1
FM
1430/**
1431 @class wxStaticBoxSizer
1432 @wxheader{sizer.h}
7c913512 1433
23324ae1
FM
1434 wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static
1435 box around the sizer. This static box may be either created independently or
1436 the sizer may create it itself as a convenience. In any case, the sizer owns
1437 the wxStaticBox control and will delete it if it is
1438 deleted.
7c913512 1439
23324ae1
FM
1440 @library{wxcore}
1441 @category{winlayout}
7c913512 1442
e54c96f1
FM
1443 @see wxSizer, wxStaticBox, wxBoxSizer, @ref overview_sizeroverview "Sizer
1444 overview"
23324ae1
FM
1445*/
1446class wxStaticBoxSizer : public wxBoxSizer
1447{
1448public:
1449 //@{
1450 /**
1451 The first constructor uses an already existing static box. It takes the
1452 associated static box and the orientation @e orient, which can be either
1453 @c wxVERTICAL or @c wxHORIZONTAL as parameters.
23324ae1
FM
1454 The second one creates a new static box with the given label and parent window.
1455 */
1456 wxStaticBoxSizer(wxStaticBox* box, int orient);
7c913512
FM
1457 wxStaticBoxSizer(int orient, wxWindow parent,
1458 const wxString& label = wxEmptyString);
23324ae1
FM
1459 //@}
1460
1461 /**
1462 Returns the static box associated with the sizer.
1463 */
1464 wxStaticBox* GetStaticBox();
1465};
1466
1467
e54c96f1 1468
23324ae1
FM
1469/**
1470 @class wxBoxSizer
1471 @wxheader{sizer.h}
7c913512 1472
23324ae1
FM
1473 The basic idea behind a box sizer is that windows will most often be laid out
1474 in rather
1475 simple basic geometry, typically in a row or a column or several hierarchies of
1476 either.
7c913512 1477
23324ae1
FM
1478 For more information, please see @ref overview_boxsizerprogramming "Programming
1479 with wxBoxSizer".
7c913512 1480
23324ae1
FM
1481 @library{wxcore}
1482 @category{winlayout}
7c913512 1483
e54c96f1 1484 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
23324ae1
FM
1485*/
1486class wxBoxSizer : public wxSizer
1487{
1488public:
1489 /**
4cc4bfaf 1490 Constructor for a wxBoxSizer. @a orient may be either of wxVERTICAL
23324ae1
FM
1491 or wxHORIZONTAL for creating either a column sizer or a row sizer.
1492 */
1493 wxBoxSizer(int orient);
1494
1495 /**
1496 Implements the calculation of a box sizer's minimal. It is used internally
1497 only and must not be called by the user. Documented for information.
1498 */
1499 wxSize CalcMin();
1500
1501 /**
1502 Returns the orientation of the box sizer, either wxVERTICAL
1503 or wxHORIZONTAL.
1504 */
1505 int GetOrientation();
1506
1507 /**
1508 Implements the calculation of a box sizer's dimensions and then sets
7c913512 1509 the size of its children (calling wxWindow::SetSize
23324ae1
FM
1510 if the child is a window). It is used internally only and must not be called
1511 by the user (call Layout() if you want to resize). Documented for information.
1512 */
1513 void RecalcSizes();
1514};
e54c96f1 1515