Class: Shoes::Swt::SwtButton
- Inherits:
-
Object
- Object
- Shoes::Swt::SwtButton
- Includes:
- Common::UpdatePosition, Common::Focus, Common::Remove, Common::Visibility
- Defined in:
- shoes-swt/lib/shoes/swt/swt_button.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#dsl ⇒ Object
readonly
Returns the value of attribute dsl.
-
#real ⇒ Object
readonly
Returns the value of attribute real.
Instance Method Summary collapse
- #click(blk) ⇒ Object
- #enabled(value) ⇒ Object
- #eval_block(blk) ⇒ Object
-
#initialize(dsl, app, type) {|@real| ... } ⇒ SwtButton
constructor
A new instance of SwtButton.
- #remove_listeners ⇒ 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, type) {|@real| ... } ⇒ SwtButton
Returns a new instance of SwtButton.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 14 def initialize(dsl, app, type) @dsl = dsl @app = app @type = type @real = ::Swt::Widgets::Button.new(@app.real, @type) yield(@real) if block_given? set_size end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
12 13 14 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 12 def app @app end |
#dsl ⇒ Object (readonly)
Returns the value of attribute dsl.
12 13 14 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 12 def dsl @dsl end |
#real ⇒ Object (readonly)
Returns the value of attribute real.
12 13 14 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 12 def real @real end |
Instance Method Details
#click(blk) ⇒ Object
30 31 32 33 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 30 def click(blk) remove_listeners @real.addSelectionListener { eval_block blk } end |
#enabled(value) ⇒ Object
42 43 44 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 42 def enabled(value) @real. value end |
#eval_block(blk) ⇒ Object
26 27 28 |
# File 'shoes-swt/lib/shoes/swt/swt_button.rb', line 26 def eval_block(blk) blk.call @dsl end |