Module: WxSugar::Arranger
- Defined in:
- lib/reactive-wx/wx_ext/arranger.rb
Overview
:nodoc: all
Instance Method Summary collapse
-
#arrange_formgrid(layout, &block) ⇒ Object
takes hash arguments
layout
. - #hints_to_constants_with_formgrid(layout_hints) ⇒ Object
Instance Method Details
#arrange_formgrid(layout, &block) ⇒ Object
takes hash arguments layout
:rows - integer, number of rows (mandatory, see below)
:cols - integer, number of columns (mandatory, see below)
:vgap - integer, extra vertical space between each child (optional)
:hgap - integer, extra horizontal space between each child (optional)
At least one of :rows
and :cols
must be specified. If one is not specified, the other will be calculated dynamically based on the total number of child widgets added.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/reactive-wx/wx_ext/arranger.rb', line 15 def arrange_formgrid(layout, &block) Kernel.raise ArgumentError, "Pass eihter :cols or :rows, not both!" if layout[:cols] && layout[:rows] # if layout[:padding] # layout[:vgap] = layout[:hgap] = layout[:padding] # end # wxruby wants them in this order, and with nought if null args = [ :vgap, :hgap ].map { | arg | layout[arg] or 0 } sizer = WxExtensions::FormGridSizer.new(layout[:rows], layout[:cols], *args) arrange( sizer, layout, &block ) end |
#hints_to_constants_with_formgrid(layout_hints) ⇒ Object
27 28 29 |
# File 'lib/reactive-wx/wx_ext/arranger.rb', line 27 def hints_to_constants_with_formgrid(layout_hints) hints_to_constants_without_formgrid(layout_hints) + (layout_hints[:span] ? 0x10000000 : 0) end |