Class: Wee::TextInputDialog
- Inherits:
-
FormDialog
- Object
- Presenter
- Component
- Dialog
- FormDialog
- Wee::TextInputDialog
- Defined in:
- lib/wee/dialog.rb
Overview
class SingleSelectionDialog
Direct Known Subclasses
Constant Summary
Constants inherited from Component
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #buttons ⇒ Object
- #cancel ⇒ Object
-
#initialize(caption = nil, text = "", size = 50) ⇒ TextInputDialog
constructor
A new instance of TextInputDialog.
- #ok ⇒ Object
- #render_body(r) ⇒ Object
- #set_text(text) ⇒ Object
- #state(s) ⇒ Object
Methods inherited from FormDialog
#render, #render_buttons, #render_caption, #render_form
Methods inherited from Component
#add_decoration, #children, #choose_from, #confirm, #decoration, #decoration=, depends, #each_decoration, #find_decoration, #inform, instanciate, #process_callbacks, #remove_decoration, #remove_decoration_if, #render
Methods inherited from Presenter
#process_callbacks, #render, #render!, #renderer_class
Constructor Details
#initialize(caption = nil, text = "", size = 50) ⇒ TextInputDialog
Returns a new instance of TextInputDialog.
112 113 114 115 116 |
# File 'lib/wee/dialog.rb', line 112 def initialize(=nil, text="", size=50) super() @text = text @size = size end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
110 111 112 |
# File 'lib/wee/dialog.rb', line 110 def text @text end |
Instance Method Details
#buttons ⇒ Object
130 131 132 |
# File 'lib/wee/dialog.rb', line 130 def [['Ok', nil, :ok, :ok], ['Cancel', nil, :cancel, :cancel]] end |
#cancel ⇒ Object
138 139 140 |
# File 'lib/wee/dialog.rb', line 138 def cancel answer nil end |
#ok ⇒ Object
134 135 136 |
# File 'lib/wee/dialog.rb', line 134 def ok answer @text end |
#render_body(r) ⇒ Object
122 123 124 |
# File 'lib/wee/dialog.rb', line 122 def render_body(r) r.text_input.size(@size).callback_method(:set_text).value(@text || "") end |
#set_text(text) ⇒ Object
126 127 128 |
# File 'lib/wee/dialog.rb', line 126 def set_text(text) @text = text.strip end |
#state(s) ⇒ Object
118 119 120 |
# File 'lib/wee/dialog.rb', line 118 def state(s) super s.add_ivar(self, :@text) end |