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