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