]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/sizer.h | |
3 | // Purpose: provide wxSizer class for layout | |
4 | // Author: Robert Roebling and Robin Dunn | |
5 | // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) | |
6 | // Created: | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Robin Dunn, Robert Roebling | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __WXSIZER_H__ | |
13 | #define __WXSIZER_H__ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | ||
17 | #include "wx/window.h" | |
18 | ||
19 | //--------------------------------------------------------------------------- | |
20 | // classes | |
21 | //--------------------------------------------------------------------------- | |
22 | ||
23 | class WXDLLIMPEXP_FWD_CORE wxButton; | |
24 | class WXDLLIMPEXP_FWD_CORE wxBoxSizer; | |
25 | class WXDLLIMPEXP_FWD_CORE wxSizerItem; | |
26 | class WXDLLIMPEXP_FWD_CORE wxSizer; | |
27 | ||
28 | #ifndef wxUSE_BORDER_BY_DEFAULT | |
29 | #ifdef __SMARTPHONE__ | |
30 | // no borders by default on limited size screen | |
31 | #define wxUSE_BORDER_BY_DEFAULT 0 | |
32 | #else | |
33 | #define wxUSE_BORDER_BY_DEFAULT 1 | |
34 | #endif | |
35 | #endif | |
36 | ||
37 | // ---------------------------------------------------------------------------- | |
38 | // wxSizerFlags: flags used for an item in the sizer | |
39 | // ---------------------------------------------------------------------------- | |
40 | ||
41 | class WXDLLIMPEXP_CORE wxSizerFlags | |
42 | { | |
43 | public: | |
44 | // construct the flags object initialized with the given proportion (0 by | |
45 | // default) | |
46 | wxSizerFlags(int proportion = 0) : m_proportion(proportion) | |
47 | { | |
48 | m_flags = 0; | |
49 | m_borderInPixels = 0; | |
50 | } | |
51 | ||
52 | // setters for all sizer flags, they all return the object itself so that | |
53 | // calls to them can be chained | |
54 | ||
55 | wxSizerFlags& Proportion(int proportion) | |
56 | { | |
57 | m_proportion = proportion; | |
58 | return *this; | |
59 | } | |
60 | ||
61 | wxSizerFlags& Align(int alignment) // combination of wxAlignment values | |
62 | { | |
63 | m_flags &= ~wxALIGN_MASK; | |
64 | m_flags |= alignment; | |
65 | ||
66 | return *this; | |
67 | } | |
68 | ||
69 | wxSizerFlags& Expand() | |
70 | { | |
71 | m_flags |= wxEXPAND; | |
72 | return *this; | |
73 | } | |
74 | ||
75 | // some shortcuts for Align() | |
76 | wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } | |
77 | wxSizerFlags& Center() { return Centre(); } | |
78 | wxSizerFlags& Top() { return Align(wxALIGN_TOP); } | |
79 | wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } | |
80 | wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } | |
81 | wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } | |
82 | ||
83 | // default border size used by Border() below | |
84 | static int GetDefaultBorder() | |
85 | { | |
86 | #if wxUSE_BORDER_BY_DEFAULT | |
87 | #ifdef __WXGTK20__ | |
88 | // GNOME HIG says to use 6px as the base unit: | |
89 | // http://library.gnome.org/devel/hig-book/stable/design-window.html.en | |
90 | return 6; | |
91 | #else | |
92 | // FIXME: default border size shouldn't be hardcoded and at the very | |
93 | // least they should depend on the current font size | |
94 | return 5; | |
95 | #endif | |
96 | #else | |
97 | return 0; | |
98 | #endif | |
99 | } | |
100 | ||
101 | ||
102 | wxSizerFlags& Border(int direction, int borderInPixels) | |
103 | { | |
104 | m_flags &= ~wxALL; | |
105 | m_flags |= direction; | |
106 | ||
107 | m_borderInPixels = borderInPixels; | |
108 | ||
109 | return *this; | |
110 | } | |
111 | ||
112 | wxSizerFlags& Border(int direction = wxALL) | |
113 | { | |
114 | #if wxUSE_BORDER_BY_DEFAULT | |
115 | return Border(direction, GetDefaultBorder()); | |
116 | #else | |
117 | // no borders by default on limited size screen | |
118 | wxUnusedVar(direction); | |
119 | ||
120 | return *this; | |
121 | #endif | |
122 | } | |
123 | ||
124 | wxSizerFlags& DoubleBorder(int direction = wxALL) | |
125 | { | |
126 | #if wxUSE_BORDER_BY_DEFAULT | |
127 | return Border(direction, 2*GetDefaultBorder()); | |
128 | #else | |
129 | wxUnusedVar(direction); | |
130 | ||
131 | return *this; | |
132 | #endif | |
133 | } | |
134 | ||
135 | wxSizerFlags& TripleBorder(int direction = wxALL) | |
136 | { | |
137 | #if wxUSE_BORDER_BY_DEFAULT | |
138 | return Border(direction, 3*GetDefaultBorder()); | |
139 | #else | |
140 | wxUnusedVar(direction); | |
141 | ||
142 | return *this; | |
143 | #endif | |
144 | } | |
145 | ||
146 | wxSizerFlags& HorzBorder() | |
147 | { | |
148 | #if wxUSE_BORDER_BY_DEFAULT | |
149 | return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); | |
150 | #else | |
151 | return *this; | |
152 | #endif | |
153 | } | |
154 | ||
155 | wxSizerFlags& DoubleHorzBorder() | |
156 | { | |
157 | #if wxUSE_BORDER_BY_DEFAULT | |
158 | return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); | |
159 | #else | |
160 | return *this; | |
161 | #endif | |
162 | } | |
163 | ||
164 | // setters for the others flags | |
165 | wxSizerFlags& Shaped() | |
166 | { | |
167 | m_flags |= wxSHAPED; | |
168 | ||
169 | return *this; | |
170 | } | |
171 | ||
172 | wxSizerFlags& FixedMinSize() | |
173 | { | |
174 | m_flags |= wxFIXED_MINSIZE; | |
175 | ||
176 | return *this; | |
177 | } | |
178 | ||
179 | // makes the item ignore window's visibility status | |
180 | wxSizerFlags& ReserveSpaceEvenIfHidden() | |
181 | { | |
182 | m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN; | |
183 | return *this; | |
184 | } | |
185 | ||
186 | // accessors for wxSizer only | |
187 | int GetProportion() const { return m_proportion; } | |
188 | int GetFlags() const { return m_flags; } | |
189 | int GetBorderInPixels() const { return m_borderInPixels; } | |
190 | ||
191 | private: | |
192 | int m_proportion; | |
193 | int m_flags; | |
194 | int m_borderInPixels; | |
195 | }; | |
196 | ||
197 | ||
198 | // ---------------------------------------------------------------------------- | |
199 | // wxSizerSpacer: used by wxSizerItem to represent a spacer | |
200 | // ---------------------------------------------------------------------------- | |
201 | ||
202 | class WXDLLIMPEXP_CORE wxSizerSpacer | |
203 | { | |
204 | public: | |
205 | wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } | |
206 | ||
207 | void SetSize(const wxSize& size) { m_size = size; } | |
208 | const wxSize& GetSize() const { return m_size; } | |
209 | ||
210 | void Show(bool show) { m_isShown = show; } | |
211 | bool IsShown() const { return m_isShown; } | |
212 | ||
213 | private: | |
214 | // the size, in pixel | |
215 | wxSize m_size; | |
216 | ||
217 | // is the spacer currently shown? | |
218 | bool m_isShown; | |
219 | }; | |
220 | ||
221 | // ---------------------------------------------------------------------------- | |
222 | // wxSizerItem | |
223 | // ---------------------------------------------------------------------------- | |
224 | ||
225 | class WXDLLIMPEXP_CORE wxSizerItem : public wxObject | |
226 | { | |
227 | public: | |
228 | // window | |
229 | wxSizerItem( wxWindow *window, | |
230 | int proportion, | |
231 | int flag, | |
232 | int border, | |
233 | wxObject* userData ); | |
234 | ||
235 | // window with flags | |
236 | wxSizerItem(wxWindow *window, const wxSizerFlags& flags) | |
237 | { | |
238 | Init(flags); | |
239 | ||
240 | DoSetWindow(window); | |
241 | } | |
242 | ||
243 | // subsizer | |
244 | wxSizerItem( wxSizer *sizer, | |
245 | int proportion, | |
246 | int flag, | |
247 | int border, | |
248 | wxObject* userData ); | |
249 | ||
250 | // sizer with flags | |
251 | wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) | |
252 | { | |
253 | Init(flags); | |
254 | ||
255 | DoSetSizer(sizer); | |
256 | } | |
257 | ||
258 | // spacer | |
259 | wxSizerItem( int width, | |
260 | int height, | |
261 | int proportion, | |
262 | int flag, | |
263 | int border, | |
264 | wxObject* userData); | |
265 | ||
266 | // spacer with flags | |
267 | wxSizerItem(int width, int height, const wxSizerFlags& flags) | |
268 | { | |
269 | Init(flags); | |
270 | ||
271 | DoSetSpacer(wxSize(width, height)); | |
272 | } | |
273 | ||
274 | wxSizerItem(); | |
275 | virtual ~wxSizerItem(); | |
276 | ||
277 | virtual void DeleteWindows(); | |
278 | ||
279 | // Enable deleting the SizerItem without destroying the contained sizer. | |
280 | void DetachSizer() { m_sizer = NULL; } | |
281 | ||
282 | virtual wxSize GetSize() const; | |
283 | virtual wxSize CalcMin(); | |
284 | virtual void SetDimension( const wxPoint& pos, const wxSize& size ); | |
285 | ||
286 | wxSize GetMinSize() const | |
287 | { return m_minSize; } | |
288 | wxSize GetMinSizeWithBorder() const; | |
289 | ||
290 | void SetMinSize(const wxSize& size) | |
291 | { | |
292 | if ( IsWindow() ) | |
293 | m_window->SetMinSize(size); | |
294 | m_minSize = size; | |
295 | } | |
296 | void SetMinSize( int x, int y ) | |
297 | { SetMinSize(wxSize(x, y)); } | |
298 | void SetInitSize( int x, int y ) | |
299 | { SetMinSize(wxSize(x, y)); } | |
300 | ||
301 | // if either of dimensions is zero, ratio is assumed to be 1 | |
302 | // to avoid "divide by zero" errors | |
303 | void SetRatio(int width, int height) | |
304 | { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } | |
305 | void SetRatio(const wxSize& size) | |
306 | { SetRatio(size.x, size.y); } | |
307 | void SetRatio(float ratio) | |
308 | { m_ratio = ratio; } | |
309 | float GetRatio() const | |
310 | { return m_ratio; } | |
311 | ||
312 | virtual wxRect GetRect() { return m_rect; } | |
313 | ||
314 | // set a sizer item id (different from a window id, all sizer items, | |
315 | // including spacers, can have an associated id) | |
316 | void SetId(int id) { m_id = id; } | |
317 | int GetId() const { return m_id; } | |
318 | ||
319 | bool IsWindow() const { return m_kind == Item_Window; } | |
320 | bool IsSizer() const { return m_kind == Item_Sizer; } | |
321 | bool IsSpacer() const { return m_kind == Item_Spacer; } | |
322 | ||
323 | #if WXWIN_COMPATIBILITY_2_6 | |
324 | // Deprecated in 2.6, use {G,S}etProportion instead. | |
325 | wxDEPRECATED( void SetOption( int option ) ); | |
326 | wxDEPRECATED( int GetOption() const ); | |
327 | #endif // WXWIN_COMPATIBILITY_2_6 | |
328 | ||
329 | void SetProportion( int proportion ) | |
330 | { m_proportion = proportion; } | |
331 | int GetProportion() const | |
332 | { return m_proportion; } | |
333 | void SetFlag( int flag ) | |
334 | { m_flag = flag; } | |
335 | int GetFlag() const | |
336 | { return m_flag; } | |
337 | void SetBorder( int border ) | |
338 | { m_border = border; } | |
339 | int GetBorder() const | |
340 | { return m_border; } | |
341 | ||
342 | wxWindow *GetWindow() const | |
343 | { return m_kind == Item_Window ? m_window : NULL; } | |
344 | wxSizer *GetSizer() const | |
345 | { return m_kind == Item_Sizer ? m_sizer : NULL; } | |
346 | wxSize GetSpacer() const; | |
347 | ||
348 | // This function behaves obviously for the windows and spacers but for the | |
349 | // sizers it returns true if any sizer element is shown and only returns | |
350 | // false if all of them are hidden. Also, it always returns true if | |
351 | // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used. | |
352 | bool IsShown() const; | |
353 | ||
354 | void Show(bool show); | |
355 | ||
356 | void SetUserData(wxObject* userData) | |
357 | { delete m_userData; m_userData = userData; } | |
358 | wxObject* GetUserData() const | |
359 | { return m_userData; } | |
360 | wxPoint GetPosition() const | |
361 | { return m_pos; } | |
362 | ||
363 | // Called once the first component of an item has been decided. This is | |
364 | // used in algorithms that depend on knowing the size in one direction | |
365 | // before the min size in the other direction can be known. | |
366 | // Returns true if it made use of the information (and min size was changed). | |
367 | bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 ); | |
368 | ||
369 | // these functions delete the current contents of the item if it's a sizer | |
370 | // or a spacer but not if it is a window | |
371 | void AssignWindow(wxWindow *window) | |
372 | { | |
373 | Free(); | |
374 | DoSetWindow(window); | |
375 | } | |
376 | ||
377 | void AssignSizer(wxSizer *sizer) | |
378 | { | |
379 | Free(); | |
380 | DoSetSizer(sizer); | |
381 | } | |
382 | ||
383 | void AssignSpacer(const wxSize& size) | |
384 | { | |
385 | Free(); | |
386 | DoSetSpacer(size); | |
387 | } | |
388 | ||
389 | void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } | |
390 | ||
391 | #if WXWIN_COMPATIBILITY_2_8 | |
392 | // these functions do not free the old sizer/spacer and so can easily | |
393 | // provoke the memory leaks and so shouldn't be used, use Assign() instead | |
394 | wxDEPRECATED( void SetWindow(wxWindow *window) ); | |
395 | wxDEPRECATED( void SetSizer(wxSizer *sizer) ); | |
396 | wxDEPRECATED( void SetSpacer(const wxSize& size) ); | |
397 | wxDEPRECATED( void SetSpacer(int width, int height) ); | |
398 | #endif // WXWIN_COMPATIBILITY_2_8 | |
399 | ||
400 | protected: | |
401 | // common part of several ctors | |
402 | void Init() { m_userData = NULL; m_kind = Item_None; } | |
403 | ||
404 | // common part of ctors taking wxSizerFlags | |
405 | void Init(const wxSizerFlags& flags); | |
406 | ||
407 | // free current contents | |
408 | void Free(); | |
409 | ||
410 | // common parts of Set/AssignXXX() | |
411 | void DoSetWindow(wxWindow *window); | |
412 | void DoSetSizer(wxSizer *sizer); | |
413 | void DoSetSpacer(const wxSize& size); | |
414 | ||
415 | // discriminated union: depending on m_kind one of the fields is valid | |
416 | enum | |
417 | { | |
418 | Item_None, | |
419 | Item_Window, | |
420 | Item_Sizer, | |
421 | Item_Spacer, | |
422 | Item_Max | |
423 | } m_kind; | |
424 | union | |
425 | { | |
426 | wxWindow *m_window; | |
427 | wxSizer *m_sizer; | |
428 | wxSizerSpacer *m_spacer; | |
429 | }; | |
430 | ||
431 | wxPoint m_pos; | |
432 | wxSize m_minSize; | |
433 | int m_proportion; | |
434 | int m_border; | |
435 | int m_flag; | |
436 | int m_id; | |
437 | ||
438 | // on screen rectangle of this item (not including borders) | |
439 | wxRect m_rect; | |
440 | ||
441 | // Aspect ratio can always be calculated from m_size, | |
442 | // but this would cause precision loss when the window | |
443 | // is shrunk. It is safer to preserve the initial value. | |
444 | float m_ratio; | |
445 | ||
446 | wxObject *m_userData; | |
447 | ||
448 | private: | |
449 | DECLARE_CLASS(wxSizerItem) | |
450 | DECLARE_NO_COPY_CLASS(wxSizerItem) | |
451 | }; | |
452 | ||
453 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); | |
454 | ||
455 | ||
456 | //--------------------------------------------------------------------------- | |
457 | // wxSizer | |
458 | //--------------------------------------------------------------------------- | |
459 | ||
460 | class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer | |
461 | { | |
462 | public: | |
463 | wxSizer() { m_containingWindow = NULL; } | |
464 | virtual ~wxSizer(); | |
465 | ||
466 | // methods for adding elements to the sizer: there are Add/Insert/Prepend | |
467 | // overloads for each of window/sizer/spacer/wxSizerItem | |
468 | wxSizerItem* Add(wxWindow *window, | |
469 | int proportion = 0, | |
470 | int flag = 0, | |
471 | int border = 0, | |
472 | wxObject* userData = NULL); | |
473 | wxSizerItem* Add(wxSizer *sizer, | |
474 | int proportion = 0, | |
475 | int flag = 0, | |
476 | int border = 0, | |
477 | wxObject* userData = NULL); | |
478 | wxSizerItem* Add(int width, | |
479 | int height, | |
480 | int proportion = 0, | |
481 | int flag = 0, | |
482 | int border = 0, | |
483 | wxObject* userData = NULL); | |
484 | wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); | |
485 | wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); | |
486 | wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); | |
487 | wxSizerItem* Add( wxSizerItem *item); | |
488 | ||
489 | wxSizerItem* AddSpacer(int size); | |
490 | wxSizerItem* AddStretchSpacer(int prop = 1); | |
491 | ||
492 | wxSizerItem* Insert(size_t index, | |
493 | wxWindow *window, | |
494 | int proportion = 0, | |
495 | int flag = 0, | |
496 | int border = 0, | |
497 | wxObject* userData = NULL); | |
498 | wxSizerItem* Insert(size_t index, | |
499 | wxSizer *sizer, | |
500 | int proportion = 0, | |
501 | int flag = 0, | |
502 | int border = 0, | |
503 | wxObject* userData = NULL); | |
504 | wxSizerItem* Insert(size_t index, | |
505 | int width, | |
506 | int height, | |
507 | int proportion = 0, | |
508 | int flag = 0, | |
509 | int border = 0, | |
510 | wxObject* userData = NULL); | |
511 | wxSizerItem* Insert(size_t index, | |
512 | wxWindow *window, | |
513 | const wxSizerFlags& flags); | |
514 | wxSizerItem* Insert(size_t index, | |
515 | wxSizer *sizer, | |
516 | const wxSizerFlags& flags); | |
517 | wxSizerItem* Insert(size_t index, | |
518 | int width, | |
519 | int height, | |
520 | const wxSizerFlags& flags); | |
521 | virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); | |
522 | ||
523 | wxSizerItem* InsertSpacer(size_t index, int size); | |
524 | wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); | |
525 | ||
526 | wxSizerItem* Prepend(wxWindow *window, | |
527 | int proportion = 0, | |
528 | int flag = 0, | |
529 | int border = 0, | |
530 | wxObject* userData = NULL); | |
531 | wxSizerItem* Prepend(wxSizer *sizer, | |
532 | int proportion = 0, | |
533 | int flag = 0, | |
534 | int border = 0, | |
535 | wxObject* userData = NULL); | |
536 | wxSizerItem* Prepend(int width, | |
537 | int height, | |
538 | int proportion = 0, | |
539 | int flag = 0, | |
540 | int border = 0, | |
541 | wxObject* userData = NULL); | |
542 | wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); | |
543 | wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); | |
544 | wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); | |
545 | wxSizerItem* Prepend(wxSizerItem *item); | |
546 | ||
547 | wxSizerItem* PrependSpacer(int size); | |
548 | wxSizerItem* PrependStretchSpacer(int prop = 1); | |
549 | ||
550 | // set (or possibly unset if window is NULL) or get the window this sizer | |
551 | // is used in | |
552 | void SetContainingWindow(wxWindow *window); | |
553 | wxWindow *GetContainingWindow() const { return m_containingWindow; } | |
554 | ||
555 | #if WXWIN_COMPATIBILITY_2_6 | |
556 | // Deprecated in 2.6 since historically it does not delete the window, | |
557 | // use Detach instead. | |
558 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
559 | #endif // WXWIN_COMPATIBILITY_2_6 | |
560 | ||
561 | virtual bool Remove( wxSizer *sizer ); | |
562 | virtual bool Remove( int index ); | |
563 | ||
564 | virtual bool Detach( wxWindow *window ); | |
565 | virtual bool Detach( wxSizer *sizer ); | |
566 | virtual bool Detach( int index ); | |
567 | ||
568 | virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); | |
569 | virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); | |
570 | virtual bool Replace( size_t index, wxSizerItem *newitem ); | |
571 | ||
572 | virtual void Clear( bool delete_windows = false ); | |
573 | virtual void DeleteWindows(); | |
574 | ||
575 | // Inform sizer about the first direction that has been decided (by parent item) | |
576 | // Returns true if it made use of the informtion (and recalculated min size) | |
577 | virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) ) | |
578 | { return false; } | |
579 | ||
580 | void SetMinSize( int width, int height ) | |
581 | { DoSetMinSize( width, height ); } | |
582 | void SetMinSize( const wxSize& size ) | |
583 | { DoSetMinSize( size.x, size.y ); } | |
584 | ||
585 | // Searches recursively | |
586 | bool SetItemMinSize( wxWindow *window, int width, int height ) | |
587 | { return DoSetItemMinSize( window, width, height ); } | |
588 | bool SetItemMinSize( wxWindow *window, const wxSize& size ) | |
589 | { return DoSetItemMinSize( window, size.x, size.y ); } | |
590 | ||
591 | // Searches recursively | |
592 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) | |
593 | { return DoSetItemMinSize( sizer, width, height ); } | |
594 | bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) | |
595 | { return DoSetItemMinSize( sizer, size.x, size.y ); } | |
596 | ||
597 | bool SetItemMinSize( size_t index, int width, int height ) | |
598 | { return DoSetItemMinSize( index, width, height ); } | |
599 | bool SetItemMinSize( size_t index, const wxSize& size ) | |
600 | { return DoSetItemMinSize( index, size.x, size.y ); } | |
601 | ||
602 | wxSize GetSize() const | |
603 | { return m_size; } | |
604 | wxPoint GetPosition() const | |
605 | { return m_position; } | |
606 | ||
607 | // Calculate the minimal size or return m_minSize if bigger. | |
608 | wxSize GetMinSize(); | |
609 | ||
610 | // These virtual functions are used by the layout algorithm: first | |
611 | // CalcMin() is called to calculate the minimal size of the sizer and | |
612 | // prepare for laying it out and then RecalcSizes() is called to really | |
613 | // update all the sizer items | |
614 | virtual wxSize CalcMin() = 0; | |
615 | virtual void RecalcSizes() = 0; | |
616 | ||
617 | virtual void Layout(); | |
618 | ||
619 | wxSize ComputeFittingClientSize(wxWindow *window); | |
620 | wxSize ComputeFittingWindowSize(wxWindow *window); | |
621 | ||
622 | wxSize Fit( wxWindow *window ); | |
623 | void FitInside( wxWindow *window ); | |
624 | void SetSizeHints( wxWindow *window ); | |
625 | #if WXWIN_COMPATIBILITY_2_8 | |
626 | // This only calls FitInside() since 2.9 | |
627 | wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) ); | |
628 | #endif | |
629 | ||
630 | wxSizerItemList& GetChildren() | |
631 | { return m_children; } | |
632 | const wxSizerItemList& GetChildren() const | |
633 | { return m_children; } | |
634 | ||
635 | void SetDimension(const wxPoint& pos, const wxSize& size) | |
636 | { | |
637 | m_position = pos; | |
638 | m_size = size; | |
639 | Layout(); | |
640 | } | |
641 | void SetDimension(int x, int y, int width, int height) | |
642 | { SetDimension(wxPoint(x, y), wxSize(width, height)); } | |
643 | ||
644 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); | |
645 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
646 | wxSizerItem* GetItem( size_t index ); | |
647 | wxSizerItem* GetItemById( int id, bool recursive = false ); | |
648 | ||
649 | // Manage whether individual scene items are considered | |
650 | // in the layout calculations or not. | |
651 | bool Show( wxWindow *window, bool show = true, bool recursive = false ); | |
652 | bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); | |
653 | bool Show( size_t index, bool show = true ); | |
654 | ||
655 | bool Hide( wxSizer *sizer, bool recursive = false ) | |
656 | { return Show( sizer, false, recursive ); } | |
657 | bool Hide( wxWindow *window, bool recursive = false ) | |
658 | { return Show( window, false, recursive ); } | |
659 | bool Hide( size_t index ) | |
660 | { return Show( index, false ); } | |
661 | ||
662 | bool IsShown( wxWindow *window ) const; | |
663 | bool IsShown( wxSizer *sizer ) const; | |
664 | bool IsShown( size_t index ) const; | |
665 | ||
666 | // Recursively call wxWindow::Show () on all sizer items. | |
667 | virtual void ShowItems (bool show); | |
668 | ||
669 | void Show(bool show) { ShowItems(show); } | |
670 | ||
671 | protected: | |
672 | wxSize m_size; | |
673 | wxSize m_minSize; | |
674 | wxPoint m_position; | |
675 | wxSizerItemList m_children; | |
676 | ||
677 | // the window this sizer is used in, can be NULL | |
678 | wxWindow *m_containingWindow; | |
679 | ||
680 | wxSize GetMaxClientSize( wxWindow *window ) const; | |
681 | wxSize GetMinClientSize( wxWindow *window ); | |
682 | wxSize VirtualFitSize( wxWindow *window ); | |
683 | ||
684 | virtual void DoSetMinSize( int width, int height ); | |
685 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
686 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
687 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); | |
688 | ||
689 | private: | |
690 | DECLARE_CLASS(wxSizer) | |
691 | }; | |
692 | ||
693 | //--------------------------------------------------------------------------- | |
694 | // wxGridSizer | |
695 | //--------------------------------------------------------------------------- | |
696 | ||
697 | class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer | |
698 | { | |
699 | public: | |
700 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
701 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
702 | ||
703 | virtual void RecalcSizes(); | |
704 | virtual wxSize CalcMin(); | |
705 | ||
706 | void SetCols( int cols ) { m_cols = cols; } | |
707 | void SetRows( int rows ) { m_rows = rows; } | |
708 | void SetVGap( int gap ) { m_vgap = gap; } | |
709 | void SetHGap( int gap ) { m_hgap = gap; } | |
710 | int GetCols() const { return m_cols; } | |
711 | int GetRows() const { return m_rows; } | |
712 | int GetVGap() const { return m_vgap; } | |
713 | int GetHGap() const { return m_hgap; } | |
714 | ||
715 | protected: | |
716 | int m_rows; | |
717 | int m_cols; | |
718 | int m_vgap; | |
719 | int m_hgap; | |
720 | ||
721 | // return the number of total items and the number of columns and rows | |
722 | int CalcRowsCols(int& rows, int& cols) const; | |
723 | ||
724 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); | |
725 | ||
726 | private: | |
727 | DECLARE_CLASS(wxGridSizer) | |
728 | }; | |
729 | ||
730 | //--------------------------------------------------------------------------- | |
731 | // wxFlexGridSizer | |
732 | //--------------------------------------------------------------------------- | |
733 | ||
734 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" | |
735 | // direction | |
736 | enum wxFlexSizerGrowMode | |
737 | { | |
738 | // don't resize the cells in non-flexible direction at all | |
739 | wxFLEX_GROWMODE_NONE, | |
740 | ||
741 | // uniformly resize only the specified ones (default) | |
742 | wxFLEX_GROWMODE_SPECIFIED, | |
743 | ||
744 | // uniformly resize all cells | |
745 | wxFLEX_GROWMODE_ALL | |
746 | }; | |
747 | ||
748 | class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer | |
749 | { | |
750 | public: | |
751 | // ctors/dtor | |
752 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); | |
753 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
754 | virtual ~wxFlexGridSizer(); | |
755 | ||
756 | ||
757 | // set the rows/columns which will grow (the others will remain of the | |
758 | // constant initial size) | |
759 | void AddGrowableRow( size_t idx, int proportion = 0 ); | |
760 | void RemoveGrowableRow( size_t idx ); | |
761 | void AddGrowableCol( size_t idx, int proportion = 0 ); | |
762 | void RemoveGrowableCol( size_t idx ); | |
763 | ||
764 | ||
765 | // the sizer cells may grow in both directions, not grow at all or only | |
766 | // grow in one direction but not the other | |
767 | ||
768 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
769 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
770 | int GetFlexibleDirection() const { return m_flexDirection; } | |
771 | ||
772 | // note that the grow mode only applies to the direction which is not | |
773 | // flexible | |
774 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
775 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
776 | ||
777 | // Read-only access to the row heights and col widths arrays | |
778 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
779 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
780 | ||
781 | // implementation | |
782 | virtual void RecalcSizes(); | |
783 | virtual wxSize CalcMin(); | |
784 | ||
785 | protected: | |
786 | void AdjustForFlexDirection(); | |
787 | void AdjustForGrowables(const wxSize& sz); | |
788 | void FindWidthsAndHeights(int nrows, int ncols); | |
789 | ||
790 | // the heights/widths of all rows/columns | |
791 | wxArrayInt m_rowHeights, | |
792 | m_colWidths; | |
793 | ||
794 | // indices of the growable columns and rows | |
795 | wxArrayInt m_growableRows, | |
796 | m_growableCols; | |
797 | ||
798 | // proportion values of the corresponding growable rows and columns | |
799 | wxArrayInt m_growableRowsProportions, | |
800 | m_growableColsProportions; | |
801 | ||
802 | // parameters describing whether the growable cells should be resized in | |
803 | // both directions or only one | |
804 | int m_flexDirection; | |
805 | wxFlexSizerGrowMode m_growMode; | |
806 | ||
807 | // saves CalcMin result to optimize RecalcSizes | |
808 | wxSize m_calculatedMinSize; | |
809 | ||
810 | private: | |
811 | DECLARE_CLASS(wxFlexGridSizer) | |
812 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) | |
813 | }; | |
814 | ||
815 | //--------------------------------------------------------------------------- | |
816 | // wxBoxSizer | |
817 | //--------------------------------------------------------------------------- | |
818 | ||
819 | class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer | |
820 | { | |
821 | public: | |
822 | wxBoxSizer(int orient) | |
823 | { | |
824 | m_orient = orient; | |
825 | m_totalProportion = 0; | |
826 | ||
827 | wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL, | |
828 | _T("invalid value for wxBoxSizer orientation") ); | |
829 | } | |
830 | ||
831 | int GetOrientation() const { return m_orient; } | |
832 | ||
833 | bool IsVertical() const { return m_orient == wxVERTICAL; } | |
834 | ||
835 | void SetOrientation(int orient) { m_orient = orient; } | |
836 | ||
837 | // implementation of our resizing logic | |
838 | virtual wxSize CalcMin(); | |
839 | virtual void RecalcSizes(); | |
840 | ||
841 | protected: | |
842 | // helpers for our code: this returns the component of the given wxSize in | |
843 | // the direction of the sizer and in the other direction, respectively | |
844 | int GetSizeInMajorDir(const wxSize& sz) const | |
845 | { | |
846 | return m_orient == wxHORIZONTAL ? sz.x : sz.y; | |
847 | } | |
848 | ||
849 | int& SizeInMajorDir(wxSize& sz) | |
850 | { | |
851 | return m_orient == wxHORIZONTAL ? sz.x : sz.y; | |
852 | } | |
853 | ||
854 | int& PosInMajorDir(wxPoint& pt) | |
855 | { | |
856 | return m_orient == wxHORIZONTAL ? pt.x : pt.y; | |
857 | } | |
858 | ||
859 | int GetSizeInMinorDir(const wxSize& sz) const | |
860 | { | |
861 | return m_orient == wxHORIZONTAL ? sz.y : sz.x; | |
862 | } | |
863 | ||
864 | int& SizeInMinorDir(wxSize& sz) | |
865 | { | |
866 | return m_orient == wxHORIZONTAL ? sz.y : sz.x; | |
867 | } | |
868 | ||
869 | int& PosInMinorDir(wxPoint& pt) | |
870 | { | |
871 | return m_orient == wxHORIZONTAL ? pt.y : pt.x; | |
872 | } | |
873 | ||
874 | // another helper: creates wxSize from major and minor components | |
875 | wxSize SizeFromMajorMinor(int major, int minor) const | |
876 | { | |
877 | if ( m_orient == wxHORIZONTAL ) | |
878 | { | |
879 | return wxSize(major, minor); | |
880 | } | |
881 | else // wxVERTICAL | |
882 | { | |
883 | return wxSize(minor, major); | |
884 | } | |
885 | } | |
886 | ||
887 | ||
888 | // either wxHORIZONTAL or wxVERTICAL | |
889 | int m_orient; | |
890 | ||
891 | // the sum of proportion of all of our elements | |
892 | int m_totalProportion; | |
893 | ||
894 | // the minimal size needed for this sizer as calculated by the last call to | |
895 | // our CalcMin() | |
896 | wxSize m_minSize; | |
897 | ||
898 | private: | |
899 | DECLARE_CLASS(wxBoxSizer) | |
900 | }; | |
901 | ||
902 | //--------------------------------------------------------------------------- | |
903 | // wxStaticBoxSizer | |
904 | //--------------------------------------------------------------------------- | |
905 | ||
906 | #if wxUSE_STATBOX | |
907 | ||
908 | class WXDLLIMPEXP_FWD_CORE wxStaticBox; | |
909 | ||
910 | class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer | |
911 | { | |
912 | public: | |
913 | wxStaticBoxSizer(wxStaticBox *box, int orient); | |
914 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); | |
915 | virtual ~wxStaticBoxSizer(); | |
916 | ||
917 | void RecalcSizes(); | |
918 | wxSize CalcMin(); | |
919 | ||
920 | wxStaticBox *GetStaticBox() const | |
921 | { return m_staticBox; } | |
922 | ||
923 | // override to hide/show the static box as well | |
924 | virtual void ShowItems (bool show); | |
925 | ||
926 | virtual bool Detach( wxWindow *window ); | |
927 | virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } | |
928 | virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } | |
929 | ||
930 | protected: | |
931 | wxStaticBox *m_staticBox; | |
932 | ||
933 | private: | |
934 | DECLARE_CLASS(wxStaticBoxSizer) | |
935 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) | |
936 | }; | |
937 | ||
938 | #endif // wxUSE_STATBOX | |
939 | ||
940 | #if wxUSE_BUTTON | |
941 | ||
942 | class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer | |
943 | { | |
944 | public: | |
945 | // Constructor just creates a new wxBoxSizer, not much else. | |
946 | // Box sizer orientation is automatically determined here: | |
947 | // vertical for PDAs, horizontal for everything else? | |
948 | wxStdDialogButtonSizer(); | |
949 | ||
950 | // Checks button ID against system IDs and sets one of the pointers below | |
951 | // to this button. Does not do any sizer-related things here. | |
952 | void AddButton(wxButton *button); | |
953 | ||
954 | // Use these if no standard ID can/should be used | |
955 | void SetAffirmativeButton( wxButton *button ); | |
956 | void SetNegativeButton( wxButton *button ); | |
957 | void SetCancelButton( wxButton *button ); | |
958 | ||
959 | // All platform-specific code here, checks which buttons exist and add | |
960 | // them to the sizer accordingly. | |
961 | // Note - one potential hack on Mac we could use here, | |
962 | // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE | |
963 | // is set to _("Save") and m_buttonNegative is set to _("Don't Save") | |
964 | // I wouldn't add any other hacks like that into here, | |
965 | // but this one I can see being useful. | |
966 | void Realize(); | |
967 | ||
968 | wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } | |
969 | wxButton *GetApplyButton() const { return m_buttonApply; } | |
970 | wxButton *GetNegativeButton() const { return m_buttonNegative; } | |
971 | wxButton *GetCancelButton() const { return m_buttonCancel; } | |
972 | wxButton *GetHelpButton() const { return m_buttonHelp; } | |
973 | ||
974 | protected: | |
975 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here | |
976 | wxButton *m_buttonApply; // wxID_APPLY | |
977 | wxButton *m_buttonNegative; // wxID_NO | |
978 | wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE | |
979 | wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP | |
980 | ||
981 | private: | |
982 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
983 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) | |
984 | }; | |
985 | ||
986 | #endif // wxUSE_BUTTON | |
987 | ||
988 | ||
989 | // ---------------------------------------------------------------------------- | |
990 | // inline functions implementation | |
991 | // ---------------------------------------------------------------------------- | |
992 | ||
993 | #if WXWIN_COMPATIBILITY_2_8 | |
994 | ||
995 | inline void wxSizerItem::SetWindow(wxWindow *window) | |
996 | { | |
997 | DoSetWindow(window); | |
998 | } | |
999 | ||
1000 | inline void wxSizerItem::SetSizer(wxSizer *sizer) | |
1001 | { | |
1002 | DoSetSizer(sizer); | |
1003 | } | |
1004 | ||
1005 | inline void wxSizerItem::SetSpacer(const wxSize& size) | |
1006 | { | |
1007 | DoSetSpacer(size); | |
1008 | } | |
1009 | ||
1010 | inline void wxSizerItem::SetSpacer(int width, int height) | |
1011 | { | |
1012 | DoSetSpacer(wxSize(width, height)); | |
1013 | } | |
1014 | ||
1015 | #endif // WXWIN_COMPATIBILITY_2_8 | |
1016 | ||
1017 | ||
1018 | inline wxSizerItem* | |
1019 | wxSizer::Add( wxSizerItem *item ) | |
1020 | { | |
1021 | return Insert( m_children.GetCount(), item ); | |
1022 | } | |
1023 | ||
1024 | inline wxSizerItem* | |
1025 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) | |
1026 | { | |
1027 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1028 | } | |
1029 | ||
1030 | inline wxSizerItem* | |
1031 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) | |
1032 | { | |
1033 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1034 | } | |
1035 | ||
1036 | inline wxSizerItem* | |
1037 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) | |
1038 | { | |
1039 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1040 | } | |
1041 | ||
1042 | inline wxSizerItem* | |
1043 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) | |
1044 | { | |
1045 | return Add( new wxSizerItem(window, flags) ); | |
1046 | } | |
1047 | ||
1048 | inline wxSizerItem* | |
1049 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) | |
1050 | { | |
1051 | return Add( new wxSizerItem(sizer, flags) ); | |
1052 | } | |
1053 | ||
1054 | inline wxSizerItem* | |
1055 | wxSizer::Add( int width, int height, const wxSizerFlags& flags ) | |
1056 | { | |
1057 | return Add( new wxSizerItem(width, height, flags) ); | |
1058 | } | |
1059 | ||
1060 | inline wxSizerItem* | |
1061 | wxSizer::AddSpacer(int size) | |
1062 | { | |
1063 | return Add(size, size); | |
1064 | } | |
1065 | ||
1066 | inline wxSizerItem* | |
1067 | wxSizer::AddStretchSpacer(int prop) | |
1068 | { | |
1069 | return Add(0, 0, prop); | |
1070 | } | |
1071 | ||
1072 | inline wxSizerItem* | |
1073 | wxSizer::Prepend( wxSizerItem *item ) | |
1074 | { | |
1075 | return Insert( 0, item ); | |
1076 | } | |
1077 | ||
1078 | inline wxSizerItem* | |
1079 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) | |
1080 | { | |
1081 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1082 | } | |
1083 | ||
1084 | inline wxSizerItem* | |
1085 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) | |
1086 | { | |
1087 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1088 | } | |
1089 | ||
1090 | inline wxSizerItem* | |
1091 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) | |
1092 | { | |
1093 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1094 | } | |
1095 | ||
1096 | inline wxSizerItem* | |
1097 | wxSizer::PrependSpacer(int size) | |
1098 | { | |
1099 | return Prepend(size, size); | |
1100 | } | |
1101 | ||
1102 | inline wxSizerItem* | |
1103 | wxSizer::PrependStretchSpacer(int prop) | |
1104 | { | |
1105 | return Prepend(0, 0, prop); | |
1106 | } | |
1107 | ||
1108 | inline wxSizerItem* | |
1109 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) | |
1110 | { | |
1111 | return Prepend( new wxSizerItem(window, flags) ); | |
1112 | } | |
1113 | ||
1114 | inline wxSizerItem* | |
1115 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) | |
1116 | { | |
1117 | return Prepend( new wxSizerItem(sizer, flags) ); | |
1118 | } | |
1119 | ||
1120 | inline wxSizerItem* | |
1121 | wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) | |
1122 | { | |
1123 | return Prepend( new wxSizerItem(width, height, flags) ); | |
1124 | } | |
1125 | ||
1126 | inline wxSizerItem* | |
1127 | wxSizer::Insert( size_t index, | |
1128 | wxWindow *window, | |
1129 | int proportion, | |
1130 | int flag, | |
1131 | int border, | |
1132 | wxObject* userData ) | |
1133 | { | |
1134 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1135 | } | |
1136 | ||
1137 | inline wxSizerItem* | |
1138 | wxSizer::Insert( size_t index, | |
1139 | wxSizer *sizer, | |
1140 | int proportion, | |
1141 | int flag, | |
1142 | int border, | |
1143 | wxObject* userData ) | |
1144 | { | |
1145 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1146 | } | |
1147 | ||
1148 | inline wxSizerItem* | |
1149 | wxSizer::Insert( size_t index, | |
1150 | int width, | |
1151 | int height, | |
1152 | int proportion, | |
1153 | int flag, | |
1154 | int border, | |
1155 | wxObject* userData ) | |
1156 | { | |
1157 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1158 | } | |
1159 | ||
1160 | inline wxSizerItem* | |
1161 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) | |
1162 | { | |
1163 | return Insert( index, new wxSizerItem(window, flags) ); | |
1164 | } | |
1165 | ||
1166 | inline wxSizerItem* | |
1167 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) | |
1168 | { | |
1169 | return Insert( index, new wxSizerItem(sizer, flags) ); | |
1170 | } | |
1171 | ||
1172 | inline wxSizerItem* | |
1173 | wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags ) | |
1174 | { | |
1175 | return Insert( index, new wxSizerItem(width, height, flags) ); | |
1176 | } | |
1177 | ||
1178 | inline wxSizerItem* | |
1179 | wxSizer::InsertSpacer(size_t index, int size) | |
1180 | { | |
1181 | return Insert(index, size, size); | |
1182 | } | |
1183 | ||
1184 | inline wxSizerItem* | |
1185 | wxSizer::InsertStretchSpacer(size_t index, int prop) | |
1186 | { | |
1187 | return Insert(index, 0, 0, prop); | |
1188 | } | |
1189 | ||
1190 | #endif // __WXSIZER_H__ |