]>
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 | ||
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 | { | |
ddfcd9aa | 63 | m_flags &= ~wxALIGN_MASK; |
5f813ad6 VZ |
64 | m_flags |= alignment; |
65 | ||
66 | return *this; | |
67 | } | |
68 | ||
00dc67b8 VZ |
69 | wxSizerFlags& Expand() |
70 | { | |
71 | m_flags |= wxEXPAND; | |
72 | return *this; | |
73 | } | |
74 | ||
5f813ad6 | 75 | // some shortcuts for Align() |
89064717 | 76 | wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } |
5f813ad6 | 77 | wxSizerFlags& Center() { return Centre(); } |
ccee328e | 78 | wxSizerFlags& Top() { return Align(wxALIGN_TOP); } |
e72ac082 VZ |
79 | wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } |
80 | wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } | |
ccee328e | 81 | wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } |
5f813ad6 | 82 | |
2be7beda VZ |
83 | // default border size used by Border() below |
84 | static int GetDefaultBorder() | |
85 | { | |
97ebfd54 | 86 | #if wxUSE_BORDER_BY_DEFAULT |
43c5fff8 VS |
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 | |
2be7beda VZ |
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; | |
43c5fff8 | 95 | #endif |
97ebfd54 VZ |
96 | #else |
97 | return 0; | |
98 | #endif | |
2be7beda VZ |
99 | } |
100 | ||
5f813ad6 VZ |
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 | { | |
97ebfd54 VZ |
114 | #if wxUSE_BORDER_BY_DEFAULT |
115 | return Border(direction, GetDefaultBorder()); | |
116 | #else | |
92b0cd9e VZ |
117 | // no borders by default on limited size screen |
118 | wxUnusedVar(direction); | |
119 | ||
120 | return *this; | |
97ebfd54 VZ |
121 | #endif |
122 | } | |
123 | ||
124 | wxSizerFlags& DoubleBorder(int direction = wxALL) | |
125 | { | |
126 | #if wxUSE_BORDER_BY_DEFAULT | |
127 | return Border(direction, 2*GetDefaultBorder()); | |
92b0cd9e | 128 | #else |
97ebfd54 VZ |
129 | wxUnusedVar(direction); |
130 | ||
131 | return *this; | |
92b0cd9e | 132 | #endif |
5f813ad6 VZ |
133 | } |
134 | ||
97ebfd54 VZ |
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 | } | |
5f813ad6 | 163 | |
d95527de VZ |
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 | } | |
d95527de | 178 | |
0ba6faae VS |
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 | ||
5f813ad6 VZ |
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 | ||
50c06297 VZ |
198 | // ---------------------------------------------------------------------------- |
199 | // wxSizerSpacer: used by wxSizerItem to represent a spacer | |
200 | // ---------------------------------------------------------------------------- | |
5279a24d | 201 | |
50c06297 | 202 | class WXDLLEXPORT wxSizerSpacer |
5279a24d RR |
203 | { |
204 | public: | |
50c06297 | 205 | wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } |
5f813ad6 | 206 | |
50c06297 VZ |
207 | void SetSize(const wxSize& size) { m_size = size; } |
208 | const wxSize& GetSize() const { return m_size; } | |
5f813ad6 | 209 | |
50c06297 VZ |
210 | void Show(bool show) { m_isShown = show; } |
211 | bool IsShown() const { return m_isShown; } | |
5f813ad6 | 212 | |
50c06297 VZ |
213 | private: |
214 | // the size, in pixel | |
215 | wxSize m_size; | |
df5ddbca | 216 | |
50c06297 VZ |
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: | |
df5ddbca | 228 | // window |
12a3f227 RL |
229 | wxSizerItem( wxWindow *window, |
230 | int proportion, | |
231 | int flag, | |
232 | int border, | |
233 | wxObject* userData ); | |
df5ddbca | 234 | |
50c06297 VZ |
235 | // window with flags |
236 | wxSizerItem(wxWindow *window, const wxSizerFlags& flags) | |
237 | { | |
238 | Init(flags); | |
239 | ||
4dd10327 | 240 | DoSetWindow(window); |
50c06297 VZ |
241 | } |
242 | ||
df5ddbca | 243 | // subsizer |
12a3f227 RL |
244 | wxSizerItem( wxSizer *sizer, |
245 | int proportion, | |
246 | int flag, | |
247 | int border, | |
248 | wxObject* userData ); | |
df5ddbca | 249 | |
50c06297 VZ |
250 | // sizer with flags |
251 | wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) | |
252 | { | |
253 | Init(flags); | |
254 | ||
4dd10327 | 255 | DoSetSizer(sizer); |
50c06297 VZ |
256 | } |
257 | ||
5f813ad6 VZ |
258 | // spacer |
259 | wxSizerItem( int width, | |
260 | int height, | |
261 | int proportion, | |
262 | int flag, | |
263 | int border, | |
264 | wxObject* userData); | |
265 | ||
50c06297 VZ |
266 | // spacer with flags |
267 | wxSizerItem(int width, int height, const wxSizerFlags& flags) | |
268 | { | |
269 | Init(flags); | |
270 | ||
4dd10327 | 271 | DoSetSpacer(wxSize(width, height)); |
50c06297 VZ |
272 | } |
273 | ||
20b35a69 RD |
274 | wxSizerItem(); |
275 | virtual ~wxSizerItem(); | |
dc259b79 | 276 | |
84f7908b | 277 | virtual void DeleteWindows(); |
df5ddbca | 278 | |
96fdbb60 | 279 | // Enable deleting the SizerItem without destroying the contained sizer. |
50c06297 | 280 | void DetachSizer() { m_sizer = NULL; } |
96fdbb60 | 281 | |
9cbee2ce | 282 | virtual wxSize GetSize() const; |
df5ddbca | 283 | virtual wxSize CalcMin(); |
fbfb8bcc | 284 | virtual void SetDimension( const wxPoint& pos, const wxSize& size ); |
df5ddbca | 285 | |
9cbee2ce | 286 | wxSize GetMinSize() const |
df5ddbca | 287 | { return m_minSize; } |
ba763a45 RD |
288 | wxSize GetMinSizeWithBorder() const; |
289 | ||
1eba2193 | 290 | void SetMinSize(const wxSize& size) |
50c06297 VZ |
291 | { |
292 | if ( IsWindow() ) | |
293 | m_window->SetMinSize(size); | |
294 | m_minSize = size; | |
295 | } | |
1eba2193 | 296 | void SetMinSize( int x, int y ) |
8b2bac62 | 297 | { SetMinSize(wxSize(x, y)); } |
12a3f227 | 298 | void SetInitSize( int x, int y ) |
1eba2193 | 299 | { SetMinSize(wxSize(x, y)); } |
df5ddbca | 300 | |
50c06297 VZ |
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) | |
df5ddbca | 304 | { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } |
50c06297 VZ |
305 | void SetRatio(const wxSize& size) |
306 | { SetRatio(size.x, size.y); } | |
307 | void SetRatio(float ratio) | |
df5ddbca | 308 | { m_ratio = ratio; } |
2aab8f16 | 309 | float GetRatio() const |
df5ddbca RR |
310 | { return m_ratio; } |
311 | ||
50c06297 | 312 | virtual wxRect GetRect() { return m_rect; } |
56eee37f | 313 | |
86909f4c VZ |
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 | ||
50c06297 VZ |
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; } | |
2aab8f16 | 322 | |
6a9e54bd | 323 | #if WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
324 | // Deprecated in 2.6, use {G,S}etProportion instead. |
325 | wxDEPRECATED( void SetOption( int option ) ); | |
326 | wxDEPRECATED( int GetOption() const ); | |
6a9e54bd | 327 | #endif // WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
328 | |
329 | void SetProportion( int proportion ) | |
330 | { m_proportion = proportion; } | |
331 | int GetProportion() const | |
332 | { return m_proportion; } | |
df5ddbca RR |
333 | void SetFlag( int flag ) |
334 | { m_flag = flag; } | |
12a3f227 RL |
335 | int GetFlag() const |
336 | { return m_flag; } | |
df5ddbca RR |
337 | void SetBorder( int border ) |
338 | { m_border = border; } | |
12a3f227 RL |
339 | int GetBorder() const |
340 | { return m_border; } | |
df5ddbca RR |
341 | |
342 | wxWindow *GetWindow() const | |
50c06297 | 343 | { return m_kind == Item_Window ? m_window : NULL; } |
df5ddbca | 344 | wxSizer *GetSizer() const |
50c06297 VZ |
345 | { return m_kind == Item_Sizer ? m_sizer : NULL; } |
346 | wxSize GetSpacer() const; | |
12a3f227 | 347 | |
0ba6faae | 348 | // This function behaves obviously for the windows and spacers but for the |
c86fd3a7 | 349 | // sizers it returns true if any sizer element is shown and only returns |
0ba6faae VS |
350 | // false if all of them are hidden. Also, it always returns true if |
351 | // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used. | |
c86fd3a7 | 352 | bool IsShown() const; |
0ba6faae | 353 | |
50c06297 | 354 | void Show(bool show); |
12a3f227 | 355 | |
e8c1be04 | 356 | void SetUserData(wxObject* userData) |
1737dac2 | 357 | { delete m_userData; m_userData = userData; } |
9cbee2ce | 358 | wxObject* GetUserData() const |
df5ddbca | 359 | { return m_userData; } |
9cbee2ce | 360 | wxPoint GetPosition() const |
df5ddbca | 361 | { return m_pos; } |
0c0d686f | 362 | |
15f7c305 RR |
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 | ||
4dd10327 VZ |
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)); } | |
50c06297 | 390 | |
4dd10327 VZ |
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 | |
50c06297 | 399 | |
c62ac5b6 | 400 | protected: |
5f813ad6 | 401 | // common part of several ctors |
4dd10327 | 402 | void Init() { m_userData = NULL; m_kind = Item_None; } |
5f813ad6 VZ |
403 | |
404 | // common part of ctors taking wxSizerFlags | |
405 | void Init(const wxSizerFlags& flags); | |
406 | ||
4dd10327 VZ |
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); | |
f303d69f VZ |
414 | |
415 | // discriminated union: depending on m_kind one of the fields is valid | |
50c06297 VZ |
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 | }; | |
5f813ad6 | 430 | |
df5ddbca RR |
431 | wxPoint m_pos; |
432 | wxSize m_minSize; | |
12a3f227 | 433 | int m_proportion; |
df5ddbca RR |
434 | int m_border; |
435 | int m_flag; | |
86909f4c | 436 | int m_id; |
2b5f62a0 | 437 | |
50c06297 VZ |
438 | // on screen rectangle of this item (not including borders) |
439 | wxRect m_rect; | |
12a3f227 RL |
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. | |
df5ddbca | 444 | float m_ratio; |
2b5f62a0 | 445 | |
df5ddbca | 446 | wxObject *m_userData; |
2aab8f16 | 447 | |
9cbee2ce | 448 | private: |
4393b50c | 449 | DECLARE_CLASS(wxSizerItem) |
22f3361e | 450 | DECLARE_NO_COPY_CLASS(wxSizerItem) |
c62ac5b6 | 451 | }; |
5279a24d | 452 | |
12a3f227 RL |
453 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); |
454 | ||
5f813ad6 | 455 | |
5279a24d | 456 | //--------------------------------------------------------------------------- |
3417c2cd | 457 | // wxSizer |
5279a24d RR |
458 | //--------------------------------------------------------------------------- |
459 | ||
2aab8f16 | 460 | class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer |
5279a24d RR |
461 | { |
462 | public: | |
e8cfff87 | 463 | wxSizer() { m_containingWindow = NULL; } |
d3c7fc99 | 464 | virtual ~wxSizer(); |
f6bcfd97 | 465 | |
436ae7cf VZ |
466 | // methods for adding elements to the sizer: there are Add/Insert/Prepend |
467 | // overloads for each of window/sizer/spacer/wxSizerItem | |
ca8d899f VZ |
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); | |
b701f995 | 486 | wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); |
ca8d899f VZ |
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); | |
b701f995 VZ |
517 | wxSizerItem* Insert(size_t index, |
518 | int width, | |
519 | int height, | |
520 | const wxSizerFlags& flags); | |
ca8d899f VZ |
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); | |
b701f995 | 544 | wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); |
ca8d899f VZ |
545 | wxSizerItem* Prepend(wxSizerItem *item); |
546 | ||
547 | wxSizerItem* PrependSpacer(int size); | |
548 | wxSizerItem* PrependStretchSpacer(int prop = 1); | |
8e32ea1c | 549 | |
e8cfff87 | 550 | // set (or possibly unset if window is NULL) or get the window this sizer |
ce7208d4 | 551 | // is used in |
e8cfff87 VZ |
552 | void SetContainingWindow(wxWindow *window); |
553 | wxWindow *GetContainingWindow() const { return m_containingWindow; } | |
749bb9f1 | 554 | |
6a9e54bd | 555 | #if WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
556 | // Deprecated in 2.6 since historically it does not delete the window, |
557 | // use Detach instead. | |
558 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
6a9e54bd WS |
559 | #endif // WXWIN_COMPATIBILITY_2_6 |
560 | ||
f6bcfd97 | 561 | virtual bool Remove( wxSizer *sizer ); |
e0d8fb45 | 562 | virtual bool Remove( int index ); |
00976fe5 | 563 | |
12a3f227 | 564 | virtual bool Detach( wxWindow *window ); |
00976fe5 | 565 | virtual bool Detach( wxSizer *sizer ); |
e0d8fb45 | 566 | virtual bool Detach( int index ); |
00976fe5 | 567 | |
ce7208d4 WS |
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 ); | |
eae0338f | 571 | |
e0d8fb45 | 572 | virtual void Clear( bool delete_windows = false ); |
84f7908b | 573 | virtual void DeleteWindows(); |
f6bcfd97 | 574 | |
15f7c305 RR |
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 | ||
f6bcfd97 BP |
580 | void SetMinSize( int width, int height ) |
581 | { DoSetMinSize( width, height ); } | |
fbfb8bcc | 582 | void SetMinSize( const wxSize& size ) |
f6bcfd97 | 583 | { DoSetMinSize( size.x, size.y ); } |
1e6feb95 | 584 | |
50c06297 | 585 | // Searches recursively |
f6bcfd97 BP |
586 | bool SetItemMinSize( wxWindow *window, int width, int height ) |
587 | { return DoSetItemMinSize( window, width, height ); } | |
fbfb8bcc | 588 | bool SetItemMinSize( wxWindow *window, const wxSize& size ) |
f6bcfd97 | 589 | { return DoSetItemMinSize( window, size.x, size.y ); } |
1e6feb95 | 590 | |
50c06297 | 591 | // Searches recursively |
f6bcfd97 BP |
592 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) |
593 | { return DoSetItemMinSize( sizer, width, height ); } | |
fbfb8bcc | 594 | bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) |
f6bcfd97 | 595 | { return DoSetItemMinSize( sizer, size.x, size.y ); } |
1e6feb95 | 596 | |
12a3f227 RL |
597 | bool SetItemMinSize( size_t index, int width, int height ) |
598 | { return DoSetItemMinSize( index, width, height ); } | |
fbfb8bcc | 599 | bool SetItemMinSize( size_t index, const wxSize& size ) |
12a3f227 | 600 | { return DoSetItemMinSize( index, size.x, size.y ); } |
1e6feb95 | 601 | |
9cbee2ce | 602 | wxSize GetSize() const |
f6bcfd97 | 603 | { return m_size; } |
9cbee2ce | 604 | wxPoint GetPosition() const |
f6bcfd97 | 605 | { return m_position; } |
1e6feb95 | 606 | |
50c06297 | 607 | // Calculate the minimal size or return m_minSize if bigger. |
f6bcfd97 BP |
608 | wxSize GetMinSize(); |
609 | ||
89064717 VZ |
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 | |
f6bcfd97 | 614 | virtual wxSize CalcMin() = 0; |
89064717 | 615 | virtual void RecalcSizes() = 0; |
f6bcfd97 BP |
616 | |
617 | virtual void Layout(); | |
618 | ||
32013b47 VS |
619 | wxSize ComputeFittingClientSize(wxWindow *window); |
620 | wxSize ComputeFittingWindowSize(wxWindow *window); | |
621 | ||
e5251d4f | 622 | wxSize Fit( wxWindow *window ); |
566d84a7 | 623 | void FitInside( wxWindow *window ); |
f6bcfd97 | 624 | void SetSizeHints( wxWindow *window ); |
f944aec0 VS |
625 | #if WXWIN_COMPATIBILITY_2_8 |
626 | // This only calls FitInside() since 2.9 | |
627 | wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) ); | |
628 | #endif | |
f6bcfd97 | 629 | |
12a3f227 | 630 | wxSizerItemList& GetChildren() |
f6bcfd97 | 631 | { return m_children; } |
f9b5691a VZ |
632 | const wxSizerItemList& GetChildren() const |
633 | { return m_children; } | |
f6bcfd97 BP |
634 | |
635 | void SetDimension( int x, int y, int width, int height ); | |
0c0d686f | 636 | |
9f13661f WS |
637 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); |
638 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
639 | wxSizerItem* GetItem( size_t index ); | |
86909f4c | 640 | wxSizerItem* GetItemById( int id, bool recursive = false ); |
9f13661f | 641 | |
12a3f227 | 642 | // Manage whether individual scene items are considered |
2b5f62a0 | 643 | // in the layout calculations or not. |
8b2bac62 WS |
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 ); | |
12a3f227 | 647 | |
8b2bac62 WS |
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 ); } | |
2b5f62a0 | 654 | |
9cbee2ce RL |
655 | bool IsShown( wxWindow *window ) const; |
656 | bool IsShown( wxSizer *sizer ) const; | |
657 | bool IsShown( size_t index ) const; | |
dc259b79 | 658 | |
2b5f62a0 | 659 | // Recursively call wxWindow::Show () on all sizer items. |
eb2a7883 | 660 | virtual void ShowItems (bool show); |
2b5f62a0 | 661 | |
f303d69f | 662 | void Show(bool show) { ShowItems(show); } |
50c06297 | 663 | |
f6bcfd97 | 664 | protected: |
12a3f227 RL |
665 | wxSize m_size; |
666 | wxSize m_minSize; | |
667 | wxPoint m_position; | |
668 | wxSizerItemList m_children; | |
f6bcfd97 | 669 | |
e8cfff87 VZ |
670 | // the window this sizer is used in, can be NULL |
671 | wxWindow *m_containingWindow; | |
672 | ||
9cbee2ce | 673 | wxSize GetMaxClientSize( wxWindow *window ) const; |
566d84a7 | 674 | wxSize GetMinClientSize( wxWindow *window ); |
566d84a7 | 675 | wxSize VirtualFitSize( wxWindow *window ); |
65ba4113 | 676 | |
f6bcfd97 BP |
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 ); | |
12a3f227 | 680 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); |
1e6feb95 | 681 | |
9cbee2ce | 682 | private: |
4393b50c | 683 | DECLARE_CLASS(wxSizer) |
f6bcfd97 | 684 | }; |
c62ac5b6 | 685 | |
f6bcfd97 BP |
686 | //--------------------------------------------------------------------------- |
687 | // wxGridSizer | |
688 | //--------------------------------------------------------------------------- | |
0c0d686f | 689 | |
f6bcfd97 BP |
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 ); | |
1e6feb95 | 695 | |
5d76f462 VZ |
696 | virtual void RecalcSizes(); |
697 | virtual wxSize CalcMin(); | |
f6bcfd97 BP |
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; } | |
9cbee2ce RL |
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; } | |
1e6feb95 | 707 | |
f6bcfd97 BP |
708 | protected: |
709 | int m_rows; | |
710 | int m_cols; | |
711 | int m_vgap; | |
712 | int m_hgap; | |
1e6feb95 | 713 | |
0ca5105b VZ |
714 | // return the number of total items and the number of columns and rows |
715 | int CalcRowsCols(int& rows, int& cols) const; | |
716 | ||
f6bcfd97 | 717 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); |
1e6feb95 | 718 | |
9cbee2ce | 719 | private: |
4393b50c | 720 | DECLARE_CLASS(wxGridSizer) |
f6bcfd97 | 721 | }; |
5279a24d | 722 | |
f6bcfd97 BP |
723 | //--------------------------------------------------------------------------- |
724 | // wxFlexGridSizer | |
725 | //--------------------------------------------------------------------------- | |
0c0d686f | 726 | |
5d76f462 VZ |
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 | ||
f6bcfd97 BP |
741 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer |
742 | { | |
743 | public: | |
5d76f462 | 744 | // ctors/dtor |
f6bcfd97 BP |
745 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); |
746 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
5d76f462 | 747 | virtual ~wxFlexGridSizer(); |
1e6feb95 | 748 | |
1e6feb95 | 749 | |
5d76f462 VZ |
750 | // set the rows/columns which will grow (the others will remain of the |
751 | // constant initial size) | |
e8800dcf | 752 | void AddGrowableRow( size_t idx, int proportion = 0 ); |
f6bcfd97 | 753 | void RemoveGrowableRow( size_t idx ); |
e8800dcf | 754 | void AddGrowableCol( size_t idx, int proportion = 0 ); |
f6bcfd97 | 755 | void RemoveGrowableCol( size_t idx ); |
0c0d686f | 756 | |
1e6feb95 | 757 | |
5d76f462 VZ |
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 | ||
fc1fcd0e RD |
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; } | |
8b2bac62 | 773 | |
5d76f462 VZ |
774 | // implementation |
775 | virtual void RecalcSizes(); | |
776 | virtual wxSize CalcMin(); | |
777 | ||
778 | protected: | |
20b35a69 | 779 | void AdjustForFlexDirection(); |
97800f66 | 780 | void AdjustForGrowables(const wxSize& sz); |
15f7c305 | 781 | void FindWidthsAndHeights(int nrows, int ncols); |
8b2bac62 | 782 | |
5d76f462 VZ |
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 | ||
e8800dcf VZ |
791 | // proportion values of the corresponding growable rows and columns |
792 | wxArrayInt m_growableRowsProportions, | |
793 | m_growableColsProportions; | |
794 | ||
5d76f462 VZ |
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; | |
1e6feb95 | 799 | |
ba763a45 RD |
800 | // saves CalcMin result to optimize RecalcSizes |
801 | wxSize m_calculatedMinSize; | |
802 | ||
9cbee2ce | 803 | private: |
4393b50c | 804 | DECLARE_CLASS(wxFlexGridSizer) |
22f3361e | 805 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) |
c62ac5b6 RR |
806 | }; |
807 | ||
808 | //--------------------------------------------------------------------------- | |
92afa2b1 | 809 | // wxBoxSizer |
c62ac5b6 RR |
810 | //--------------------------------------------------------------------------- |
811 | ||
92afa2b1 | 812 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
813 | { |
814 | public: | |
89064717 VZ |
815 | wxBoxSizer(int orient) |
816 | { | |
817 | m_orient = orient; | |
2a818b7a | 818 | m_totalProportion = 0; |
89064717 VZ |
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; } | |
0c0d686f | 825 | |
89064717 | 826 | bool IsVertical() const { return m_orient == wxVERTICAL; } |
0c0d686f | 827 | |
89064717 | 828 | void SetOrientation(int orient) { m_orient = orient; } |
0c0d686f | 829 | |
89064717 VZ |
830 | // implementation of our resizing logic |
831 | virtual wxSize CalcMin(); | |
832 | virtual void RecalcSizes(); | |
b657b4c9 | 833 | |
61d514bb | 834 | protected: |
89064717 VZ |
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 | |
3d2085a4 | 837 | int GetSizeInMajorDir(const wxSize& sz) const |
89064717 VZ |
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 | ||
3d2085a4 | 852 | int GetSizeInMinorDir(const wxSize& sz) const |
89064717 VZ |
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 | |
61d514bb | 882 | int m_orient; |
89064717 VZ |
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; | |
1e6feb95 | 890 | |
9cbee2ce | 891 | private: |
4393b50c | 892 | DECLARE_CLASS(wxBoxSizer) |
61d514bb | 893 | }; |
0c0d686f | 894 | |
15f7c305 RR |
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 | ||
956e6c7b | 922 | DECLARE_DYNAMIC_CLASS(wxWrapSizer) |
15f7c305 RR |
923 | }; |
924 | ||
27ea1d8a RR |
925 | //--------------------------------------------------------------------------- |
926 | // wxStaticBoxSizer | |
927 | //--------------------------------------------------------------------------- | |
928 | ||
1e6feb95 VZ |
929 | #if wxUSE_STATBOX |
930 | ||
b5dbe15d | 931 | class WXDLLIMPEXP_FWD_CORE wxStaticBox; |
1e6feb95 | 932 | |
27ea1d8a RR |
933 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer |
934 | { | |
935 | public: | |
6c1635b5 | 936 | wxStaticBoxSizer(wxStaticBox *box, int orient); |
450a1593 | 937 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); |
649cfca1 | 938 | virtual ~wxStaticBoxSizer(); |
0c0d686f | 939 | |
f6bcfd97 BP |
940 | void RecalcSizes(); |
941 | wxSize CalcMin(); | |
0c0d686f | 942 | |
9cbee2ce | 943 | wxStaticBox *GetStaticBox() const |
f6bcfd97 | 944 | { return m_staticBox; } |
0c0d686f | 945 | |
eb2a7883 VZ |
946 | // override to hide/show the static box as well |
947 | virtual void ShowItems (bool show); | |
7e2b7860 | 948 | |
e978011a | 949 | virtual bool Detach( wxWindow *window ); |
7e2b7860 VZ |
950 | virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } |
951 | virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } | |
eb2a7883 | 952 | |
27ea1d8a | 953 | protected: |
f6bcfd97 | 954 | wxStaticBox *m_staticBox; |
1e6feb95 | 955 | |
9cbee2ce | 956 | private: |
4393b50c | 957 | DECLARE_CLASS(wxStaticBoxSizer) |
22f3361e | 958 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) |
27ea1d8a RR |
959 | }; |
960 | ||
1e6feb95 VZ |
961 | #endif // wxUSE_STATBOX |
962 | ||
974c2a59 WS |
963 | #if wxUSE_BUTTON |
964 | ||
acf2ac37 RR |
965 | class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer |
966 | { | |
967 | public: | |
acf2ac37 RR |
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? | |
b181a505 | 971 | wxStdDialogButtonSizer(); |
acf2ac37 | 972 | |
acf2ac37 | 973 | // Checks button ID against system IDs and sets one of the pointers below |
b181a505 RR |
974 | // to this button. Does not do any sizer-related things here. |
975 | void AddButton(wxButton *button); | |
acf2ac37 | 976 | |
b181a505 RR |
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 ); | |
acf2ac37 | 981 | |
acf2ac37 RR |
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. | |
718903fe | 989 | void Realize(); |
974c2a59 | 990 | |
acf2ac37 RR |
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: | |
b181a505 | 998 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here |
57d7f988 | 999 | wxButton *m_buttonApply; // wxID_APPLY |
b181a505 | 1000 | wxButton *m_buttonNegative; // wxID_NO |
57d7f988 VZ |
1001 | wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE |
1002 | wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP | |
974c2a59 | 1003 | |
acf2ac37 RR |
1004 | private: |
1005 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
b181a505 | 1006 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) |
acf2ac37 | 1007 | }; |
adbf2d73 | 1008 | |
6b5c4761 | 1009 | #endif // wxUSE_BUTTON |
974c2a59 | 1010 | |
adbf2d73 | 1011 | |
8e32ea1c VZ |
1012 | // ---------------------------------------------------------------------------- |
1013 | // inline functions implementation | |
1014 | // ---------------------------------------------------------------------------- | |
1015 | ||
4dd10327 VZ |
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 | ||
50961a35 PC |
1041 | inline wxSizerItem* |
1042 | wxSizer::Add( wxSizerItem *item ) | |
1043 | { | |
1044 | return Insert( m_children.GetCount(), item ); | |
1045 | } | |
1046 | ||
56eee37f | 1047 | inline wxSizerItem* |
8e32ea1c VZ |
1048 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
1049 | { | |
56eee37f | 1050 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1051 | } |
1052 | ||
56eee37f | 1053 | inline wxSizerItem* |
8e32ea1c VZ |
1054 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
1055 | { | |
56eee37f | 1056 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1057 | } |
1058 | ||
56eee37f | 1059 | inline wxSizerItem* |
8e32ea1c VZ |
1060 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
1061 | { | |
56eee37f | 1062 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1063 | } |
1064 | ||
56eee37f | 1065 | inline wxSizerItem* |
5f813ad6 VZ |
1066 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) |
1067 | { | |
56eee37f | 1068 | return Add( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1069 | } |
1070 | ||
56eee37f | 1071 | inline wxSizerItem* |
5f813ad6 VZ |
1072 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) |
1073 | { | |
56eee37f | 1074 | return Add( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1075 | } |
1076 | ||
b701f995 VZ |
1077 | inline wxSizerItem* |
1078 | wxSizer::Add( int width, int height, const wxSizerFlags& flags ) | |
1079 | { | |
1080 | return Add( new wxSizerItem(width, height, flags) ); | |
1081 | } | |
1082 | ||
56eee37f | 1083 | inline wxSizerItem* |
8e32ea1c VZ |
1084 | wxSizer::AddSpacer(int size) |
1085 | { | |
56eee37f | 1086 | return Add(size, size); |
8e32ea1c VZ |
1087 | } |
1088 | ||
56eee37f | 1089 | inline wxSizerItem* |
8e32ea1c VZ |
1090 | wxSizer::AddStretchSpacer(int prop) |
1091 | { | |
56eee37f | 1092 | return Add(0, 0, prop); |
8e32ea1c VZ |
1093 | } |
1094 | ||
50961a35 PC |
1095 | inline wxSizerItem* |
1096 | wxSizer::Prepend( wxSizerItem *item ) | |
1097 | { | |
1098 | return Insert( 0, item ); | |
1099 | } | |
1100 | ||
56eee37f | 1101 | inline wxSizerItem* |
8e32ea1c VZ |
1102 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
1103 | { | |
56eee37f | 1104 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1105 | } |
1106 | ||
56eee37f | 1107 | inline wxSizerItem* |
8e32ea1c VZ |
1108 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
1109 | { | |
56eee37f | 1110 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1111 | } |
1112 | ||
56eee37f | 1113 | inline wxSizerItem* |
8e32ea1c VZ |
1114 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
1115 | { | |
56eee37f | 1116 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1117 | } |
1118 | ||
56eee37f | 1119 | inline wxSizerItem* |
8e32ea1c VZ |
1120 | wxSizer::PrependSpacer(int size) |
1121 | { | |
56eee37f | 1122 | return Prepend(size, size); |
8e32ea1c VZ |
1123 | } |
1124 | ||
56eee37f | 1125 | inline wxSizerItem* |
8e32ea1c VZ |
1126 | wxSizer::PrependStretchSpacer(int prop) |
1127 | { | |
56eee37f | 1128 | return Prepend(0, 0, prop); |
8e32ea1c VZ |
1129 | } |
1130 | ||
56eee37f | 1131 | inline wxSizerItem* |
5f813ad6 VZ |
1132 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) |
1133 | { | |
56eee37f | 1134 | return Prepend( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1135 | } |
1136 | ||
56eee37f | 1137 | inline wxSizerItem* |
5f813ad6 VZ |
1138 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) |
1139 | { | |
56eee37f | 1140 | return Prepend( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1141 | } |
1142 | ||
b701f995 VZ |
1143 | inline wxSizerItem* |
1144 | wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) | |
1145 | { | |
1146 | return Prepend( new wxSizerItem(width, height, flags) ); | |
1147 | } | |
1148 | ||
56eee37f | 1149 | inline wxSizerItem* |
8e32ea1c | 1150 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1151 | wxWindow *window, |
1152 | int proportion, | |
1153 | int flag, | |
1154 | int border, | |
1155 | wxObject* userData ) | |
8e32ea1c | 1156 | { |
56eee37f | 1157 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1158 | } |
1159 | ||
56eee37f | 1160 | inline wxSizerItem* |
8e32ea1c | 1161 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1162 | wxSizer *sizer, |
1163 | int proportion, | |
1164 | int flag, | |
1165 | int border, | |
1166 | wxObject* userData ) | |
8e32ea1c | 1167 | { |
56eee37f | 1168 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1169 | } |
1170 | ||
56eee37f | 1171 | inline wxSizerItem* |
8e32ea1c | 1172 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1173 | int width, |
1174 | int height, | |
1175 | int proportion, | |
1176 | int flag, | |
1177 | int border, | |
1178 | wxObject* userData ) | |
8e32ea1c | 1179 | { |
56eee37f | 1180 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1181 | } |
1182 | ||
56eee37f | 1183 | inline wxSizerItem* |
5f813ad6 VZ |
1184 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) |
1185 | { | |
56eee37f | 1186 | return Insert( index, new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1187 | } |
1188 | ||
56eee37f | 1189 | inline wxSizerItem* |
5f813ad6 VZ |
1190 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) |
1191 | { | |
56eee37f | 1192 | return Insert( index, new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1193 | } |
1194 | ||
b701f995 VZ |
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 | ||
56eee37f | 1201 | inline wxSizerItem* |
8e32ea1c VZ |
1202 | wxSizer::InsertSpacer(size_t index, int size) |
1203 | { | |
56eee37f | 1204 | return Insert(index, size, size); |
8e32ea1c VZ |
1205 | } |
1206 | ||
56eee37f | 1207 | inline wxSizerItem* |
8e32ea1c VZ |
1208 | wxSizer::InsertStretchSpacer(size_t index, int prop) |
1209 | { | |
56eee37f | 1210 | return Insert(index, 0, 0, prop); |
8e32ea1c VZ |
1211 | } |
1212 | ||
ade4eb65 | 1213 | #endif // __WXSIZER_H__ |