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