Class: Shoes::Swt::InputBox
- Inherits:
-
Object
- Object
- Shoes::Swt::InputBox
- Includes:
- Common::PainterUpdatesPosition, Common::UpdatePosition, Common::Focus, Common::Remove, Common::Visibility
- Defined in:
- shoes-swt/lib/shoes/swt/input_box.rb
Overview
Class is used by edit_box and edit_line
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#dsl ⇒ Object
readonly
Returns the value of attribute dsl.
-
#readonly ⇒ Object
writeonly
Sets the attribute readonly.
-
#real ⇒ Object
readonly
Returns the value of attribute real.
Instance Method Summary collapse
- #caret_to(index) ⇒ Object
- #enabled(value) ⇒ Object
- #highlight_text(start_index, final_index) ⇒ Object
-
#initialize(dsl, app, text_options) ⇒ InputBox
constructor
A new instance of InputBox.
- #text ⇒ Object
- #text=(value) ⇒ Object
Methods included from Common::Visibility
#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?
Methods included from Common::Remove
Methods included from Common::Focus
Constructor Details
#initialize(dsl, app, text_options) ⇒ InputBox
Returns a new instance of InputBox.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 17 def initialize(dsl, app, ) @dsl = dsl @app = app @real = ::Swt::Widgets::Text.new(@app.real, ) @real.set_size dsl.element_width, dsl.element_height @real.set_text dsl.style[:text] @real.add_modify_listener do |event| @dsl.call_change_listeners unless nothing_changed?(event) end @real.add_verify_listener do |event| event.doit = false if @readonly end end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
14 15 16 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 14 def app @app end |
#dsl ⇒ Object (readonly)
Returns the value of attribute dsl.
14 15 16 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 14 def dsl @dsl end |
#readonly=(value) ⇒ Object (writeonly)
Sets the attribute readonly
15 16 17 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 15 def readonly=(value) @readonly = value end |
#real ⇒ Object (readonly)
Returns the value of attribute real.
14 15 16 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 14 def real @real end |
Instance Method Details
#caret_to(index) ⇒ Object
50 51 52 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 50 def caret_to(index) @real.set_selection(index) end |
#enabled(value) ⇒ Object
42 43 44 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 42 def enabled(value) @real.enabled = value end |
#highlight_text(start_index, final_index) ⇒ Object
46 47 48 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 46 def highlight_text(start_index, final_index) @real.set_selection(start_index, final_index) end |
#text ⇒ Object
33 34 35 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 33 def text @real.text end |
#text=(value) ⇒ Object
37 38 39 40 |
# File 'shoes-swt/lib/shoes/swt/input_box.rb', line 37 def text=(value) @last_text = @real.text @real.text = value end |