Class: Potty::Widgets::ListItem
- Inherits:
-
Object
- Object
- Potty::Widgets::ListItem
- Defined in:
- lib/potty/widgets/list_item.rb
Overview
Base list item
Direct Known Subclasses
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #activate ⇒ Object
- #disabled? ⇒ Boolean
- #display_text ⇒ Object
- #handle_key(ch) ⇒ Object
-
#initialize(text, value: nil, color: nil) ⇒ ListItem
constructor
A new instance of ListItem.
-
#render_custom(window, theme, max_width) ⇒ Object
Override this to render with multiple colors Should call window.addstr() for each segment with different colors Return true if custom rendering was done, false to use default.
Constructor Details
#initialize(text, value: nil, color: nil) ⇒ ListItem
Returns a new instance of ListItem.
14 15 16 17 18 |
# File 'lib/potty/widgets/list_item.rb', line 14 def initialize(text, value: nil, color: nil) @text = text @value = value @color = color end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
12 13 14 |
# File 'lib/potty/widgets/list_item.rb', line 12 def color @color end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
11 12 13 |
# File 'lib/potty/widgets/list_item.rb', line 11 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
11 12 13 |
# File 'lib/potty/widgets/list_item.rb', line 11 def value @value end |
Instance Method Details
#activate ⇒ Object
35 36 37 |
# File 'lib/potty/widgets/list_item.rb', line 35 def activate # Override in subclasses end |
#disabled? ⇒ Boolean
31 32 33 |
# File 'lib/potty/widgets/list_item.rb', line 31 def disabled? false end |
#display_text ⇒ Object
20 21 22 |
# File 'lib/potty/widgets/list_item.rb', line 20 def display_text @text end |
#handle_key(ch) ⇒ Object
39 40 41 |
# File 'lib/potty/widgets/list_item.rb', line 39 def handle_key(ch) false end |
#render_custom(window, theme, max_width) ⇒ Object
Override this to render with multiple colors Should call window.addstr() for each segment with different colors Return true if custom rendering was done, false to use default
27 28 29 |
# File 'lib/potty/widgets/list_item.rb', line 27 def render_custom(window, theme, max_width) false end |