Class: Ektoplayer::Views::Browser

Inherits:
UI::ListWidget show all
Defined in:
lib/ektoplayer/views/browser.rb

Instance Attribute Summary

Attributes inherited from UI::ListWidget

#cursor, #item_renderer, #list, #selected, #selection

Attributes inherited from UI::Window

#win

Attributes inherited from UI::Widget

#pos, #size

Instance Method Summary collapse

Methods inherited from UI::ListWidget

#bottom, #center, #down, #draw, #force_cursorpos, #get_selection, #layout, #on_mouse_click, #page_down, #page_up, #render, #scroll_cursor_down, #scroll_cursor_up, #scroll_list_down, #scroll_list_up, #search_down, #search_next, #search_prev, #search_start, #search_up, #select_from_cursorpos, #toggle_selection, #top, #up

Methods inherited from UI::Window

#layout, #noutrefresh, #refresh

Methods inherited from UI::Widget

#display, #draw, #events, #invisible!, #invisible?, #key_press, #keys, #layout, #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

#initialize(**opts) ⇒ Browser

Returns a new instance of Browser.



7
8
9
10
11
12
13
14
15
16
# File 'lib/ektoplayer/views/browser.rb', line 7

def initialize(**opts)
   super(**opts)
   if ICurses.colors == 256
      f = Config[:'playlist.format_256']
   else
      f = Config[:'playlist.format']
   end

   self.item_renderer=(TrackRenderer.new(width: @size.width, format: f))
end

Instance Method Details

#attach(browser) ⇒ Object



18
19
20
21
22
# File 'lib/ektoplayer/views/browser.rb', line 18

def attach(browser)
   @browser = browser
   browser.events.on(:changed, &self.method(:reload))
   reload
end