1wxSizer(3)                 Erlang Module Definition                 wxSizer(3)
2
3
4

NAME

6       wxSizer - Functions for wxSizer class
7

DESCRIPTION

9       wxSizer  is the abstract base class used for laying out subwindows in a
10       window. You cannot use wxSizer directly; instead, you will have to  use
11       one  of  the  sizer classes derived from it. Currently there are wxBox‐
12       Sizer, wxStaticBoxSizer, wxGridSizer, wxFlexGridSizer, wxWrapSizer (not
13       implemented in wx) and wxGridBagSizer.
14
15       The  layout algorithm used by sizers in wxWidgets is closely related to
16       layout in other GUI toolkits, such as Java's AWT, the  GTK  toolkit  or
17       the  Qt toolkit. It is based upon the idea of the individual subwindows
18       reporting  their  minimal  required  size  and  their  ability  to  get
19       stretched if the size of the parent window has changed.
20
21       This will most often mean that the programmer does not set the original
22       size of a dialog in the beginning, rather the dialog will be assigned a
23       sizer  and  this  sizer will be queried about the recommended size. The
24       sizer in turn will query its children, which  can  be  normal  windows,
25       empty  space or other sizers, so that a hierarchy of sizers can be con‐
26       structed. Note that wxSizer does not derive from wxWindow and thus does
27       not interfere with tab ordering and requires very little resources com‐
28       pared to a real window on screen.
29
30       What makes sizers so well fitted for use in wxWidgets is the fact  that
31       every control reports its own minimal size and the algorithm can handle
32       differences in font sizes or different window (dialog  item)  sizes  on
33       different platforms without problems. If e.g. the standard font as well
34       as the overall design of Motif widgets requires more space than on Win‐
35       dows,  the  initial  dialog  size will automatically be bigger on Motif
36       than on Windows.
37
38       Sizers may also be used to control the layout of custom drawn items  on
39       the  window.  The  add/4,  insert/5,  and  prepend/4 functions return a
40       pointer to the newly added wxSizerItem. Just add empty space of the de‐
41       sired  size  and  attributes,  and  then  use the wxSizerItem:getRect/1
42       method to determine where the drawing operations should take place.
43
44       Please notice that sizers, like child windows, are owned by the library
45       and  will be deleted by it which implies that they must be allocated on
46       the heap. However if you create a sizer and do not add  it  to  another
47       sizer  or window, the library wouldn't be able to delete such an orphan
48       sizer and in this, and only this, case it should be deleted explicitly.
49
50       wxSizer flags
51
52       The "flag" argument accepted  by  wxSizerItem  constructors  and  other
53       functions, e.g. add/4, is an OR-combination of the following flags. Two
54       main behaviours are defined using these flags. One is the border around
55       a  window: the border parameter determines the border width whereas the
56       flags given here determine which side(s) of the item  that  the  border
57       will  be  added.  The  other flags determine how the sizer item behaves
58       when the space allotted to the sizer changes, and is somewhat dependent
59       on the specific kind of sizer used.
60
61       See: Overview sizer
62
63       wxWidgets docs: wxSizer
64

DATA TYPES

66       wxSizer() = wx:wx_object()
67

EXPORTS

