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