]>
Commit | Line | Data |
---|---|---|
5279a24d RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 | ||
acf2ac37 | 17 | #include "wx/button.h" |
5279a24d RR |
18 | #include "wx/window.h" |
19 | #include "wx/frame.h" | |
20 | #include "wx/dialog.h" | |
21 | ||
22 | //--------------------------------------------------------------------------- | |
23 | // classes | |
24 | //--------------------------------------------------------------------------- | |
25 | ||
446e5259 VS |
26 | class WXDLLEXPORT wxSizerItem; |
27 | class WXDLLEXPORT wxSizer; | |
28 | class WXDLLEXPORT wxBoxSizer; | |
5279a24d | 29 | |
5f813ad6 VZ |
30 | |
31 | // ---------------------------------------------------------------------------- | |
32 | // wxSizerFlags: flags used for an item in the sizer | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxSizerFlags | |
36 | { | |
37 | public: | |
38 | // construct the flags object initialized with the given proportion (0 by | |
39 | // default) | |
40 | wxSizerFlags(int proportion = 0) : m_proportion(proportion) | |
41 | { | |
42 | m_flags = 0; | |
43 | m_borderInPixels = 0; | |
44 | } | |
45 | ||
46 | // setters for all sizer flags, they all return the object itself so that | |
47 | // calls to them can be chained | |
48 | ||
49 | wxSizerFlags& Proportion(int proportion) | |
50 | { | |
51 | m_proportion = proportion; | |
52 | return *this; | |
53 | } | |
54 | ||
55 | wxSizerFlags& Align(int alignment) // combination of wxAlignment values | |
56 | { | |
ddfcd9aa | 57 | m_flags &= ~wxALIGN_MASK; |
5f813ad6 VZ |
58 | m_flags |= alignment; |
59 | ||
60 | return *this; | |
61 | } | |
62 | ||
00dc67b8 VZ |
63 | wxSizerFlags& Expand() |
64 | { | |
65 | m_flags |= wxEXPAND; | |
66 | return *this; | |
67 | } | |
68 | ||
5f813ad6 | 69 | // some shortcuts for Align() |
5f813ad6 VZ |
70 | wxSizerFlags& Centre() { return Align(wxCENTRE); } |
71 | wxSizerFlags& Center() { return Centre(); } | |
e72ac082 VZ |
72 | wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } |
73 | wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } | |
5f813ad6 VZ |
74 | |
75 | ||
76 | wxSizerFlags& Border(int direction, int borderInPixels) | |
77 | { | |
78 | m_flags &= ~wxALL; | |
79 | m_flags |= direction; | |
80 | ||
81 | m_borderInPixels = borderInPixels; | |
82 | ||
83 | return *this; | |
84 | } | |
85 | ||
86 | wxSizerFlags& Border(int direction = wxALL) | |
87 | { | |
88 | // FIXME: default border size shouldn't be hardcoded | |
92b0cd9e VZ |
89 | #ifdef __SMARTPHONE__ |
90 | // no borders by default on limited size screen | |
91 | wxUnusedVar(direction); | |
92 | ||
93 | return *this; | |
94 | #else | |
5f813ad6 | 95 | return Border(direction, 5); |
92b0cd9e | 96 | #endif |
5f813ad6 VZ |
97 | } |
98 | ||
99 | ||
100 | // accessors for wxSizer only | |
101 | int GetProportion() const { return m_proportion; } | |
102 | int GetFlags() const { return m_flags; } | |
103 | int GetBorderInPixels() const { return m_borderInPixels; } | |
104 | ||
105 | private: | |
106 | int m_proportion; | |
107 | int m_flags; | |
108 | int m_borderInPixels; | |
109 | }; | |
110 | ||
111 | ||
50c06297 VZ |
112 | // ---------------------------------------------------------------------------- |
113 | // wxSizerSpacer: used by wxSizerItem to represent a spacer | |
114 | // ---------------------------------------------------------------------------- | |
5279a24d | 115 | |
50c06297 | 116 | class WXDLLEXPORT wxSizerSpacer |
5279a24d RR |
117 | { |
118 | public: | |
50c06297 | 119 | wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } |
5f813ad6 | 120 | |
50c06297 VZ |
121 | void SetSize(const wxSize& size) { m_size = size; } |
122 | const wxSize& GetSize() const { return m_size; } | |
5f813ad6 | 123 | |
50c06297 VZ |
124 | void Show(bool show) { m_isShown = show; } |
125 | bool IsShown() const { return m_isShown; } | |
5f813ad6 | 126 | |
50c06297 VZ |
127 | private: |
128 | // the size, in pixel | |
129 | wxSize m_size; | |
df5ddbca | 130 | |
50c06297 VZ |
131 | // is the spacer currently shown? |
132 | bool m_isShown; | |
133 | }; | |
134 | ||
135 | // ---------------------------------------------------------------------------- | |
136 | // wxSizerItem | |
137 | // ---------------------------------------------------------------------------- | |
138 | ||
139 | class WXDLLEXPORT wxSizerItem : public wxObject | |
140 | { | |
141 | public: | |
df5ddbca | 142 | // window |
12a3f227 RL |
143 | wxSizerItem( wxWindow *window, |
144 | int proportion, | |
145 | int flag, | |
146 | int border, | |
147 | wxObject* userData ); | |
df5ddbca | 148 | |
50c06297 VZ |
149 | // window with flags |
150 | wxSizerItem(wxWindow *window, const wxSizerFlags& flags) | |
151 | { | |
152 | Init(flags); | |
153 | ||
154 | SetWindow(window); | |
155 | } | |
156 | ||
df5ddbca | 157 | // subsizer |
12a3f227 RL |
158 | wxSizerItem( wxSizer *sizer, |
159 | int proportion, | |
160 | int flag, | |
161 | int border, | |
162 | wxObject* userData ); | |
df5ddbca | 163 | |
50c06297 VZ |
164 | // sizer with flags |
165 | wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) | |
166 | { | |
167 | Init(flags); | |
168 | ||
169 | SetSizer(sizer); | |
170 | } | |
171 | ||
5f813ad6 VZ |
172 | // spacer |
173 | wxSizerItem( int width, | |
174 | int height, | |
175 | int proportion, | |
176 | int flag, | |
177 | int border, | |
178 | wxObject* userData); | |
179 | ||
50c06297 VZ |
180 | // spacer with flags |
181 | wxSizerItem(int width, int height, const wxSizerFlags& flags) | |
182 | { | |
183 | Init(flags); | |
184 | ||
185 | SetSpacer(width, height); | |
186 | } | |
187 | ||
20b35a69 RD |
188 | wxSizerItem(); |
189 | virtual ~wxSizerItem(); | |
dc259b79 | 190 | |
84f7908b | 191 | virtual void DeleteWindows(); |
df5ddbca | 192 | |
96fdbb60 | 193 | // Enable deleting the SizerItem without destroying the contained sizer. |
50c06297 | 194 | void DetachSizer() { m_sizer = NULL; } |
96fdbb60 | 195 | |
9cbee2ce | 196 | virtual wxSize GetSize() const; |
df5ddbca | 197 | virtual wxSize CalcMin(); |
fbfb8bcc | 198 | virtual void SetDimension( const wxPoint& pos, const wxSize& size ); |
df5ddbca | 199 | |
9cbee2ce | 200 | wxSize GetMinSize() const |
df5ddbca | 201 | { return m_minSize; } |
ba763a45 RD |
202 | wxSize GetMinSizeWithBorder() const; |
203 | ||
1eba2193 | 204 | void SetMinSize(const wxSize& size) |
50c06297 VZ |
205 | { |
206 | if ( IsWindow() ) | |
207 | m_window->SetMinSize(size); | |
208 | m_minSize = size; | |
209 | } | |
1eba2193 | 210 | void SetMinSize( int x, int y ) |
8b2bac62 | 211 | { SetMinSize(wxSize(x, y)); } |
12a3f227 | 212 | void SetInitSize( int x, int y ) |
1eba2193 | 213 | { SetMinSize(wxSize(x, y)); } |
df5ddbca | 214 | |
50c06297 VZ |
215 | // if either of dimensions is zero, ratio is assumed to be 1 |
216 | // to avoid "divide by zero" errors | |
217 | void SetRatio(int width, int height) | |
df5ddbca | 218 | { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } |
50c06297 VZ |
219 | void SetRatio(const wxSize& size) |
220 | { SetRatio(size.x, size.y); } | |
221 | void SetRatio(float ratio) | |
df5ddbca | 222 | { m_ratio = ratio; } |
2aab8f16 | 223 | float GetRatio() const |
df5ddbca RR |
224 | { return m_ratio; } |
225 | ||
50c06297 | 226 | virtual wxRect GetRect() { return m_rect; } |
56eee37f | 227 | |
50c06297 VZ |
228 | bool IsWindow() const { return m_kind == Item_Window; } |
229 | bool IsSizer() const { return m_kind == Item_Sizer; } | |
230 | bool IsSpacer() const { return m_kind == Item_Spacer; } | |
2aab8f16 | 231 | |
12a3f227 RL |
232 | // Deprecated in 2.6, use {G,S}etProportion instead. |
233 | wxDEPRECATED( void SetOption( int option ) ); | |
234 | wxDEPRECATED( int GetOption() const ); | |
235 | ||
236 | void SetProportion( int proportion ) | |
237 | { m_proportion = proportion; } | |
238 | int GetProportion() const | |
239 | { return m_proportion; } | |
df5ddbca RR |
240 | void SetFlag( int flag ) |
241 | { m_flag = flag; } | |
12a3f227 RL |
242 | int GetFlag() const |
243 | { return m_flag; } | |
df5ddbca RR |
244 | void SetBorder( int border ) |
245 | { m_border = border; } | |
12a3f227 RL |
246 | int GetBorder() const |
247 | { return m_border; } | |
df5ddbca RR |
248 | |
249 | wxWindow *GetWindow() const | |
50c06297 | 250 | { return m_kind == Item_Window ? m_window : NULL; } |
df5ddbca | 251 | wxSizer *GetSizer() const |
50c06297 VZ |
252 | { return m_kind == Item_Sizer ? m_sizer : NULL; } |
253 | wxSize GetSpacer() const; | |
12a3f227 | 254 | |
c86fd3a7 VZ |
255 | // this function behaves obviously for the windows and spacers but for the |
256 | // sizers it returns true if any sizer element is shown and only returns | |
257 | // false if all of them are hidden | |
258 | bool IsShown() const; | |
50c06297 | 259 | void Show(bool show); |
12a3f227 | 260 | |
e8c1be04 | 261 | void SetUserData(wxObject* userData) |
1737dac2 | 262 | { delete m_userData; m_userData = userData; } |
9cbee2ce | 263 | wxObject* GetUserData() const |
df5ddbca | 264 | { return m_userData; } |
9cbee2ce | 265 | wxPoint GetPosition() const |
df5ddbca | 266 | { return m_pos; } |
0c0d686f | 267 | |
50c06297 VZ |
268 | |
269 | // these functions do not free old sizer/spacer | |
270 | void SetWindow(wxWindow *window); | |
271 | void SetSizer(wxSizer *sizer); | |
272 | void SetSpacer(const wxSize& size); | |
273 | void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } | |
274 | ||
c62ac5b6 | 275 | protected: |
5f813ad6 | 276 | // common part of several ctors |
50c06297 | 277 | void Init() { m_userData = NULL; } |
5f813ad6 VZ |
278 | |
279 | // common part of ctors taking wxSizerFlags | |
280 | void Init(const wxSizerFlags& flags); | |
281 | ||
f303d69f VZ |
282 | |
283 | // discriminated union: depending on m_kind one of the fields is valid | |
50c06297 VZ |
284 | enum |
285 | { | |
286 | Item_None, | |
287 | Item_Window, | |
288 | Item_Sizer, | |
289 | Item_Spacer, | |
290 | Item_Max | |
291 | } m_kind; | |
292 | union | |
293 | { | |
294 | wxWindow *m_window; | |
295 | wxSizer *m_sizer; | |
296 | wxSizerSpacer *m_spacer; | |
297 | }; | |
5f813ad6 | 298 | |
df5ddbca RR |
299 | wxPoint m_pos; |
300 | wxSize m_minSize; | |
12a3f227 | 301 | int m_proportion; |
df5ddbca RR |
302 | int m_border; |
303 | int m_flag; | |
2b5f62a0 | 304 | |
50c06297 VZ |
305 | // on screen rectangle of this item (not including borders) |
306 | wxRect m_rect; | |
12a3f227 RL |
307 | |
308 | // Aspect ratio can always be calculated from m_size, | |
309 | // but this would cause precision loss when the window | |
310 | // is shrunk. It is safer to preserve the initial value. | |
df5ddbca | 311 | float m_ratio; |
2b5f62a0 | 312 | |
df5ddbca | 313 | wxObject *m_userData; |
2aab8f16 | 314 | |
9cbee2ce | 315 | private: |
4393b50c | 316 | DECLARE_CLASS(wxSizerItem) |
22f3361e | 317 | DECLARE_NO_COPY_CLASS(wxSizerItem) |
c62ac5b6 | 318 | }; |
5279a24d | 319 | |
12a3f227 RL |
320 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); |
321 | ||
5f813ad6 | 322 | |
5279a24d | 323 | //--------------------------------------------------------------------------- |
3417c2cd | 324 | // wxSizer |
5279a24d RR |
325 | //--------------------------------------------------------------------------- |
326 | ||
2aab8f16 | 327 | class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer |
5279a24d RR |
328 | { |
329 | public: | |
f303d69f | 330 | wxSizer() { } |
f6bcfd97 BP |
331 | ~wxSizer(); |
332 | ||
436ae7cf VZ |
333 | // methods for adding elements to the sizer: there are Add/Insert/Prepend |
334 | // overloads for each of window/sizer/spacer/wxSizerItem | |
56eee37f WS |
335 | inline wxSizerItem* Add( wxWindow *window, |
336 | int proportion = 0, | |
337 | int flag = 0, | |
338 | int border = 0, | |
339 | wxObject* userData = NULL ); | |
340 | inline wxSizerItem* Add( wxSizer *sizer, | |
341 | int proportion = 0, | |
342 | int flag = 0, | |
343 | int border = 0, | |
344 | wxObject* userData = NULL ); | |
345 | inline wxSizerItem* Add( int width, | |
346 | int height, | |
347 | int proportion = 0, | |
348 | int flag = 0, | |
349 | int border = 0, | |
350 | wxObject* userData = NULL ); | |
351 | inline wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags ); | |
352 | inline wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags ); | |
353 | inline wxSizerItem* Add( wxSizerItem *item ); | |
354 | ||
355 | inline wxSizerItem* AddSpacer(int size); | |
356 | inline wxSizerItem* AddStretchSpacer(int prop = 1); | |
357 | ||
358 | inline wxSizerItem* Insert( size_t index, | |
359 | wxWindow *window, | |
360 | int proportion = 0, | |
361 | int flag = 0, | |
362 | int border = 0, | |
363 | wxObject* userData = NULL ); | |
364 | inline wxSizerItem* Insert( size_t index, | |
365 | wxSizer *sizer, | |
366 | int proportion = 0, | |
367 | int flag = 0, | |
368 | int border = 0, | |
369 | wxObject* userData = NULL ); | |
370 | inline wxSizerItem* Insert( size_t index, | |
371 | int width, | |
372 | int height, | |
373 | int proportion = 0, | |
374 | int flag = 0, | |
375 | int border = 0, | |
376 | wxObject* userData = NULL ); | |
377 | inline wxSizerItem* Insert( size_t index, | |
378 | wxWindow *window, | |
379 | const wxSizerFlags& flags ); | |
380 | inline wxSizerItem* Insert( size_t index, | |
381 | wxSizer *sizer, | |
382 | const wxSizerFlags& flags ); | |
383 | virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); | |
384 | ||
385 | inline wxSizerItem* InsertSpacer(size_t index, int size); | |
386 | inline wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); | |
387 | ||
388 | inline wxSizerItem* Prepend( wxWindow *window, | |
389 | int proportion = 0, | |
390 | int flag = 0, | |
391 | int border = 0, | |
392 | wxObject* userData = NULL ); | |
393 | inline wxSizerItem* Prepend( wxSizer *sizer, | |
394 | int proportion = 0, | |
395 | int flag = 0, | |
396 | int border = 0, | |
397 | wxObject* userData = NULL ); | |
398 | inline wxSizerItem* Prepend( int width, | |
399 | int height, | |
400 | int proportion = 0, | |
401 | int flag = 0, | |
402 | int border = 0, | |
403 | wxObject* userData = NULL ); | |
404 | inline wxSizerItem* Prepend( wxWindow *window, const wxSizerFlags& flags ); | |
405 | inline wxSizerItem* Prepend( wxSizer *sizer, const wxSizerFlags& flags ); | |
406 | inline wxSizerItem* Prepend( wxSizerItem *item ); | |
407 | ||
408 | inline wxSizerItem* PrependSpacer(int size); | |
409 | inline wxSizerItem* PrependStretchSpacer(int prop = 1); | |
8e32ea1c | 410 | |
749bb9f1 | 411 | |
12a3f227 RL |
412 | // Deprecated in 2.6 since historically it does not delete the window, |
413 | // use Detach instead. | |
414 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
f6bcfd97 | 415 | virtual bool Remove( wxSizer *sizer ); |
e0d8fb45 | 416 | virtual bool Remove( int index ); |
00976fe5 | 417 | |
12a3f227 | 418 | virtual bool Detach( wxWindow *window ); |
00976fe5 | 419 | virtual bool Detach( wxSizer *sizer ); |
e0d8fb45 | 420 | virtual bool Detach( int index ); |
00976fe5 | 421 | |
e0d8fb45 | 422 | virtual void Clear( bool delete_windows = false ); |
84f7908b | 423 | virtual void DeleteWindows(); |
f6bcfd97 BP |
424 | |
425 | void SetMinSize( int width, int height ) | |
426 | { DoSetMinSize( width, height ); } | |
fbfb8bcc | 427 | void SetMinSize( const wxSize& size ) |
f6bcfd97 | 428 | { DoSetMinSize( size.x, size.y ); } |
1e6feb95 | 429 | |
50c06297 | 430 | // Searches recursively |
f6bcfd97 BP |
431 | bool SetItemMinSize( wxWindow *window, int width, int height ) |
432 | { return DoSetItemMinSize( window, width, height ); } | |
fbfb8bcc | 433 | bool SetItemMinSize( wxWindow *window, const wxSize& size ) |
f6bcfd97 | 434 | { return DoSetItemMinSize( window, size.x, size.y ); } |
1e6feb95 | 435 | |
50c06297 | 436 | // Searches recursively |
f6bcfd97 BP |
437 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) |
438 | { return DoSetItemMinSize( sizer, width, height ); } | |
fbfb8bcc | 439 | bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) |
f6bcfd97 | 440 | { return DoSetItemMinSize( sizer, size.x, size.y ); } |
1e6feb95 | 441 | |
12a3f227 RL |
442 | bool SetItemMinSize( size_t index, int width, int height ) |
443 | { return DoSetItemMinSize( index, width, height ); } | |
fbfb8bcc | 444 | bool SetItemMinSize( size_t index, const wxSize& size ) |
12a3f227 | 445 | { return DoSetItemMinSize( index, size.x, size.y ); } |
1e6feb95 | 446 | |
9cbee2ce | 447 | wxSize GetSize() const |
f6bcfd97 | 448 | { return m_size; } |
9cbee2ce | 449 | wxPoint GetPosition() const |
f6bcfd97 | 450 | { return m_position; } |
1e6feb95 | 451 | |
50c06297 | 452 | // Calculate the minimal size or return m_minSize if bigger. |
f6bcfd97 BP |
453 | wxSize GetMinSize(); |
454 | ||
455 | virtual void RecalcSizes() = 0; | |
456 | virtual wxSize CalcMin() = 0; | |
457 | ||
458 | virtual void Layout(); | |
459 | ||
e5251d4f | 460 | wxSize Fit( wxWindow *window ); |
566d84a7 | 461 | void FitInside( wxWindow *window ); |
f6bcfd97 | 462 | void SetSizeHints( wxWindow *window ); |
566d84a7 | 463 | void SetVirtualSizeHints( wxWindow *window ); |
f6bcfd97 | 464 | |
12a3f227 | 465 | wxSizerItemList& GetChildren() |
f6bcfd97 BP |
466 | { return m_children; } |
467 | ||
468 | void SetDimension( int x, int y, int width, int height ); | |
0c0d686f | 469 | |
9f13661f WS |
470 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); |
471 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
472 | wxSizerItem* GetItem( size_t index ); | |
473 | ||
12a3f227 | 474 | // Manage whether individual scene items are considered |
2b5f62a0 | 475 | // in the layout calculations or not. |
8b2bac62 WS |
476 | bool Show( wxWindow *window, bool show = true, bool recursive = false ); |
477 | bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); | |
478 | bool Show( size_t index, bool show = true ); | |
12a3f227 | 479 | |
8b2bac62 WS |
480 | bool Hide( wxSizer *sizer, bool recursive = false ) |
481 | { return Show( sizer, false, recursive ); } | |
482 | bool Hide( wxWindow *window, bool recursive = false ) | |
483 | { return Show( window, false, recursive ); } | |
484 | bool Hide( size_t index ) | |
485 | { return Show( index, false ); } | |
2b5f62a0 | 486 | |
9cbee2ce RL |
487 | bool IsShown( wxWindow *window ) const; |
488 | bool IsShown( wxSizer *sizer ) const; | |
489 | bool IsShown( size_t index ) const; | |
dc259b79 | 490 | |
2b5f62a0 | 491 | // Recursively call wxWindow::Show () on all sizer items. |
eb2a7883 | 492 | virtual void ShowItems (bool show); |
2b5f62a0 | 493 | |
f303d69f | 494 | void Show(bool show) { ShowItems(show); } |
50c06297 | 495 | |
f6bcfd97 | 496 | protected: |
12a3f227 RL |
497 | wxSize m_size; |
498 | wxSize m_minSize; | |
499 | wxPoint m_position; | |
500 | wxSizerItemList m_children; | |
f6bcfd97 | 501 | |
9cbee2ce | 502 | wxSize GetMaxWindowSize( wxWindow *window ) const; |
f6bcfd97 | 503 | wxSize GetMinWindowSize( wxWindow *window ); |
9cbee2ce | 504 | wxSize GetMaxClientSize( wxWindow *window ) const; |
566d84a7 | 505 | wxSize GetMinClientSize( wxWindow *window ); |
65ba4113 | 506 | wxSize FitSize( wxWindow *window ); |
566d84a7 | 507 | wxSize VirtualFitSize( wxWindow *window ); |
65ba4113 | 508 | |
f6bcfd97 BP |
509 | virtual void DoSetMinSize( int width, int height ); |
510 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
511 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
12a3f227 | 512 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); |
1e6feb95 | 513 | |
9cbee2ce | 514 | private: |
4393b50c | 515 | DECLARE_CLASS(wxSizer) |
f6bcfd97 | 516 | }; |
c62ac5b6 | 517 | |
f6bcfd97 BP |
518 | //--------------------------------------------------------------------------- |
519 | // wxGridSizer | |
520 | //--------------------------------------------------------------------------- | |
0c0d686f | 521 | |
f6bcfd97 BP |
522 | class WXDLLEXPORT wxGridSizer: public wxSizer |
523 | { | |
524 | public: | |
525 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
526 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
1e6feb95 | 527 | |
5d76f462 VZ |
528 | virtual void RecalcSizes(); |
529 | virtual wxSize CalcMin(); | |
f6bcfd97 BP |
530 | |
531 | void SetCols( int cols ) { m_cols = cols; } | |
532 | void SetRows( int rows ) { m_rows = rows; } | |
533 | void SetVGap( int gap ) { m_vgap = gap; } | |
534 | void SetHGap( int gap ) { m_hgap = gap; } | |
9cbee2ce RL |
535 | int GetCols() const { return m_cols; } |
536 | int GetRows() const { return m_rows; } | |
537 | int GetVGap() const { return m_vgap; } | |
538 | int GetHGap() const { return m_hgap; } | |
1e6feb95 | 539 | |
f6bcfd97 BP |
540 | protected: |
541 | int m_rows; | |
542 | int m_cols; | |
543 | int m_vgap; | |
544 | int m_hgap; | |
1e6feb95 | 545 | |
0ca5105b VZ |
546 | // return the number of total items and the number of columns and rows |
547 | int CalcRowsCols(int& rows, int& cols) const; | |
548 | ||
f6bcfd97 | 549 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); |
1e6feb95 | 550 | |
9cbee2ce | 551 | private: |
4393b50c | 552 | DECLARE_CLASS(wxGridSizer) |
f6bcfd97 | 553 | }; |
5279a24d | 554 | |
f6bcfd97 BP |
555 | //--------------------------------------------------------------------------- |
556 | // wxFlexGridSizer | |
557 | //--------------------------------------------------------------------------- | |
0c0d686f | 558 | |
5d76f462 VZ |
559 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" |
560 | // direction | |
561 | enum wxFlexSizerGrowMode | |
562 | { | |
563 | // don't resize the cells in non-flexible direction at all | |
564 | wxFLEX_GROWMODE_NONE, | |
565 | ||
566 | // uniformly resize only the specified ones (default) | |
567 | wxFLEX_GROWMODE_SPECIFIED, | |
568 | ||
569 | // uniformly resize all cells | |
570 | wxFLEX_GROWMODE_ALL | |
571 | }; | |
572 | ||
f6bcfd97 BP |
573 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer |
574 | { | |
575 | public: | |
5d76f462 | 576 | // ctors/dtor |
f6bcfd97 BP |
577 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); |
578 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
5d76f462 | 579 | virtual ~wxFlexGridSizer(); |
1e6feb95 | 580 | |
1e6feb95 | 581 | |
5d76f462 VZ |
582 | // set the rows/columns which will grow (the others will remain of the |
583 | // constant initial size) | |
e8800dcf | 584 | void AddGrowableRow( size_t idx, int proportion = 0 ); |
f6bcfd97 | 585 | void RemoveGrowableRow( size_t idx ); |
e8800dcf | 586 | void AddGrowableCol( size_t idx, int proportion = 0 ); |
f6bcfd97 | 587 | void RemoveGrowableCol( size_t idx ); |
0c0d686f | 588 | |
1e6feb95 | 589 | |
5d76f462 VZ |
590 | // the sizer cells may grow in both directions, not grow at all or only |
591 | // grow in one direction but not the other | |
592 | ||
593 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
594 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
595 | int GetFlexibleDirection() const { return m_flexDirection; } | |
596 | ||
597 | // note that the grow mode only applies to the direction which is not | |
598 | // flexible | |
599 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
600 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
601 | ||
fc1fcd0e RD |
602 | // Read-only access to the row heights and col widths arrays |
603 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
604 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
8b2bac62 | 605 | |
5d76f462 VZ |
606 | // implementation |
607 | virtual void RecalcSizes(); | |
608 | virtual wxSize CalcMin(); | |
609 | ||
610 | protected: | |
20b35a69 RD |
611 | void AdjustForFlexDirection(); |
612 | void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, | |
613 | int nrows, int ncols); | |
8b2bac62 | 614 | |
5d76f462 VZ |
615 | // the heights/widths of all rows/columns |
616 | wxArrayInt m_rowHeights, | |
617 | m_colWidths; | |
618 | ||
619 | // indices of the growable columns and rows | |
620 | wxArrayInt m_growableRows, | |
621 | m_growableCols; | |
622 | ||
e8800dcf VZ |
623 | // proportion values of the corresponding growable rows and columns |
624 | wxArrayInt m_growableRowsProportions, | |
625 | m_growableColsProportions; | |
626 | ||
5d76f462 VZ |
627 | // parameters describing whether the growable cells should be resized in |
628 | // both directions or only one | |
629 | int m_flexDirection; | |
630 | wxFlexSizerGrowMode m_growMode; | |
1e6feb95 | 631 | |
ba763a45 RD |
632 | // saves CalcMin result to optimize RecalcSizes |
633 | wxSize m_calculatedMinSize; | |
634 | ||
9cbee2ce | 635 | private: |
4393b50c | 636 | DECLARE_CLASS(wxFlexGridSizer) |
22f3361e | 637 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) |
c62ac5b6 RR |
638 | }; |
639 | ||
640 | //--------------------------------------------------------------------------- | |
92afa2b1 | 641 | // wxBoxSizer |
c62ac5b6 RR |
642 | //--------------------------------------------------------------------------- |
643 | ||
92afa2b1 | 644 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
645 | { |
646 | public: | |
f6bcfd97 | 647 | wxBoxSizer( int orient ); |
0c0d686f | 648 | |
f6bcfd97 BP |
649 | void RecalcSizes(); |
650 | wxSize CalcMin(); | |
0c0d686f | 651 | |
9cbee2ce | 652 | int GetOrientation() const |
f6bcfd97 | 653 | { return m_orient; } |
0c0d686f | 654 | |
b657b4c9 JS |
655 | void SetOrientation(int orient) |
656 | { m_orient = orient; } | |
657 | ||
61d514bb RR |
658 | protected: |
659 | int m_orient; | |
660 | int m_stretchable; | |
661 | int m_minWidth; | |
662 | int m_minHeight; | |
663 | int m_fixedWidth; | |
664 | int m_fixedHeight; | |
1e6feb95 | 665 | |
9cbee2ce | 666 | private: |
4393b50c | 667 | DECLARE_CLASS(wxBoxSizer) |
61d514bb | 668 | }; |
0c0d686f | 669 | |
27ea1d8a RR |
670 | //--------------------------------------------------------------------------- |
671 | // wxStaticBoxSizer | |
672 | //--------------------------------------------------------------------------- | |
673 | ||
1e6feb95 VZ |
674 | #if wxUSE_STATBOX |
675 | ||
676 | class WXDLLEXPORT wxStaticBox; | |
677 | ||
27ea1d8a RR |
678 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer |
679 | { | |
680 | public: | |
6c1635b5 | 681 | wxStaticBoxSizer(wxStaticBox *box, int orient); |
450a1593 | 682 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); |
0c0d686f | 683 | |
f6bcfd97 BP |
684 | void RecalcSizes(); |
685 | wxSize CalcMin(); | |
0c0d686f | 686 | |
9cbee2ce | 687 | wxStaticBox *GetStaticBox() const |
f6bcfd97 | 688 | { return m_staticBox; } |
0c0d686f | 689 | |
eb2a7883 VZ |
690 | // override to hide/show the static box as well |
691 | virtual void ShowItems (bool show); | |
692 | ||
27ea1d8a | 693 | protected: |
f6bcfd97 | 694 | wxStaticBox *m_staticBox; |
1e6feb95 | 695 | |
9cbee2ce | 696 | private: |
4393b50c | 697 | DECLARE_CLASS(wxStaticBoxSizer) |
22f3361e | 698 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) |
27ea1d8a RR |
699 | }; |
700 | ||
1e6feb95 VZ |
701 | #endif // wxUSE_STATBOX |
702 | ||
974c2a59 WS |
703 | #if wxUSE_BUTTON |
704 | ||
acf2ac37 RR |
705 | class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer |
706 | { | |
707 | public: | |
acf2ac37 RR |
708 | // Constructor just creates a new wxBoxSizer, not much else. |
709 | // Box sizer orientation is automatically determined here: | |
710 | // vertical for PDAs, horizontal for everything else? | |
b181a505 | 711 | wxStdDialogButtonSizer(); |
acf2ac37 | 712 | |
acf2ac37 | 713 | // Checks button ID against system IDs and sets one of the pointers below |
b181a505 RR |
714 | // to this button. Does not do any sizer-related things here. |
715 | void AddButton(wxButton *button); | |
acf2ac37 | 716 | |
b181a505 RR |
717 | // Use these if no standard ID can/should be used |
718 | void SetAffirmativeButton( wxButton *button ); | |
719 | void SetNegativeButton( wxButton *button ); | |
720 | void SetCancelButton( wxButton *button ); | |
acf2ac37 | 721 | |
acf2ac37 RR |
722 | // All platform-specific code here, checks which buttons exist and add |
723 | // them to the sizer accordingly. | |
724 | // Note - one potential hack on Mac we could use here, | |
725 | // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE | |
726 | // is set to _("Save") and m_buttonNegative is set to _("Don't Save") | |
727 | // I wouldn't add any other hacks like that into here, | |
728 | // but this one I can see being useful. | |
718903fe | 729 | void Realize(); |
974c2a59 | 730 | |
acf2ac37 RR |
731 | wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } |
732 | wxButton *GetApplyButton() const { return m_buttonApply; } | |
733 | wxButton *GetNegativeButton() const { return m_buttonNegative; } | |
734 | wxButton *GetCancelButton() const { return m_buttonCancel; } | |
735 | wxButton *GetHelpButton() const { return m_buttonHelp; } | |
736 | ||
737 | protected: | |
b181a505 | 738 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here |
acf2ac37 | 739 | wxButton *m_buttonApply; |
b181a505 | 740 | wxButton *m_buttonNegative; // wxID_NO |
acf2ac37 RR |
741 | wxButton *m_buttonCancel; |
742 | wxButton *m_buttonHelp; | |
974c2a59 | 743 | |
acf2ac37 RR |
744 | private: |
745 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
b181a505 | 746 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) |
acf2ac37 | 747 | }; |
adbf2d73 | 748 | |
6b5c4761 | 749 | #endif // wxUSE_BUTTON |
974c2a59 | 750 | |
adbf2d73 VS |
751 | #if WXWIN_COMPATIBILITY_2_4 |
752 | // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they | |
61c083e7 | 753 | // don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. |
adbf2d73 | 754 | |
ade4eb65 VZ |
755 | // ---------------------------------------------------------------------------- |
756 | // wxBookCtrlSizer | |
757 | // ---------------------------------------------------------------------------- | |
83edc0a5 | 758 | |
ade4eb65 | 759 | #if wxUSE_BOOKCTRL |
65e4f9b9 | 760 | |
8e32ea1c | 761 | // this sizer works with wxNotebook/wxListbook/... and sizes the control to |
ade4eb65 | 762 | // fit its pages |
61c083e7 | 763 | class WXDLLEXPORT wxBookCtrlBase; |
1e6feb95 | 764 | |
ade4eb65 | 765 | class WXDLLEXPORT wxBookCtrlSizer : public wxSizer |
83edc0a5 | 766 | { |
83edc0a5 | 767 | public: |
61c083e7 | 768 | wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); |
83edc0a5 | 769 | |
61c083e7 | 770 | wxBookCtrlBase *GetControl() const { return m_bookctrl; } |
8b2bac62 | 771 | |
ade4eb65 VZ |
772 | virtual void RecalcSizes(); |
773 | virtual wxSize CalcMin(); | |
83edc0a5 | 774 | |
83edc0a5 | 775 | protected: |
adbf2d73 | 776 | // this protected ctor lets us mark the real one above as deprecated |
749bb9f1 | 777 | // and still have warning-free build of the library itself: |
adbf2d73 | 778 | wxBookCtrlSizer() {} |
8b2bac62 | 779 | |
61c083e7 | 780 | wxBookCtrlBase *m_bookctrl; |
ade4eb65 VZ |
781 | |
782 | private: | |
783 | DECLARE_CLASS(wxBookCtrlSizer) | |
784 | DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) | |
785 | }; | |
786 | ||
787 | ||
788 | #if wxUSE_NOTEBOOK | |
789 | ||
61c083e7 | 790 | // before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards |
ade4eb65 VZ |
791 | // compatibility |
792 | class WXDLLEXPORT wxNotebook; | |
793 | ||
794 | class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer | |
795 | { | |
796 | public: | |
adbf2d73 | 797 | wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); |
ade4eb65 VZ |
798 | |
799 | wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } | |
1e6feb95 | 800 | |
9cbee2ce | 801 | private: |
4393b50c | 802 | DECLARE_CLASS(wxNotebookSizer) |
22f3361e | 803 | DECLARE_NO_COPY_CLASS(wxNotebookSizer) |
83edc0a5 RR |
804 | }; |
805 | ||
1e6feb95 | 806 | #endif // wxUSE_NOTEBOOK |
65e4f9b9 | 807 | |
ade4eb65 VZ |
808 | #endif // wxUSE_BOOKCTRL |
809 | ||
adbf2d73 VS |
810 | #endif // WXWIN_COMPATIBILITY_2_4 |
811 | ||
8e32ea1c VZ |
812 | // ---------------------------------------------------------------------------- |
813 | // inline functions implementation | |
814 | // ---------------------------------------------------------------------------- | |
815 | ||
56eee37f | 816 | inline wxSizerItem* |
8e32ea1c VZ |
817 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
818 | { | |
56eee37f | 819 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
820 | } |
821 | ||
56eee37f | 822 | inline wxSizerItem* |
8e32ea1c VZ |
823 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
824 | { | |
56eee37f | 825 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
826 | } |
827 | ||
56eee37f | 828 | inline wxSizerItem* |
8e32ea1c VZ |
829 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
830 | { | |
56eee37f | 831 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
832 | } |
833 | ||
56eee37f | 834 | inline wxSizerItem* |
5f813ad6 VZ |
835 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) |
836 | { | |
56eee37f | 837 | return Add( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
838 | } |
839 | ||
56eee37f | 840 | inline wxSizerItem* |
5f813ad6 VZ |
841 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) |
842 | { | |
56eee37f | 843 | return Add( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
844 | } |
845 | ||
56eee37f | 846 | inline wxSizerItem* |
8e32ea1c VZ |
847 | wxSizer::Add( wxSizerItem *item ) |
848 | { | |
56eee37f | 849 | return Insert( m_children.GetCount(), item ); |
8e32ea1c VZ |
850 | } |
851 | ||
56eee37f | 852 | inline wxSizerItem* |
8e32ea1c VZ |
853 | wxSizer::AddSpacer(int size) |
854 | { | |
56eee37f | 855 | return Add(size, size); |
8e32ea1c VZ |
856 | } |
857 | ||
56eee37f | 858 | inline wxSizerItem* |
8e32ea1c VZ |
859 | wxSizer::AddStretchSpacer(int prop) |
860 | { | |
56eee37f | 861 | return Add(0, 0, prop); |
8e32ea1c VZ |
862 | } |
863 | ||
56eee37f | 864 | inline wxSizerItem* |
8e32ea1c VZ |
865 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
866 | { | |
56eee37f | 867 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
868 | } |
869 | ||
56eee37f | 870 | inline wxSizerItem* |
8e32ea1c VZ |
871 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
872 | { | |
56eee37f | 873 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
874 | } |
875 | ||
56eee37f | 876 | inline wxSizerItem* |
8e32ea1c VZ |
877 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
878 | { | |
56eee37f | 879 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
880 | } |
881 | ||
56eee37f | 882 | inline wxSizerItem* |
8e32ea1c VZ |
883 | wxSizer::Prepend( wxSizerItem *item ) |
884 | { | |
56eee37f | 885 | return Insert( 0, item ); |
8e32ea1c VZ |
886 | } |
887 | ||
56eee37f | 888 | inline wxSizerItem* |
8e32ea1c VZ |
889 | wxSizer::PrependSpacer(int size) |
890 | { | |
56eee37f | 891 | return Prepend(size, size); |
8e32ea1c VZ |
892 | } |
893 | ||
56eee37f | 894 | inline wxSizerItem* |
8e32ea1c VZ |
895 | wxSizer::PrependStretchSpacer(int prop) |
896 | { | |
56eee37f | 897 | return Prepend(0, 0, prop); |
8e32ea1c VZ |
898 | } |
899 | ||
56eee37f | 900 | inline wxSizerItem* |
5f813ad6 VZ |
901 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) |
902 | { | |
56eee37f | 903 | return Prepend( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
904 | } |
905 | ||
56eee37f | 906 | inline wxSizerItem* |
5f813ad6 VZ |
907 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) |
908 | { | |
56eee37f | 909 | return Prepend( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
910 | } |
911 | ||
56eee37f | 912 | inline wxSizerItem* |
8e32ea1c | 913 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
914 | wxWindow *window, |
915 | int proportion, | |
916 | int flag, | |
917 | int border, | |
918 | wxObject* userData ) | |
8e32ea1c | 919 | { |
56eee37f | 920 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
921 | } |
922 | ||
56eee37f | 923 | inline wxSizerItem* |
8e32ea1c | 924 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
925 | wxSizer *sizer, |
926 | int proportion, | |
927 | int flag, | |
928 | int border, | |
929 | wxObject* userData ) | |
8e32ea1c | 930 | { |
56eee37f | 931 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
932 | } |
933 | ||
56eee37f | 934 | inline wxSizerItem* |
8e32ea1c | 935 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
936 | int width, |
937 | int height, | |
938 | int proportion, | |
939 | int flag, | |
940 | int border, | |
941 | wxObject* userData ) | |
8e32ea1c | 942 | { |
56eee37f | 943 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
944 | } |
945 | ||
56eee37f | 946 | inline wxSizerItem* |
5f813ad6 VZ |
947 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) |
948 | { | |
56eee37f | 949 | return Insert( index, new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
950 | } |
951 | ||
56eee37f | 952 | inline wxSizerItem* |
5f813ad6 VZ |
953 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) |
954 | { | |
56eee37f | 955 | return Insert( index, new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
956 | } |
957 | ||
56eee37f | 958 | inline wxSizerItem* |
8e32ea1c VZ |
959 | wxSizer::InsertSpacer(size_t index, int size) |
960 | { | |
56eee37f | 961 | return Insert(index, size, size); |
8e32ea1c VZ |
962 | } |
963 | ||
56eee37f | 964 | inline wxSizerItem* |
8e32ea1c VZ |
965 | wxSizer::InsertStretchSpacer(size_t index, int prop) |
966 | { | |
56eee37f | 967 | return Insert(index, 0, 0, prop); |
8e32ea1c VZ |
968 | } |
969 | ||
adbf2d73 | 970 | |
ade4eb65 | 971 | #endif // __WXSIZER_H__ |
65e4f9b9 | 972 |