Class: UI::HorizontalContainer

Inherits:
GenericContainer show all
Defined in:
lib/ektoplayer/ui/widgets/container.rb

Instance Attribute Summary

Attributes inherited from GenericContainer

#selected, #selected_index, #widgets

Attributes inherited from Widget

#pos, #size

Instance Method Summary collapse

Methods inherited from GenericContainer

#add, #draw, #initialize, #mouse_click, #on_key_press, #refresh, #remove, #select_next, #select_prev, #visible_widgets, #win

Methods inherited from Widget

#display, #draw, #events, #initialize, #invisible!, #invisible?, #key_press, #keys, #lock, #mouse, #mouse_click, #mouse_event_transform, #mouse_section, #on_key_press, #on_widget_raise, #raise_widget, #refresh, #sub, #unlock, #visible!, #visible=, #visible?, #want_layout, #want_redraw, #want_refresh, #with_lock

Constructor Details

This class inherits a constructor from UI::GenericContainer

Instance Method Details

#layoutObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ektoplayer/ui/widgets/container.rb', line 96

def layout
   xoff = 0
   visible_widgets.each do |widget|
      widget.with_lock do
         fail WidgetSizeError if xoff + widget.size.width > @size.width
         widget.size=(widget.size.update(height: @size.height))
         widget.pos=(@pos.calc(x: xoff))
         fail WidgetSizeError if widget.size.height > @size.height
         xoff += (widget.size.width + (@pad or 0))
      end
   end

   super
end