Class: Ektoplayer::Views::Help
- Inherits:
-
UI::Pad
- Object
- UI::Widget
- UI::Pad
- Ektoplayer::Views::Help
- Defined in:
- lib/ektoplayer/views/help.rb
Instance Attribute Summary
Attributes inherited from UI::Pad
Attributes inherited from UI::Widget
Instance Method Summary collapse
Methods inherited from UI::Pad
#bottom, #down, #initialize, #mouse_click, #noutrefresh, #pad_mincol=, #pad_minrow=, #pad_size=, #page_down, #page_up, #refresh, #top, #up, #with_mouse_section_event
Methods inherited from UI::Widget
#display, #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::Pad
Instance Method Details
#draw ⇒ Object
8 9 |
# File 'lib/ektoplayer/views/help.rb', line 8 def draw; end |
#layout ⇒ 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 37 38 39 40 41 42 43 |
# File 'lib/ektoplayer/views/help.rb', line 11 def layout self.pad_size=(UI::Size.new( height: (Bindings.bindings.values.map(&:size).sum + Bindings.bindings.size * 2), width: [@size.width, 90].max )) @win.erase Bindings.bindings.each do |, commands| @win.attrset(Theme[:'help.widget_name']) @win.addstr("\n#{widget}\n") commands.each do |name, keys| next if keys.empty? @win.on_column(3) keys.map { |k| Bindings.keyname(k) }. sort.each_with_index do |key,i| @win << ', ' if i > 0 @win.with_attr(Theme[:'help.key_name']) { @win << key } end @win.attrset(Theme[:'help.command_name']) @win.mvaddstr(@win.cury, 18, name.to_s) @win.attrset(Theme[:'help.command_desc']) @win.mvaddstr(@win.cury, 45, Bindings.commands[name.to_sym]) @win.next_line end end end |