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