Class: Soundcloud2000::UI::View
- Inherits:
-
Object
- Object
- Soundcloud2000::UI::View
show all
- Defined in:
- lib/soundcloud2000/ui/view.rb
Constant Summary
collapse
- ROW_SEPARATOR =
?|
- LINE_SEPARATOR =
?-
- INTERSECTION =
?+
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(rect) ⇒ View
Returns a new instance of View.
14
15
16
17
18
19
|
# File 'lib/soundcloud2000/ui/view.rb', line 14
def initialize(rect)
@rect = rect
@window = Curses::Window.new(rect.height, rect.width, rect.y, rect.x)
@line = 0
@padding = 0
end
|
Instance Attribute Details
#rect ⇒ Object
Returns the value of attribute rect.
12
13
14
|
# File 'lib/soundcloud2000/ui/view.rb', line 12
def rect
@rect
end
|
Instance Method Details
#body_width ⇒ Object
32
33
34
|
# File 'lib/soundcloud2000/ui/view.rb', line 32
def body_width
rect.width - 2 * padding
end
|
#clear ⇒ Object
40
41
42
|
# File 'lib/soundcloud2000/ui/view.rb', line 40
def clear
@window.clear
end
|
#padding(value = nil) ⇒ Object
21
22
23
|
# File 'lib/soundcloud2000/ui/view.rb', line 21
def padding(value = nil)
value.nil? ? @padding : @padding = value
end
|
#render ⇒ Object
25
26
27
28
29
30
|
# File 'lib/soundcloud2000/ui/view.rb', line 25
def render
perform_layout
reset
draw
refresh
end
|
#with_color(name, &block) ⇒ Object
36
37
38
|
# File 'lib/soundcloud2000/ui/view.rb', line 36
def with_color(name, &block)
@window.attron(Color.get(name), &block)
end
|