Class: Lustr4Wx::Box
- Inherits:
-
Wx::Panel
- Object
- Wx::Panel
- Lustr4Wx::Box
- Includes:
- Lustr::WidgetBase
- Defined in:
- lib/lustr-wx/box.rb
Instance Method Summary collapse
Instance Method Details
#<<(child) ⇒ Object
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 |
# File 'lib/lustr-wx/box.rb', line 38 def <<(child) super axis=nil off_axis=nil if is_vertical? axis=child.option(:height) off_axis=child.option(:width) else axis=child.option(:width) off_axis=child.option(:height) end flags=0 if off_axis=='100%' flags |= Wx::GROW end if option(:align)==:center flags |= (is_vertical? ? Wx::ALIGN_CENTER_HORIZONTAL : Wx::ALIGN_CENTER_VERTICAL) else flags |= (is_vertical? ? Wx::ALIGN_LEFT : Wx::ALIGN_TOP) end get_sizer.add(child.resolve, axis.to_i, flags, 2) end |
#init_options(options) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/lustr-wx/box.rb', line 25 def () super self.label=option(:label) sizerStyle=(option(:direction)==:vertical ? Wx::VERTICAL : Wx::HORIZONTAL) set_sizer(Wx::BoxSizer.new(sizerStyle)) end |
#is_vertical? ⇒ Boolean
34 35 36 |
# File 'lib/lustr-wx/box.rb', line 34 def is_vertical? option(:direction)==:vertical end |