69       add(This, Window) -> wxSizerItem:wxSizerItem()
70
71              Types:
72
73                 This = wxSizer()
74                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
75
76       add(This, Width, Height) -> wxSizerItem:wxSizerItem()
77
78       add(This, Window, Flags) -> wxSizerItem:wxSizerItem()
79
80       add(This, Window, Height :: [Option]) -> wxSizerItem:wxSizerItem()
81
82              Types:
83
84                 This = wxSizer()
85                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
86                 Option =
87                     {proportion, integer()} |
88                     {flag, integer()} |
89                     {border, integer()} |
90                     {userData, wx:wx_object()}
91
92              Appends a child to the sizer.
93
94              wxSizer  itself  is  an  abstract  class, but the parameters are
95              equivalent in the derived classes that you will  instantiate  to
96              use it so they are described here:
97
98       add(This, Width, Height, Options :: [Option]) ->
99              wxSizerItem:wxSizerItem()
100
101       add(This, Width, Height, Flags) -> wxSizerItem:wxSizerItem()
102
103              Types:
104
105                 This = wxSizer()
106                 Width = Height = integer()
107                 Flags = wxSizerFlags:wxSizerFlags()
108
109              Appends a spacer child to the sizer.
110
111       addSpacer(This, Size) -> wxSizerItem:wxSizerItem()
112
113              Types:
114
115                 This = wxSizer()
116                 Size = integer()
117
118              This  base function adds non-stretchable space to both the hori‐
119              zontal and vertical orientation of the sizer.
120
121              More readable way of calling:
122
123              See: addSpacer/2
124
125       addStretchSpacer(This) -> wxSizerItem:wxSizerItem()
126
127              Types:
128
129                 This = wxSizer()
130
131       addStretchSpacer(This, Options :: [Option]) ->
132                           wxSizerItem:wxSizerItem()
133
134              Types:
135
136                 This = wxSizer()
137                 Option = {prop, integer()}
138
139              Adds stretchable space to the sizer.
140
141              More readable way of calling:
142
143       calcMin(This) -> {W :: integer(), H :: integer()}
144
145              Types:
146
147                 This = wxSizer()
148
149              This method is abstract and has to be overwritten by any derived
150              class.
151
152              Here, the sizer will do the actual calculation of its children's
153              minimal sizes.
154
155       clear(This) -> ok
156
157              Types:
158
159                 This = wxSizer()
160
161       clear(This, Options :: [Option]) -> ok
162
163              Types:
164
165                 This = wxSizer()
166                 Option = {delete_windows, boolean()}
167
168              Detaches all children from the sizer.
169
170              If delete_windows is  true  then  child  windows  will  also  be
171              deleted.
172
173              Notice that child sizers are always deleted, as a general conse‐
174              quence of the principle that sizers own  their  sizer  children,
175              but  don't  own  their window children (because they are already
176              owned by their parent windows).
177
178       detach(This, Window) -> boolean()
179
180       detach(This, Index) -> boolean()
181
182              Types:
183
184                 This = wxSizer()
185                 Index = integer()
186
187              Detach a item at position index from the sizer without  destroy‐
188              ing it.
189
190              This method does not cause any layout or resizing to take place,
191              call layout/1 to update the layout "on screen" after detaching a
192              child  from  the sizer. Returns true if the child item was found
193              and detached, false otherwise.
194
195              See: remove/2
196
197       fit(This, Window) -> {W :: integer(), H :: integer()}
198
199              Types:
200
201                 This = wxSizer()
202                 Window = wxWindow:wxWindow()
203
204              Tell the sizer to resize the window  so  that  its  client  area
205              matches  the  sizer's  minimal  size (ComputeFittingClientSize()
206              (not implemented in wx) is called to determine it).
207
208              This is commonly done in the constructor of the  window  itself,
209              see sample in the description of wxBoxSizer.
210
211              Return: The new window size.
212
213              See: ComputeFittingClientSize() (not implemented in wx), Comput‐
214              eFittingWindowSize() (not implemented in wx)
215
216       setVirtualSizeHints(This, Window) -> ok
217
218              Types:
219
220                 This = wxSizer()
221                 Window = wxWindow:wxWindow()
222
223              See: fitInside/2.
224
225       fitInside(This, Window) -> ok
226
227              Types:
228
229                 This = wxSizer()
230                 Window = wxWindow:wxWindow()
231
232              Tell the sizer to resize the virtual size of the window to match
233              the sizer's minimal size.
234
235              This  will  not  alter the on screen size of the window, but may
236              cause the addition/removal/alteration of scrollbars required  to
237              view the virtual area in windows which manage it.
238
239              See: wxScrolledWindow:setScrollbars/6, setVirtualSizeHints/2
240
241       getChildren(This) -> [wxSizerItem:wxSizerItem()]
242
243              Types:
244
245                 This = wxSizer()
246
247       getItem(This, Window) -> wxSizerItem:wxSizerItem()
248
249       getItem(This, Index) -> wxSizerItem:wxSizerItem()
250
251              Types:
252
253                 This = wxSizer()
254                 Index = integer()
255
256              Finds  wxSizerItem which is located in the sizer at position in‐
257              dex.
258
259              Use parameter recursive to  search  in  subsizers  too.  Returns
260              pointer to item or NULL.
261
262       getItem(This, Window, Options :: [Option]) ->
263                  wxSizerItem:wxSizerItem()
264
265              Types:
266
267                 This = wxSizer()
268                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
269                 Option = {recursive, boolean()}
270
271              Finds wxSizerItem which holds the given window.
272
273              Use  parameter  recursive  to  search  in subsizers too. Returns
274              pointer to item or NULL.
275
276       getSize(This) -> {W :: integer(), H :: integer()}
277
278              Types:
279
280                 This = wxSizer()
281
282              Returns the current size of the sizer.
283
284       getPosition(This) -> {X :: integer(), Y :: integer()}
285
286              Types:
287
288                 This = wxSizer()
289
290              Returns the current position of the sizer.
291
292       getMinSize(This) -> {W :: integer(), H :: integer()}
293
294              Types:
295
296                 This = wxSizer()
297
298              Returns the minimal size of the sizer.
299
300              This is either the combined minimal size of all the children and
301              their borders or the minimal size set by setMinSize/3, depending
302              on which is bigger. Note that the returned value is client size,
303              not  window  size.  In  particular,  if you use the value to set
304              toplevel window's minimal or actual size, use  wxWindow::SetMin‐
305              ClientSize()  (not  implemented  in  wx)  or wxWindow:setClient‐
306              Size/3, not wxWindow:setMinSize/2 or wxWindow:setSize/6.
307
308       hide(This, Window) -> boolean()
309
310       hide(This, Index) -> boolean()
311
312              Types:
313
314                 This = wxSizer()
315                 Index = integer()
316
317              Hides the item at position index.
318
319              To make a sizer item disappear, use hide/3 followed by layout/1.
320
321              Use parameter recursive to hide elements found in subsizers. Re‐
322              turns true if the child item was found, false otherwise.
323
324              See: isShown/2, show/3
325
326       hide(This, Window, Options :: [Option]) -> boolean()
327
328              Types:
329
330                 This = wxSizer()
331                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
332                 Option = {recursive, boolean()}
333
334              Hides the child window.
335
336              To make a sizer item disappear, use hide/3 followed by layout/1.
337
338              Use parameter recursive to hide elements found in subsizers. Re‐
339              turns true if the child item was found, false otherwise.
340
341              See: isShown/2, show/3
342
343       insert(This, Index, Item) -> wxSizerItem:wxSizerItem()
344
345              Types:
346
347                 This = wxSizer()
348                 Index = integer()
349                 Item = wxSizerItem:wxSizerItem()
350
351       insert(This, Index, Width, Height) -> wxSizerItem:wxSizerItem()
352
353       insert(This, Index, Window, Flags) -> wxSizerItem:wxSizerItem()
354
355       insert(This, Index, Window, Height :: [Option]) ->
356                 wxSizerItem:wxSizerItem()
357
358              Types:
359
360                 This = wxSizer()
361                 Index = integer()
362                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
363                 Option =
364                     {proportion, integer()} |
365                     {flag, integer()} |
366                     {border, integer()} |
367                     {userData, wx:wx_object()}
368
369              Insert a child into the sizer before any existing item at index.
370
371              See add/4 for the meaning of the other parameters.
372
373       insert(This, Index, Width, Height, Options :: [Option]) ->
374                 wxSizerItem:wxSizerItem()
375
376       insert(This, Index, Width, Height, Flags) ->
377                 wxSizerItem:wxSizerItem()
378
379              Types:
380
381                 This = wxSizer()
382                 Index = Width = Height = integer()
383                 Flags = wxSizerFlags:wxSizerFlags()
384
385              Insert a child into the sizer before any existing item at index.
386
387              See add/4 for the meaning of the other parameters.
388
389       insertSpacer(This, Index, Size) -> wxSizerItem:wxSizerItem()
390
391              Types:
392
393                 This = wxSizer()
394                 Index = Size = integer()
395
396              Inserts non-stretchable space to the sizer.
397
398              More readable way of calling wxSizer::Insert(index, size, size).
399
400       insertStretchSpacer(This, Index) -> wxSizerItem:wxSizerItem()
401
402              Types:
403
404                 This = wxSizer()
405                 Index = integer()
406
407       insertStretchSpacer(This, Index, Options :: [Option]) ->
408                              wxSizerItem:wxSizerItem()
409
410              Types:
411
412                 This = wxSizer()
413                 Index = integer()
414                 Option = {prop, integer()}
415
416              Inserts stretchable space to the sizer.
417
418              More readable way of calling wxSizer::Insert(0, 0, prop).
419
420       isShown(This, Window) -> boolean()
421
422       isShown(This, Index) -> boolean()
423
424              Types:
425
426                 This = wxSizer()
427                 Index = integer()
428
429              Returns true if the item at index is shown.
430
431              See: hide/3, show/3, wxSizerItem:isShown/1
432
433       recalcSizes(This) -> ok
434
435              Types:
436
437                 This = wxSizer()
438
439              See: layout/1.
440
441       layout(This) -> ok
442
443              Types:
444
445                 This = wxSizer()
446
447              Call this to force layout of the children anew, e.g. after  hav‐
448              ing  added a child to or removed a child (window, other sizer or
449              space) from the sizer while keeping the current dimension.
450
451       prepend(This, Item) -> wxSizerItem:wxSizerItem()
452
453              Types:
454
455                 This = wxSizer()
456                 Item = wxSizerItem:wxSizerItem()
457
458       prepend(This, Width, Height) -> wxSizerItem:wxSizerItem()
459
460       prepend(This, Window, Flags) -> wxSizerItem:wxSizerItem()
461
462       prepend(This, Window, Height :: [Option]) ->
463                  wxSizerItem:wxSizerItem()
464
465              Types:
466
467                 This = wxSizer()
468                 Window = wxWindow:wxWindow() | wxSizer:wxSizer()
469                 Option =
470                     {proportion, integer()} |
471                     {flag, integer()} |
472                     {border, integer()} |
473                     {userData, wx:wx_object()}
474
475              Same as add/4, but prepends the items to the  beginning  of  the
476              list  of  items  (windows,  subsizers  or  spaces) owned by this
477              sizer.
478
479       prepend(This, Width, Height, Options :: [Option]) ->
480                  wxSizerItem:wxSizerItem()
481
482       prepend(This, Width, Height, Flags) -> wxSizerItem:wxSizerItem()
483
484              Types:
485
486                 This = wxSizer()
487                 Width = Height = integer()
488                 Flags = wxSizerFlags:wxSizerFlags()
489
490              Same as add/4, but prepends the items to the  beginning  of  the
491              list  of  items  (windows,  subsizers  or  spaces) owned by this
492              sizer.
493
494       prependSpacer(This, Size) -> wxSizerItem:wxSizerItem()
495
496              Types:
497
498                 This = wxSizer()
499                 Size = integer()
500
501              Prepends non-stretchable space to the sizer.
502
503              More readable way of calling wxSizer::Prepend(size, size, 0).
504
505       prependStretchSpacer(This) -> wxSizerItem:wxSizerItem()
506
507              Types:
508
509                 This = wxSizer()
510
511       prependStretchSpacer(This, Options :: [Option]) ->
512                               wxSizerItem:wxSizerItem()
513
514              Types:
515
516                 This = wxSizer()
517                 Option = {prop, integer()}
518
519              Prepends stretchable space to the sizer.
520
521              More readable way of calling wxSizer::Prepend(0, 0, prop).
522
523       remove(This, Index) -> boolean()
524
525       remove(This, Sizer) -> boolean()
526
527              Types:
528
529                 This = Sizer = wxSizer()
530
531              Removes a sizer child from the sizer and destroys it.
532
533              Note: This method does not cause any layout or resizing to  take
534              place,  call layout/1 to update the layout "on screen" after re‐
535              moving a child from the sizer.
536
537              Return: true if the child item was found and removed, false oth‐
538              erwise.
539
540       replace(This, Oldwin, Newwin) -> boolean()
541
542       replace(This, Index, Newitem) -> boolean()
543
544              Types:
545
546                 This = wxSizer()
547                 Index = integer()
548                 Newitem = wxSizerItem:wxSizerItem()
549
550              Detaches the given item at position index from the sizer and re‐
551              places it with the given wxSizerItem newitem.
552
553              The detached child is deleted only if it is a sizer or a  spacer
554              (but  not if it is a wxWindow because windows are owned by their
555              parent window, not the sizer).
556
557              This method does not cause any layout or resizing to take place,
558              call layout/1 to update the layout "on screen" after replacing a
559              child from the sizer.
560
561              Returns true if the child item was found and removed, false oth‐
562              erwise.
563
564       replace(This, Oldwin, Newwin, Options :: [Option]) -> boolean()
565
566              Types:
567
568                 This = wxSizer()
569                 Oldwin = Newwin = wxWindow:wxWindow() | wxSizer:wxSizer()
570                 Option = {recursive, boolean()}
571
572              Detaches  the  given  oldwin from the sizer and replaces it with
573              the given newwin.
574
575              The detached child window is not deleted  (because  windows  are
576              owned by their parent window, not the sizer).
577
578              Use  parameter recursive to search the given element recursively
579              in subsizers.
580
581              This method does not cause any layout or resizing to take place,
582              call layout/1 to update the layout "on screen" after replacing a
583              child from the sizer.
584
585              Returns true if the child item was found and removed, false oth‐
586              erwise.
587
588       setDimension(This, Pos, Size) -> ok
589
590              Types:
591
592                 This = wxSizer()
593                 Pos = {X :: integer(), Y :: integer()}
594                 Size = {W :: integer(), H :: integer()}
595
596              This is an overloaded member function, provided for convenience.
597              It differs from the above function only in what  argument(s)  it
598              accepts.
599
600       setDimension(This, X, Y, Width, Height) -> ok
601
602              Types:
603
604                 This = wxSizer()
605                 X = Y = Width = Height = integer()
606
607              Call  this  to  force  the sizer to take the given dimension and
608              thus force the items owned by the sizer to resize themselves ac‐
609              cording  to  the rules defined by the parameter in the add/4 and
610              prepend/4 methods.
611
612       setMinSize(This, Size) -> ok
613
614              Types:
615
616                 This = wxSizer()
617                 Size = {W :: integer(), H :: integer()}
618
619              Call this to give the sizer a minimal size.
620
621              Normally, the sizer will calculate its minimal size based purely
622              on  how  much space its children need. After calling this method
623              getMinSize/1 will return either the minimal size as requested by
624              its children or the minimal size set here, depending on which is
625              bigger.
626
627       setMinSize(This, Width, Height) -> ok
628
629              Types:
630
631                 This = wxSizer()
632                 Width = Height = integer()
633
634              This is an overloaded member function, provided for convenience.
635              It  differs  from the above function only in what argument(s) it
636              accepts.
637
638       setItemMinSize(This, Window, Size) -> boolean()
639
640       setItemMinSize(This, Index, Size) -> boolean()
641
642              Types:
643
644                 This = wxSizer()
645                 Index = integer()
646                 Size = {W :: integer(), H :: integer()}
647
648       setItemMinSize(This, Window, Width, Height) -> boolean()
649
650       setItemMinSize(This, Index, Width, Height) -> boolean()
651
652              Types:
653
654                 This = wxSizer()
655                 Index = Width = Height = integer()
656
657       setSizeHints(This, Window) -> ok
658
659              Types:
660
661                 This = wxSizer()
662                 Window = wxWindow:wxWindow()
663
664              This method first calls fit/2 and  then  setSizeHints/2  on  the
665              window passed to it.
666
667              This only makes sense when window is actually a wxTopLevelWindow
668              such as a wxFrame or a wxDialog, since SetSizeHints only has any
669              effect  in  these  classes. It does nothing in normal windows or
670              controls.
671
672              This method  is  implicitly  used  by  wxWindow:setSizerAndFit/3
673              which  is commonly invoked in the constructor of a toplevel win‐
674              dow itself (see the sample in the description of wxBoxSizer)  if
675              the toplevel window is resizable.
676
677       show(This, Window) -> boolean()
678
679       show(This, Index) -> boolean()
680
681       show(This, Show) -> ok
682
683              Types:
684
685                 This = wxSizer()
686                 Show = boolean()
687
688       show(This, Window, Options :: [Option]) -> boolean()
689
690       show(This, Index, Options :: [Option]) -> boolean()
691
692              Types:
693
694                 This = wxSizer()
695                 Index = integer()
696                 Option = {show, boolean()}
697
698              Shows the item at index.
699
700              To  make a sizer item disappear or reappear, use show/3 followed
701              by layout/1.
702
703              Returns true if the child item was found, false otherwise.
704
705              See: hide/3, isShown/2
706
707       showItems(This, Show) -> ok
708
709              Types:
710
711                 This = wxSizer()
712                 Show = boolean()
713
714              Show or hide all items managed by the sizer.
715
716
717
718wxWidgets team.                     wx 2.1                          wxSizer(3)
Impressum