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