Class: LessCurse::Widgets::Base
- Inherits:
-
Object
- Object
- LessCurse::Widgets::Base
- Defined in:
- lib/less_curse/widgets/base.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#data ⇒ Object
Returns the value of attribute data.
-
#focus ⇒ Object
Receive Focus.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#draw(window) ⇒ Object
Draw portions of screen, probably using ncurses primitives.
-
#focused? ⇒ Boolean
Is focused?.
-
#handle_input(key) ⇒ Object
Handle input or return false if doesnt care.
-
#initialize(data: nil, title: "") ⇒ Base
constructor
A new instance of Base.
-
#set_default_actions ⇒ Object
Populate actions with proper code.
-
#unfocus ⇒ Object
Loose Focus.
Constructor Details
#initialize(data: nil, title: "") ⇒ Base
Returns a new instance of Base.
9 10 11 12 |
# File 'lib/less_curse/widgets/base.rb', line 9 def initialize data: nil, title: "" @data, @title = data, title set_default_actions end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
7 8 9 |
# File 'lib/less_curse/widgets/base.rb', line 7 def actions @actions end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/less_curse/widgets/base.rb', line 4 def data @data end |
#focus ⇒ Object
Receive Focus
27 28 29 |
# File 'lib/less_curse/widgets/base.rb', line 27 def focus @focus end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/less_curse/widgets/base.rb', line 5 def title @title end |
Instance Method Details
#draw(window) ⇒ Object
Draw portions of screen, probably using ncurses primitives. Expect an already clean/red window.
16 |
# File 'lib/less_curse/widgets/base.rb', line 16 def draw(window) ; end |
#focused? ⇒ Boolean
Is focused?
37 38 39 |
# File 'lib/less_curse/widgets/base.rb', line 37 def focused? return @focus end |
#handle_input(key) ⇒ Object
Handle input or return false if doesnt care
22 23 24 |
# File 'lib/less_curse/widgets/base.rb', line 22 def handle_input key false end |
#set_default_actions ⇒ Object
Populate actions with proper code
19 |
# File 'lib/less_curse/widgets/base.rb', line 19 def set_default_actions ; end |
#unfocus ⇒ Object
Loose Focus
32 33 34 |
# File 'lib/less_curse/widgets/base.rb', line 32 def unfocus @focus = false end |