wxErlang

wxGridSizer.erl

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
%        /¯_ |¯\  | |¯\  (`  | '¯/ |_¯ |¯\     
%\   W X \_/ |¯\  | |_/ \_)  |  /_,|__ |¯\ . E R L   
%%——————————————————————————————————————————————————————————
%%
%%   Copyright Ericsson AB 2008-2013. All Rights Reserved.
%%
%%——————————————————————————————————————————————
%% Whitespace Beautified by ScriptCulture © 2018
%% Sit Back · Feet Up · Learn wxErlang
%% For use as a reference only
%% www.scriptculture.com
%% Not check-summed 
%% wx 1.8 —————————————————————————————————————— 
%%
%% Licensed under the Apache License, 
%% Version 2.0 (the "License"); you may 
%% not use this file except in compliance 
%% with the License. You may obtain a copy 
%% of the License at:
%%
%%     http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by 
%% applicable law or agreed to in writing, software
%% distributed under the License is distributed 
%% on an "AS IS" BASIS, WITHOUT WARRANTIES 
%% OR CONDITIONS OF ANY KIND, either 
%% express or implied. See the 
%% License for the specific 
%% language governing 
%% permissions and
%% limitations 
%% under the 
%% License.
%%%%%%%
%%%%
%%%%%
%% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxgridsizer.html">wxGridSizer</a>.
%% <p>This class is derived (and can use functions) from:
%% <br />{@link wxSizer}
%% </p>
%% @type wxGridSizer().  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%   
%%   OVERVIEW
%%   ––––––––
%%   A grid sizer is a sizer which lays out its children in a two-dimensional 
%%   table with all table fields having the same size, 
%%   i.e. the width of each field is the width of the widest child, 
%%   the height of each field is the height of the tallest child.
%%   
%%   
%%   See Also:
%%   —————————
%%   wxSizer
%%   
%%   
-module(wxGridSizer).
-include("wxe.hrl").
-export([destroy/1,getCols/1,getHGap/1,getRows/1
        ,getVGap/1,new/1,new/2,new/4,setCols/2,
         setHGap/2,setRows/2,setVGap/2]).

%% inherited exports
-export([add/2,add/3,add/4,addSpacer/2,addStretchSpacer/1,addStretchSpacer/2,
  calcMin/1,clear/1,clear/2,detach/2,fit/2,fitInside/2,getChildren/1,getItem/2,
  getItem/3,getMinSize/1,getPosition/1,getSize/1,hide/2,hide/3,insert/3,
  insert/4,insert/5,insertSpacer/3,insertStretchSpacer/2,insertStretchSpacer/3,
  isShown/2,layout/1,parent_class/1,prepend/2,prepend/3,prepend/4,prependSpacer/2,
  prependStretchSpacer/1,prependStretchSpacer/2,recalcSizes/1,remove/2,
  replace/3,replace/4,setDimension/5,setItemMinSize/3,setItemMinSize/4,
  setMinSize/2,setMinSize/3,setSizeHints/2,setVirtualSizeHints/2,show/2,
  show/3]).

-export_type([wxGridSizer/0]).


%% @hidden
parent_class(wxSizer) -> true;
parent_class(_Class) -> erlang:error({badtype, ?MODULE}).


-type wxGridSizer()  ::  wx:wx_object().




%% @equiv new(Cols, [])
          -spec new(Cols)   -> wxGridSizer()
           when
           Cols :: integer().

new(Cols)
           when 
           is_integer(Cols) ->  new(Cols, []).





           %·%% NEW / 2 %%·%

%%   
%%   Constructor for a wxGridSizer. rows and cols determine the number of columns and rows in the sizer - if either of the parameters is zero, it will be calculated to form the total number of children in the sizer, thus making the sizer grow dynamically. vgap and hgap define extra space between all children.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec new(Cols, [Option]) -> wxGridSizer()
           when
           Cols    ::        integer(),
           Option  :: {vgap, integer()}
                    | {hgap, integer()}.
new(Cols, Options)
           when 
           is_integer(Cols),
           is_list(Options) ->
                   MOpts = fun({vgap, Vgap}, Acc) -> [<<1:32/?UI,Vgap:32/?UI>>|Acc];
                              ({hgap, Hgap}, Acc) -> [<<2:32/?UI,Hgap:32/?UI>>|Acc];
                                      (BadOpt, _) -> erlang:error({badoption, BadOpt})
            end,
                   BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)),
                                        wxe_util:construct(?wxGridSizer_new_2,
                                        <<Cols:32/?UI, 0:32,BinOpt/binary>>).





           %·%% NEW / 4 %%·%

%%   
%%  See above... 
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec new(Rows, Cols, Vgap, Hgap) -> wxGridSizer()
           when
           Rows :: integer(), 
           Cols :: integer(), 
           Vgap :: integer(), 
           Hgap :: integer().

new(Rows, Cols, Vgap, Hgap)
           when 
           is_integer(Rows),
           is_integer(Cols),
           is_integer(Vgap),
           is_integer(Hgap) ->
          wxe_util:construct(?wxGridSizer_new_4,
          <<Rows:32/?UI,Cols:32/?UI,Vgap:32/?UI,Hgap:32/?UI>>).





           %·%% GET COLS %%·%

%%   
%%    Returns the number of columns in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec getCols(This) -> integer()
           when
           This :: wxGridSizer().

getCols(#wx_ref{type=ThisT,ref=ThisRef}) ->
                                          ?CLASS(ThisT,wxGridSizer),
                            wxe_util:call(?wxGridSizer_GetCols,
                            <<ThisRef:32/?UI>>).





           %·%% GET H GAP %%·%

%%   
%%   Returns the horizontal gap (in pixels) between cells in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec getHGap(This) -> integer()
           when
           This :: wxGridSizer().

getHGap(#wx_ref{type=ThisT,ref=ThisRef}) ->
                                          ?CLASS(ThisT,wxGridSizer),
                            wxe_util:call(?wxGridSizer_GetHGap,
                            <<ThisRef:32/?UI>>).





           %·%% GET ROWS %%·%

%%   
%%   Returns the number of rows in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec getRows(This) -> integer()
           when
           This :: wxGridSizer().

getRows(#wx_ref{type=ThisT,ref=ThisRef}) ->
                                          ?CLASS(ThisT,wxGridSizer),
                            wxe_util:call(?wxGridSizer_GetRows,
                            <<ThisRef:32/?UI>>).





           %·%% GET V GAP %%·%

%%   
%%   Returns the vertical gap (in pixels) between the cells in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec getVGap(This) -> integer()
           when
           This :: wxGridSizer().

getVGap(#wx_ref{type=ThisT,ref=ThisRef}) ->
                                          ?CLASS(ThisT,wxGridSizer),
                            wxe_util:call(?wxGridSizer_GetVGap,
                            <<ThisRef:32/?UI>>).





           %·%% SET COLS %%·%

%%   
%%   Sets the number of columns in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec setCols(This, Cols) -> ok
           when
           This :: wxGridSizer(), 
           Cols ::     integer().

setCols(#wx_ref{type=ThisT,ref=ThisRef}, Cols)
           when 
           is_integer(Cols) ->
                             ?CLASS(ThisT,wxGridSizer),
               wxe_util:cast(?wxGridSizer_SetCols,
               <<ThisRef:32/?UI,Cols:32/?UI>>).





           %·%% SET H GAP %%·%

%%   
%%   Sets the horizontal gap (in pixels) between cells in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec setHGap(This, Gap) -> ok
           when
           This :: wxGridSizer(), 
           Gap  ::     integer().

setHGap(#wx_ref{type=ThisT,ref=ThisRef}, Gap)
           when 
           is_integer(Gap) ->
                            ?CLASS(ThisT,wxGridSizer),
              wxe_util:cast(?wxGridSizer_SetHGap,
              <<ThisRef:32/?UI,Gap:32/?UI>>).





           %·%% SET ROWS %%·%

%%   
%%    Sets the number of rows in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec setRows(This, Rows) -> ok
           when
           This :: wxGridSizer(), 
           Rows ::     integer().

setRows(#wx_ref{type=ThisT,ref=ThisRef}, Rows)
           when 
           is_integer(Rows) ->
                             ?CLASS(ThisT,wxGridSizer),
               wxe_util:cast(?wxGridSizer_SetRows,
               <<ThisRef:32/?UI,Rows:32/?UI>>).





           %·%% SET V GAP %%·%

%%   
%%   Sets the vertical gap (in pixels) between the cells in the sizer.
%%   
%% Return Value:
%% See Also:
%%*%%*%%
          -spec setVGap(This, Gap) -> ok
           when
           This :: wxGridSizer(), 
           Gap  ::     integer().

setVGap(#wx_ref{type=ThisT,ref=ThisRef}, Gap)
           when 
           is_integer(Gap) ->
                            ?CLASS(ThisT,wxGridSizer),
              wxe_util:cast(?wxGridSizer_SetVGap,
              <<ThisRef:32/?UI,Gap:32/?UI>>).





           %·%% DESTROY %%·%

%%   
%%   Destroys this object, do not use object again
%%   
%% @doc Destroys this object, do not use object again
          -spec destroy(This :: wxGridSizer()) -> ok.

destroy(Obj=#wx_ref{type=Type}) ->
                                 ?CLASS(Type,wxGridSizer),
                wxe_util:destroy(?DESTROY_OBJECT,Obj),
                ok.
               



%% From wxSizer




%% @hidden
show(This,Index, Options) -> wxSizer:show(This,Index, Options).
%% @hidden
show(This,Index) -> wxSizer:show(This,Index).
%% @hidden
setVirtualSizeHints(This,Window) -> wxSizer:setVirtualSizeHints(This,Window).
%% @hidden
setSizeHints(This,Window) -> wxSizer:setSizeHints(This,Window).
%% @hidden
setItemMinSize(This,Index,Width,Height) -> wxSizer:setItemMinSize(This,Index,Width,Height).
%% @hidden
setItemMinSize(This,Index,Size) -> wxSizer:setItemMinSize(This,Index,Size).
%% @hidden
setMinSize(This,Width,Height) -> wxSizer:setMinSize(This,Width,Height).
%% @hidden
setMinSize(This,Size) -> wxSizer:setMinSize(This,Size).
%% @hidden
setDimension(This,X,Y,Width,Height) -> wxSizer:setDimension(This,X,Y,Width,Height).
%% @hidden
replace(This,Oldwin,Newwin, Options) -> wxSizer:replace(This,Oldwin,Newwin, Options).
%% @hidden
replace(This,Oldwin,Newwin) -> wxSizer:replace(This,Oldwin,Newwin).
%% @hidden
remove(This,Index) -> wxSizer:remove(This,Index).
%% @hidden
recalcSizes(This) -> wxSizer:recalcSizes(This).
%% @hidden
prependStretchSpacer(This, Options) -> wxSizer:prependStretchSpacer(This, Options).
%% @hidden
prependStretchSpacer(This) -> wxSizer:prependStretchSpacer(This).
%% @hidden
prependSpacer(This,Size) -> wxSizer:prependSpacer(This,Size).
%% @hidden
prepend(This,Width,Height, Options) -> wxSizer:prepend(This,Width,Height, Options).
%% @hidden
prepend(This,Width,Height) -> wxSizer:prepend(This,Width,Height).
%% @hidden
prepend(This,Item) -> wxSizer:prepend(This,Item).
%% @hidden
layout(This) -> wxSizer:layout(This).
%% @hidden
isShown(This,Index) -> wxSizer:isShown(This,Index).
%% @hidden
insertStretchSpacer(This,Index, Options) -> wxSizer:insertStretchSpacer(This,Index, Options).
%% @hidden
insertStretchSpacer(This,Index) -> wxSizer:insertStretchSpacer(This,Index).
%% @hidden
insertSpacer(This,Index,Size) -> wxSizer:insertSpacer(This,Index,Size).
%% @hidden
insert(This,Index,Width,Height, Options) -> wxSizer:insert(This,Index,Width,Height, Options).
%% @hidden
insert(This,Index,Width,Height) -> wxSizer:insert(This,Index,Width,Height).
%% @hidden
insert(This,Index,Item) -> wxSizer:insert(This,Index,Item).
%% @hidden
hide(This,Window, Options) -> wxSizer:hide(This,Window, Options).
%% @hidden
hide(This,Window) -> wxSizer:hide(This,Window).
%% @hidden
getMinSize(This) -> wxSizer:getMinSize(This).
%% @hidden
getPosition(This) -> wxSizer:getPosition(This).
%% @hidden
getSize(This) -> wxSizer:getSize(This).
%% @hidden
getItem(This,Window, Options) -> wxSizer:getItem(This,Window, Options).
%% @hidden
getItem(This,Window) -> wxSizer:getItem(This,Window).
%% @hidden
getChildren(This) -> wxSizer:getChildren(This).
%% @hidden
fitInside(This,Window) -> wxSizer:fitInside(This,Window).
%% @hidden
fit(This,Window) -> wxSizer:fit(This,Window).
%% @hidden
detach(This,Index) -> wxSizer:detach(This,Index).
%% @hidden
clear(This, Options) -> wxSizer:clear(This, Options).
%% @hidden
clear(This) -> wxSizer:clear(This).
%% @hidden
calcMin(This) -> wxSizer:calcMin(This).
%% @hidden
addStretchSpacer(This, Options) -> wxSizer:addStretchSpacer(This, Options).
%% @hidden
addStretchSpacer(This) -> wxSizer:addStretchSpacer(This).
%% @hidden
addSpacer(This,Size) -> wxSizer:addSpacer(This,Size).
%% @hidden
add(This,Width,Height, Options) -> wxSizer:add(This,Width,Height, Options).
%% @hidden
add(This,Width,Height) -> wxSizer:add(This,Width,Height).
%% @hidden
add(This,Window) -> wxSizer:add(This,Window).