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

NAME

6       wxLayoutAlgorithm - Functions for wxLayoutAlgorithm class
7

DESCRIPTION

9       wxLayoutAlgorithm implements layout of subwindows in MDI or SDI frames.
10       It sends a wxCalculateLayoutEvent (not  implemented  in  wx)  event  to
11       children  of  the  frame, asking them for information about their size.
12       For MDI parent frames, the algorithm allocates the remaining  space  to
13       the MDI client window (which contains the MDI child frames).
14
15       For  SDI (normal) frames, a 'main' window is specified as taking up the
16       remaining space.
17
18       Because the event system is used, this technique can be applied to  any
19       windows,  which  are  not necessarily 'aware' of the layout classes (no
20       virtual  functions  in  wxWindow  refer  to  wxLayoutAlgorithm  or  its
21       events).  However, you may wish to use wxSashLayoutWindow for your sub‐
22       windows since this class provides handlers for the required events, and
23       accessors to specify the desired size of the window. The sash behaviour
24       in the base class can be used, optionally, to make the windows user-re‐
25       sizable.
26
27       wxLayoutAlgorithm  is typically used in IDE (integrated development en‐
28       vironment) applications, where there are several resizable  windows  in
29       addition to the MDI client window, or other primary editing window. Re‐
30       sizable windows might include toolbars, a project window, and a  window
31       for displaying error and warning messages.
32
33       When  a  window receives an OnCalculateLayout event, it should call Se‐
34       tRect in the given event object, to be the old supplied rectangle minus
35       whatever space the window takes up. It should also set its own size ac‐
36       cordingly. wxSashLayoutWindow::OnCalculateLayout  (not  implemented  in
37       wx)  generates  an  OnQueryLayoutInfo event which it sends to itself to
38       determine the orientation, alignment and size of the window,  which  it
39       gets from internal member variables set by the application.
40
41       The algorithm works by starting off with a rectangle equal to the whole
42       frame client area. It iterates through the frame  children,  generating
43       wxLayoutAlgorithm::OnCalculateLayout  events  which subtract the window
44       size and return the remaining rectangle for the next window to process.
45       It  is  assumed  (by  wxSashLayoutWindow::OnCalculateLayout (not imple‐
46       mented in wx)) that a window stretches the full dimension of the  frame
47       client, according to the orientation it specifies. For example, a hori‐
48       zontal window will stretch the full width of the remaining  portion  of
49       the  frame  client  area.  In the other orientation, the window will be
50       fixed to whatever size was specified by  wxLayoutAlgorithm::OnQueryLay‐
51       outInfo. An alignment setting will make the window 'stick' to the left,
52       top, right or bottom of the remaining client area. This scheme  implies
53       that order of window creation is important. Say you wish to have an ex‐
54       tra toolbar at the top of the frame, a project window to  the  left  of
55       the  MDI  client window, and an output window above the status bar. You
56       should therefore create the windows in this order: toolbar, output win‐
57       dow,  project  window.  This ensures that the toolbar and output window
58       take up space at the top and bottom, and then the remaining height  in-
59       between is used for the project window.
60
61       wxLayoutAlgorithm  is quite independent of the way in which wxLayoutAl‐
62       gorithm::OnCalculateLayout chooses to interpret  a  window's  size  and
63       alignment.  Therefore you could implement a different window class with
64       a new wxLayoutAlgorithm::OnCalculateLayout event handler,  that  has  a
65       more sophisticated way of laying out the windows. It might allow speci‐
66       fication of whether stretching occurs in the specified orientation, for
67       example, rather than always assuming stretching. (This could, and prob‐
68       ably should, be added to the existing implementation).
69
70       Note: wxLayoutAlgorithm has nothing to do with wxLayoutConstraints (not
71       implemented  in wx). It is an alternative way of specifying layouts for
72       which the normal constraint system is unsuitable.
73
74       See: wxSashEvent, wxSashLayoutWindow, Overview events
75
76       wxWidgets docs: wxLayoutAlgorithm
77

DATA TYPES

79       wxLayoutAlgorithm() = wx:wx_object()
80

EXPORTS

82       new() -> wxLayoutAlgorithm()
83
84              Default constructor.
85
86       destroy(This :: wxLayoutAlgorithm()) -> ok
87
88              Destructor.
89
90       layoutFrame(This, Frame) -> boolean()
91
92              Types:
93
94                 This = wxLayoutAlgorithm()
95                 Frame = wxFrame:wxFrame()
96
97       layoutFrame(This, Frame, Options :: [Option]) -> boolean()
98
99              Types:
100
101                 This = wxLayoutAlgorithm()
102                 Frame = wxFrame:wxFrame()
103                 Option = {mainWindow, wxWindow:wxWindow()}
104
105              Lays out the children of a normal frame.
106
107              mainWindow is set to occupy the remaining space.  This  function
108              simply calls layoutWindow/3.
109
110       layoutMDIFrame(This, Frame) -> boolean()
111
112              Types:
113
114                 This = wxLayoutAlgorithm()
115                 Frame = wxMDIParentFrame:wxMDIParentFrame()
116
117       layoutMDIFrame(This, Frame, Options :: [Option]) -> boolean()
118
119              Types:
120
121                 This = wxLayoutAlgorithm()
122                 Frame = wxMDIParentFrame:wxMDIParentFrame()
123                 Option =
124                     {rect,
125                      {X :: integer(),
126                       Y :: integer(),
127                       W :: integer(),
128                       H :: integer()}}
129
130              Lays out the children of an MDI parent frame.
131
132              If  rect  is  non-NULL,  the  given  rectangle will be used as a
133              starting point instead of  the  frame's  client  area.  The  MDI
134              client window is set to occupy the remaining space.
135
136       layoutWindow(This, Parent) -> boolean()
137
138              Types:
139
140                 This = wxLayoutAlgorithm()
141                 Parent = wxWindow:wxWindow()
142
143       layoutWindow(This, Parent, Options :: [Option]) -> boolean()
144
145              Types:
146
147                 This = wxLayoutAlgorithm()
148                 Parent = wxWindow:wxWindow()
149                 Option = {mainWindow, wxWindow:wxWindow()}
150
151              Lays out the children of a normal frame or other window.
152
153              mainWindow  is set to occupy the remaining space. If this is not
154              specified, then the last window that  responds  to  a  calculate
155              layout  event  in  query mode will get the remaining space (that
156              is, a non-query OnCalculateLayout event will not be sent to this
157              window and the window will be set to the remaining size).
158
159
160
161wxWidgets team.                    wx 2.2.2               wxLayoutAlgorithm(3)
Impressum