Class: Wx::Sizer
- Inherits:
-
Object
- Object
- Wx::Sizer
- Defined in:
- lib/wx/classes/sizer.rb
Overview
Class for automatically managing layouts
Constant Summary collapse
- ADD_ITEM_PARAMS =
Generic method to add items, supporting positional and named arguments
[ Wx::Parameter[ :index, -1 ], Wx::Parameter[ :proportion, 0 ], Wx::Parameter[ :flag, 0 ], Wx::Parameter[ :border, 0 ], Wx::Parameter[ :user_data, nil ] ]
Instance Method Summary collapse
Instance Method Details
#add_item(item, *mixed_args) ⇒ Object
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 |
# File 'lib/wx/classes/sizer.rb', line 11 def add_item(item, *mixed_args) args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args) full_args = [] # extract the width and the height in the case of a spacer # defined as an array if item.kind_of?(Array) Kernel.raise ArgumentError, "Invalid Sizer specification : [width, height] expected" if item.size != 2 full_args << item[0] << item[1] else full_args << item end # update the full arguments list with the optional arguments (except index) idx = args.shift full_args.concat(args) # Call add to append if default position if idx == -1 add(*full_args) else insert(idx, *full_args) end end |