Class: Ektoplayer::Views::MainWindow

Inherits:
UI::VerticalContainer show all
Defined in:
lib/ektoplayer/views/mainwindow.rb

Instance Attribute Summary collapse

Attributes inherited from UI::GenericContainer

#selected, #selected_index, #widgets

Attributes inherited from UI::Widget

#pos, #size

Instance Method Summary collapse

Methods inherited from UI::GenericContainer

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

Methods inherited from UI::Widget

#display, #draw, #events, #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

#initialize(**opts) ⇒ MainWindow

Returns a new instance of MainWindow.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ektoplayer/views/mainwindow.rb', line 11

def initialize(**opts)
   super(**opts)

   @playinginfo  = sub(PlayingInfo, size: @size.update(height: 2))
   @progressbar  = sub(ProgressBar, size: @size.update(height: 1))
   @tabbar       = sub(TabBar,      size: @size.update(height: 1))
   @windows      = sub(UI::SwitchContainer, size: @size.calc(height: -4))
   @help         = @windows.sub(Help, visible: false)
   @info         = @windows.sub(Info, visible: false)
   @splash       = @windows.sub(Splash, visible: false)
   @browser      = @windows.sub(Browser, visible: false)
   @playlist     = @windows.sub(Playlist, visible: false)

   Config[:'tabs.widgets'].each do |widget|
      @windows.add(send(widget))
      @tabbar.add(widget)
   end

   Config[:'main.widgets'].each { |w| add(send(w)) }

   self.selected=(@windows)
   @windows.selected=(@splash)
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def browser
  @browser
end

#helpObject (readonly)

Returns the value of attribute help.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def help
  @help
end

#infoObject (readonly)

Returns the value of attribute info.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def info
  @info
end

#playinginfoObject (readonly)

Returns the value of attribute playinginfo.



8
9
10
# File 'lib/ektoplayer/views/mainwindow.rb', line 8

def playinginfo
  @playinginfo
end

#playlistObject (readonly)

Returns the value of attribute playlist.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def playlist
  @playlist
end

#progressbarObject (readonly)

Returns the value of attribute progressbar.



8
9
10
# File 'lib/ektoplayer/views/mainwindow.rb', line 8

def progressbar
  @progressbar
end

#splashObject (readonly)

Returns the value of attribute splash.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def splash
  @splash
end

#tabbarObject (readonly)

Returns the value of attribute tabbar.



8
9
10
# File 'lib/ektoplayer/views/mainwindow.rb', line 8

def tabbar
  @tabbar
end

#windowsObject (readonly)

Returns the value of attribute windows.



9
10
11
# File 'lib/ektoplayer/views/mainwindow.rb', line 9

def windows
  @windows
end

Instance Method Details

#layoutObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ektoplayer/views/mainwindow.rb', line 35

def layout
   height = @size.height

   @playinginfo.size=(@size.update(height: 2))
   @progressbar.size=(@size.update(height: 1))
   @tabbar.size=(@size.update(height: 1))

   height -= 2 if @playinginfo.visible?
   height -= 1 if @progressbar.visible?
   height -= 1 if @tabbar.visible?

   @windows.size=(@size.update(height: height))

   super
end