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.
13 14 15 16 17 |
# File 'lib/potty/widgets/list_item.rb', line 13 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.
11 12 13 |
# File 'lib/potty/widgets/list_item.rb', line 11 def color @color end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
10 11 12 |
# File 'lib/potty/widgets/list_item.rb', line 10 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/potty/widgets/list_item.rb', line 10 def value @value end |
Instance Method Details
#activate ⇒ Object
34 35 36 |
# File 'lib/potty/widgets/list_item.rb', line 34 def activate # Override in subclasses end |
#disabled? ⇒ Boolean
30 31 32 |
# File 'lib/potty/widgets/list_item.rb', line 30 def disabled? false end |
#display_text ⇒ Object
19 20 21 |
# File 'lib/potty/widgets/list_item.rb', line 19 def display_text @text end |
#handle_key(ch) ⇒ Object
38 39 40 |
# File 'lib/potty/widgets/list_item.rb', line 38 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
26 27 28 |
# File 'lib/potty/widgets/list_item.rb', line 26 def render_custom(window, theme, max_width) false end |