Class: UI::SwitchContainer

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



130
131
132
133
134
135
136
137
138
139
# File 'lib/ektoplayer/ui/widgets/container.rb', line 130

def layout
   @widgets.each do |widget|
      widget.with_lock do
         widget.size=(@size)
         widget.pos=(@pos)
      end
   end

   super
end

#selected=(widget) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/ektoplayer/ui/widgets/container.rb', line 141

def selected=(widget)
   with_lock do
      (@selected.invisible!) if @selected
      super(widget)
      (@selected.visible!) if @selected
      want_layout
   end
end

#selected_index=(index) ⇒ Object



150
151
152
153
154
155
156
157
# File 'lib/ektoplayer/ui/widgets/container.rb', line 150

def selected_index=(index)
   with_lock do
      (@selected.invisible!) if @selected
      super(index)
      (@selected.visible!) if @selected
      want_layout
   end
end