]>
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 WXDLLEXPORT 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 WXDLLEXPORT 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 WXDLLEXPORT 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 WXDLLEXPORT 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( int x, int y, int width, int height ); | |
636 | ||
637 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); | |
638 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
639 | wxSizerItem* GetItem( size_t index ); | |
640 | wxSizerItem* GetItemById( int id, bool recursive = false ); | |
641 | ||
642 | // Manage whether individual scene items are considered | |
643 | // in the layout calculations or not. | |
644 | bool Show( wxWindow *window, bool show = true, bool recursive = false ); | |
645 | bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); | |
646 | bool Show( size_t index, bool show = true ); | |
647 | ||
648 | bool Hide( wxSizer *sizer, bool recursive = false ) | |
649 | { return Show( sizer, false, recursive ); } | |
650 | bool Hide( wxWindow *window, bool recursive = false ) | |
651 | { return Show( window, false, recursive ); } | |
652 | bool Hide( size_t index ) | |
653 | { return Show( index, false ); } | |
654 | ||
655 | bool IsShown( wxWindow *window ) const; | |
656 | bool IsShown( wxSizer *sizer ) const; | |
657 | bool IsShown( size_t index ) const; | |
658 | ||
659 | // Recursively call wxWindow::Show () on all sizer items. | |
660 | virtual void ShowItems (bool show); | |
661 | ||
662 | void Show(bool show) { ShowItems(show); } | |
663 | ||
664 | protected: | |
665 | wxSize m_size; | |
666 | wxSize m_minSize; | |
667 | wxPoint m_position; | |
668 | wxSizerItemList m_children; | |
669 | ||
670 | // the window this sizer is used in, can be NULL | |
671 | wxWindow *m_containingWindow; | |
672 | ||
673 | wxSize GetMaxClientSize( wxWindow *window ) const; | |
674 | wxSize GetMinClientSize( wxWindow *window ); | |
675 | wxSize VirtualFitSize( wxWindow *window ); | |
676 | ||
677 | virtual void DoSetMinSize( int width, int height ); | |
678 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
679 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
680 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); | |
681 | ||
682 | private: | |
683 | DECLARE_CLASS(wxSizer) | |
684 | }; | |
685 | ||
686 | //--------------------------------------------------------------------------- | |
687 | // wxGridSizer | |
688 | //--------------------------------------------------------------------------- | |
689 | ||
690 | class WXDLLEXPORT wxGridSizer: public wxSizer | |
691 | { | |
692 | public: | |
693 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
694 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
695 | ||
696 | virtual void RecalcSizes(); | |
697 | virtual wxSize CalcMin(); | |
698 | ||
699 | void SetCols( int cols ) { m_cols = cols; } | |
700 | void SetRows( int rows ) { m_rows = rows; } | |
701 | void SetVGap( int gap ) { m_vgap = gap; } | |
702 | void SetHGap( int gap ) { m_hgap = gap; } | |
703 | int GetCols() const { return m_cols; } | |
704 | int GetRows() const { return m_rows; } | |
705 | int GetVGap() const { return m_vgap; } | |
706 | int GetHGap() const { return m_hgap; } | |
707 | ||
708 | protected: | |
709 | int m_rows; | |
710 | int m_cols; | |
711 | int m_vgap; | |
712 | int m_hgap; | |
713 | ||
714 | // return the number of total items and the number of columns and rows | |
715 | int CalcRowsCols(int& rows, int& cols) const; | |
716 | ||
717 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); | |
718 | ||
719 | private: | |
720 | DECLARE_CLASS(wxGridSizer) | |
721 | }; | |
722 | ||
723 | //--------------------------------------------------------------------------- | |
724 | // wxFlexGridSizer | |
725 | //--------------------------------------------------------------------------- | |
726 | ||
727 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" | |
728 | // direction | |
729 | enum wxFlexSizerGrowMode | |
730 | { | |
731 | // don't resize the cells in non-flexible direction at all | |
732 | wxFLEX_GROWMODE_NONE, | |
733 | ||
734 | // uniformly resize only the specified ones (default) | |
735 | wxFLEX_GROWMODE_SPECIFIED, | |
736 | ||
737 | // uniformly resize all cells | |
738 | wxFLEX_GROWMODE_ALL | |
739 | }; | |
740 | ||
741 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer | |
742 | { | |
743 | public: | |
744 | // ctors/dtor | |
745 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); | |
746 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
747 | virtual ~wxFlexGridSizer(); | |
748 | ||
749 | ||
750 | // set the rows/columns which will grow (the others will remain of the | |
751 | // constant initial size) | |
752 | void AddGrowableRow( size_t idx, int proportion = 0 ); | |
753 | void RemoveGrowableRow( size_t idx ); | |
754 | void AddGrowableCol( size_t idx, int proportion = 0 ); | |
755 | void RemoveGrowableCol( size_t idx ); | |
756 | ||
757 | ||
758 | // the sizer cells may grow in both directions, not grow at all or only | |
759 | // grow in one direction but not the other | |
760 | ||
761 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
762 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
763 | int GetFlexibleDirection() const { return m_flexDirection; } | |
764 | ||
765 | // note that the grow mode only applies to the direction which is not | |
766 | // flexible | |
767 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
768 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
769 | ||
770 | // Read-only access to the row heights and col widths arrays | |
771 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
772 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
773 | ||
774 | // implementation | |
775 | virtual void RecalcSizes(); | |
776 | virtual wxSize CalcMin(); | |
777 | ||
778 | protected: | |
779 | void AdjustForFlexDirection(); | |
780 | void AdjustForGrowables(const wxSize& sz); | |
781 | void FindWidthsAndHeights(int nrows, int ncols); | |
782 | ||
783 | // the heights/widths of all rows/columns | |
784 | wxArrayInt m_rowHeights, | |
785 | m_colWidths; | |
786 | ||
787 | // indices of the growable columns and rows | |
788 | wxArrayInt m_growableRows, | |
789 | m_growableCols; | |
790 | ||
791 | // proportion values of the corresponding growable rows and columns | |
792 | wxArrayInt m_growableRowsProportions, | |
793 | m_growableColsProportions; | |
794 | ||
795 | // parameters describing whether the growable cells should be resized in | |
796 | // both directions or only one | |
797 | int m_flexDirection; | |
798 | wxFlexSizerGrowMode m_growMode; | |
799 | ||
800 | // saves CalcMin result to optimize RecalcSizes | |
801 | wxSize m_calculatedMinSize; | |
802 | ||
803 | private: | |
804 | DECLARE_CLASS(wxFlexGridSizer) | |
805 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) | |
806 | }; | |
807 | ||
808 | //--------------------------------------------------------------------------- | |
809 | // wxBoxSizer | |
810 | //--------------------------------------------------------------------------- | |
811 | ||
812 | class WXDLLEXPORT wxBoxSizer: public wxSizer | |
813 | { | |
814 | public: | |
815 | wxBoxSizer(int orient) | |
816 | { | |
817 | m_orient = orient; | |
818 | m_totalProportion = 0; | |
819 | ||
820 | wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL, | |
821 | _T("invalid value for wxBoxSizer orientation") ); | |
822 | } | |
823 | ||
824 | int GetOrientation() const { return m_orient; } | |
825 | ||
826 | bool IsVertical() const { return m_orient == wxVERTICAL; } | |
827 | ||
828 | void SetOrientation(int orient) { m_orient = orient; } | |
829 | ||
830 | // implementation of our resizing logic | |
831 | virtual wxSize CalcMin(); | |
832 | virtual void RecalcSizes(); | |
833 | ||
834 | protected: | |
835 | // helpers for our code: this returns the component of the given wxSize in | |
836 | // the direction of the sizer and in the other direction, respectively | |
837 | int GetSizeInMajorDir(const wxSize& sz) const | |
838 | { | |
839 | return m_orient == wxHORIZONTAL ? sz.x : sz.y; | |
840 | } | |
841 | ||
842 | int& SizeInMajorDir(wxSize& sz) | |
843 | { | |
844 | return m_orient == wxHORIZONTAL ? sz.x : sz.y; | |
845 | } | |
846 | ||
847 | int& PosInMajorDir(wxPoint& pt) | |
848 | { | |
849 | return m_orient == wxHORIZONTAL ? pt.x : pt.y; | |
850 | } | |
851 | ||
852 | int GetSizeInMinorDir(const wxSize& sz) const | |
853 | { | |
854 | return m_orient == wxHORIZONTAL ? sz.y : sz.x; | |
855 | } | |
856 | ||
857 | int& SizeInMinorDir(wxSize& sz) | |
858 | { | |
859 | return m_orient == wxHORIZONTAL ? sz.y : sz.x; | |
860 | } | |
861 | ||
862 | int& PosInMinorDir(wxPoint& pt) | |
863 | { | |
864 | return m_orient == wxHORIZONTAL ? pt.y : pt.x; | |
865 | } | |
866 | ||
867 | // another helper: creates wxSize from major and minor components | |
868 | wxSize SizeFromMajorMinor(int major, int minor) const | |
869 | { | |
870 | if ( m_orient == wxHORIZONTAL ) | |
871 | { | |
872 | return wxSize(major, minor); | |
873 | } | |
874 | else // wxVERTICAL | |
875 | { | |
876 | return wxSize(minor, major); | |
877 | } | |
878 | } | |
879 | ||
880 | ||
881 | // either wxHORIZONTAL or wxVERTICAL | |
882 | int m_orient; | |
883 | ||
884 | // the sum of proportion of all of our elements | |
885 | int m_totalProportion; | |
886 | ||
887 | // the minimal size needed for this sizer as calculated by the last call to | |
888 | // our CalcMin() | |
889 | wxSize m_minSize; | |
890 | ||
891 | private: | |
892 | DECLARE_CLASS(wxBoxSizer) | |
893 | }; | |
894 | ||
895 | //--------------------------------------------------------------------------- | |
896 | // wxWrapSizer - A box sizer that can wrap items on several lines when | |
897 | // widths exceed available width. | |
898 | //--------------------------------------------------------------------------- | |
899 | ||
900 | // Borrow unused flag value | |
901 | #define wxEXTEND_LAST_ON_EACH_LINE wxFULL_REPAINT_ON_RESIZE | |
902 | ||
903 | class WXDLLEXPORT wxWrapSizer: public wxBoxSizer | |
904 | { | |
905 | public: | |
906 | wxWrapSizer( int orient=wxHORIZONTAL, int flags=wxEXTEND_LAST_ON_EACH_LINE ); | |
907 | virtual ~wxWrapSizer(); | |
908 | ||
909 | virtual void RecalcSizes(); | |
910 | virtual wxSize CalcMin(); | |
911 | ||
912 | virtual bool InformFirstDirection( int direction, int size, int availableOtherDir ); | |
913 | ||
914 | protected: | |
915 | int m_prim_size_last; // Size in primary direction last time | |
916 | int m_n_line; // Number of lines | |
917 | wxBoxSizer m_rows; // Rows of items | |
918 | int m_flags; | |
919 | ||
920 | void AdjustPropLastItem(wxSizer *psz, wxSizerItem *itemLast); | |
921 | ||
922 | DECLARE_DYNAMIC_CLASS(wxWrapSizer) | |
923 | }; | |
924 | ||
925 | //--------------------------------------------------------------------------- | |
926 | // wxStaticBoxSizer | |
927 | //--------------------------------------------------------------------------- | |
928 | ||
929 | #if wxUSE_STATBOX | |
930 | ||
931 | class WXDLLIMPEXP_FWD_CORE wxStaticBox; | |
932 | ||
933 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer | |
934 | { | |
935 | public: | |
936 | wxStaticBoxSizer(wxStaticBox *box, int orient); | |
937 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); | |
938 | virtual ~wxStaticBoxSizer(); | |
939 | ||
940 | void RecalcSizes(); | |
941 | wxSize CalcMin(); | |
942 | ||
943 | wxStaticBox *GetStaticBox() const | |
944 | { return m_staticBox; } | |
945 | ||
946 | // override to hide/show the static box as well | |
947 | virtual void ShowItems (bool show); | |
948 | ||
949 | virtual bool Detach( wxWindow *window ); | |
950 | virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } | |
951 | virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } | |
952 | ||
953 | protected: | |
954 | wxStaticBox *m_staticBox; | |
955 | ||
956 | private: | |
957 | DECLARE_CLASS(wxStaticBoxSizer) | |
958 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) | |
959 | }; | |
960 | ||
961 | #endif // wxUSE_STATBOX | |
962 | ||
963 | #if wxUSE_BUTTON | |
964 | ||
965 | class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer | |
966 | { | |
967 | public: | |
968 | // Constructor just creates a new wxBoxSizer, not much else. | |
969 | // Box sizer orientation is automatically determined here: | |
970 | // vertical for PDAs, horizontal for everything else? | |
971 | wxStdDialogButtonSizer(); | |
972 | ||
973 | // Checks button ID against system IDs and sets one of the pointers below | |
974 | // to this button. Does not do any sizer-related things here. | |
975 | void AddButton(wxButton *button); | |
976 | ||
977 | // Use these if no standard ID can/should be used | |
978 | void SetAffirmativeButton( wxButton *button ); | |
979 | void SetNegativeButton( wxButton *button ); | |
980 | void SetCancelButton( wxButton *button ); | |
981 | ||
982 | // All platform-specific code here, checks which buttons exist and add | |
983 | // them to the sizer accordingly. | |
984 | // Note - one potential hack on Mac we could use here, | |
985 | // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE | |
986 | // is set to _("Save") and m_buttonNegative is set to _("Don't Save") | |
987 | // I wouldn't add any other hacks like that into here, | |
988 | // but this one I can see being useful. | |
989 | void Realize(); | |
990 | ||
991 | wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } | |
992 | wxButton *GetApplyButton() const { return m_buttonApply; } | |
993 | wxButton *GetNegativeButton() const { return m_buttonNegative; } | |
994 | wxButton *GetCancelButton() const { return m_buttonCancel; } | |
995 | wxButton *GetHelpButton() const { return m_buttonHelp; } | |
996 | ||
997 | protected: | |
998 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here | |
999 | wxButton *m_buttonApply; // wxID_APPLY | |
1000 | wxButton *m_buttonNegative; // wxID_NO | |
1001 | wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE | |
1002 | wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP | |
1003 | ||
1004 | private: | |
1005 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
1006 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) | |
1007 | }; | |
1008 | ||
1009 | #endif // wxUSE_BUTTON | |
1010 | ||
1011 | ||
1012 | // ---------------------------------------------------------------------------- | |
1013 | // inline functions implementation | |
1014 | // ---------------------------------------------------------------------------- | |
1015 | ||
1016 | #if WXWIN_COMPATIBILITY_2_8 | |
1017 | ||
1018 | inline void wxSizerItem::SetWindow(wxWindow *window) | |
1019 | { | |
1020 | DoSetWindow(window); | |
1021 | } | |
1022 | ||
1023 | inline void wxSizerItem::SetSizer(wxSizer *sizer) | |
1024 | { | |
1025 | DoSetSizer(sizer); | |
1026 | } | |
1027 | ||
1028 | inline void wxSizerItem::SetSpacer(const wxSize& size) | |
1029 | { | |
1030 | DoSetSpacer(size); | |
1031 | } | |
1032 | ||
1033 | inline void wxSizerItem::SetSpacer(int width, int height) | |
1034 | { | |
1035 | DoSetSpacer(wxSize(width, height)); | |
1036 | } | |
1037 | ||
1038 | #endif // WXWIN_COMPATIBILITY_2_8 | |
1039 | ||
1040 | ||
1041 | inline wxSizerItem* | |
1042 | wxSizer::Add( wxSizerItem *item ) | |
1043 | { | |
1044 | return Insert( m_children.GetCount(), item ); | |
1045 | } | |
1046 | ||
1047 | inline wxSizerItem* | |
1048 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) | |
1049 | { | |
1050 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1051 | } | |
1052 | ||
1053 | inline wxSizerItem* | |
1054 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) | |
1055 | { | |
1056 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1057 | } | |
1058 | ||
1059 | inline wxSizerItem* | |
1060 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) | |
1061 | { | |
1062 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1063 | } | |
1064 | ||
1065 | inline wxSizerItem* | |
1066 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) | |
1067 | { | |
1068 | return Add( new wxSizerItem(window, flags) ); | |
1069 | } | |
1070 | ||
1071 | inline wxSizerItem* | |
1072 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) | |
1073 | { | |
1074 | return Add( new wxSizerItem(sizer, flags) ); | |
1075 | } | |
1076 | ||
1077 | inline wxSizerItem* | |
1078 | wxSizer::Add( int width, int height, const wxSizerFlags& flags ) | |
1079 | { | |
1080 | return Add( new wxSizerItem(width, height, flags) ); | |
1081 | } | |
1082 | ||
1083 | inline wxSizerItem* | |
1084 | wxSizer::AddSpacer(int size) | |
1085 | { | |
1086 | return Add(size, size); | |
1087 | } | |
1088 | ||
1089 | inline wxSizerItem* | |
1090 | wxSizer::AddStretchSpacer(int prop) | |
1091 | { | |
1092 | return Add(0, 0, prop); | |
1093 | } | |
1094 | ||
1095 | inline wxSizerItem* | |
1096 | wxSizer::Prepend( wxSizerItem *item ) | |
1097 | { | |
1098 | return Insert( 0, item ); | |
1099 | } | |
1100 | ||
1101 | inline wxSizerItem* | |
1102 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) | |
1103 | { | |
1104 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1105 | } | |
1106 | ||
1107 | inline wxSizerItem* | |
1108 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) | |
1109 | { | |
1110 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1111 | } | |
1112 | ||
1113 | inline wxSizerItem* | |
1114 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) | |
1115 | { | |
1116 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1117 | } | |
1118 | ||
1119 | inline wxSizerItem* | |
1120 | wxSizer::PrependSpacer(int size) | |
1121 | { | |
1122 | return Prepend(size, size); | |
1123 | } | |
1124 | ||
1125 | inline wxSizerItem* | |
1126 | wxSizer::PrependStretchSpacer(int prop) | |
1127 | { | |
1128 | return Prepend(0, 0, prop); | |
1129 | } | |
1130 | ||
1131 | inline wxSizerItem* | |
1132 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) | |
1133 | { | |
1134 | return Prepend( new wxSizerItem(window, flags) ); | |
1135 | } | |
1136 | ||
1137 | inline wxSizerItem* | |
1138 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) | |
1139 | { | |
1140 | return Prepend( new wxSizerItem(sizer, flags) ); | |
1141 | } | |
1142 | ||
1143 | inline wxSizerItem* | |
1144 | wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) | |
1145 | { | |
1146 | return Prepend( new wxSizerItem(width, height, flags) ); | |
1147 | } | |
1148 | ||
1149 | inline wxSizerItem* | |
1150 | wxSizer::Insert( size_t index, | |
1151 | wxWindow *window, | |
1152 | int proportion, | |
1153 | int flag, | |
1154 | int border, | |
1155 | wxObject* userData ) | |
1156 | { | |
1157 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); | |
1158 | } | |
1159 | ||
1160 | inline wxSizerItem* | |
1161 | wxSizer::Insert( size_t index, | |
1162 | wxSizer *sizer, | |
1163 | int proportion, | |
1164 | int flag, | |
1165 | int border, | |
1166 | wxObject* userData ) | |
1167 | { | |
1168 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); | |
1169 | } | |
1170 | ||
1171 | inline wxSizerItem* | |
1172 | wxSizer::Insert( size_t index, | |
1173 | int width, | |
1174 | int height, | |
1175 | int proportion, | |
1176 | int flag, | |
1177 | int border, | |
1178 | wxObject* userData ) | |
1179 | { | |
1180 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); | |
1181 | } | |
1182 | ||
1183 | inline wxSizerItem* | |
1184 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) | |
1185 | { | |
1186 | return Insert( index, new wxSizerItem(window, flags) ); | |
1187 | } | |
1188 | ||
1189 | inline wxSizerItem* | |
1190 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) | |
1191 | { | |
1192 | return Insert( index, new wxSizerItem(sizer, flags) ); | |
1193 | } | |
1194 | ||
1195 | inline wxSizerItem* | |
1196 | wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags ) | |
1197 | { | |
1198 | return Insert( index, new wxSizerItem(width, height, flags) ); | |
1199 | } | |
1200 | ||
1201 | inline wxSizerItem* | |
1202 | wxSizer::InsertSpacer(size_t index, int size) | |
1203 | { | |
1204 | return Insert(index, size, size); | |
1205 | } | |
1206 | ||
1207 | inline wxSizerItem* | |
1208 | wxSizer::InsertStretchSpacer(size_t index, int prop) | |
1209 | { | |
1210 | return Insert(index, 0, 0, prop); | |
1211 | } | |
1212 | ||
1213 | #endif // __WXSIZER_H__ |