Class: Ektoplayer::Views::MainWindow
- Inherits:
-
UI::VerticalContainer
- Object
- UI::Widget
- UI::GenericContainer
- UI::VerticalContainer
- Ektoplayer::Views::MainWindow
- Defined in:
- lib/ektoplayer/views/mainwindow.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#playinginfo ⇒ Object
readonly
Returns the value of attribute playinginfo.
-
#playlist ⇒ Object
readonly
Returns the value of attribute playlist.
-
#progressbar ⇒ Object
readonly
Returns the value of attribute progressbar.
-
#splash ⇒ Object
readonly
Returns the value of attribute splash.
-
#tabbar ⇒ Object
readonly
Returns the value of attribute tabbar.
-
#windows ⇒ Object
readonly
Returns the value of attribute windows.
Attributes inherited from UI::GenericContainer
#selected, #selected_index, #widgets
Attributes inherited from UI::Widget
Instance Method Summary collapse
-
#initialize(**opts) ⇒ MainWindow
constructor
A new instance of MainWindow.
- #layout ⇒ Object
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 || @windows.add(send()) @tabbar.add() end Config[:'main.widgets'].each { |w| add(send(w)) } self.selected=(@windows) @windows.selected=(@splash) end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
9 10 11 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 9 def browser @browser end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
9 10 11 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 9 def help @help end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
9 10 11 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 9 def info @info end |
#playinginfo ⇒ Object (readonly)
Returns the value of attribute playinginfo.
8 9 10 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 8 def @playinginfo end |
#playlist ⇒ Object (readonly)
Returns the value of attribute playlist.
9 10 11 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 9 def playlist @playlist end |
#progressbar ⇒ Object (readonly)
Returns the value of attribute progressbar.
8 9 10 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 8 def @progressbar end |
#splash ⇒ Object (readonly)
Returns the value of attribute splash.
9 10 11 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 9 def splash @splash end |
#tabbar ⇒ Object (readonly)
Returns the value of attribute tabbar.
8 9 10 |
# File 'lib/ektoplayer/views/mainwindow.rb', line 8 def @tabbar end |
#windows ⇒ Object (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
#layout ⇒ Object
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 |