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