Class: UI::LabelWidget
- Defined in:
- lib/ektoplayer/ui/widgets/labelwidget.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#pad ⇒ Object
Returns the value of attribute pad.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from Window
Attributes inherited from Widget
Instance Method Summary collapse
- #draw ⇒ Object
- #fit ⇒ Object
-
#initialize(text: '', attributes: 0, pad: {}, **opts) ⇒ LabelWidget
constructor
A new instance of LabelWidget.
Methods inherited from Window
#layout, #noutrefresh, #refresh
Methods inherited from Widget
#display, #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(text: '', attributes: 0, pad: {}, **opts) ⇒ LabelWidget
Returns a new instance of LabelWidget.
7 8 9 10 11 |
# File 'lib/ektoplayer/ui/widgets/labelwidget.rb', line 7 def initialize(text: '', attributes: 0, pad: {}, **opts) super(**opts) @text, @attributes, @pad = text.to_s, attributes, Hash.new(0) @pad.update pad end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/ektoplayer/ui/widgets/labelwidget.rb', line 5 def attributes @attributes end |
#pad ⇒ Object
Returns the value of attribute pad.
5 6 7 |
# File 'lib/ektoplayer/ui/widgets/labelwidget.rb', line 5 def pad @pad end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/ektoplayer/ui/widgets/labelwidget.rb', line 5 def text @text end |
Instance Method Details
#draw ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ektoplayer/ui/widgets/labelwidget.rb', line 28 def draw @win.erase @text.split(?\n).each_with_index do |l, i| @win.move(@pad[:top] + i, @pad[:left]) @win.attron(@attributes) { @win << l } end end |