Class: Button
- Inherits:
-
Sprite
- Object
- Sprite
- Button
- Includes:
- CanDisable
- Defined in:
- lib/rubysketch/solitaire/common/button.rb
Instance Method Summary collapse
- #clicked(&block) ⇒ Object
-
#initialize(label = nil, *args, icon: nil, rgb: nil, width: 1, fontSize: 24, round: 5, **kwargs, &block) ⇒ Button
constructor
A new instance of Button.
Methods included from CanDisable
#disable, #disabled, #disabled?, #enable, #enabled, #enabled?
Constructor Details
#initialize(label = nil, *args, icon: nil, rgb: nil, width: 1, fontSize: 24, round: 5, **kwargs, &block) ⇒ Button
Returns a new instance of Button.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubysketch/solitaire/common/button.rb', line 8 def initialize( label = nil, *args, icon: nil, rgb: nil, width: 1, fontSize: 24, round: 5, **kwargs, &block) raise if !label && !icon super 0, 0, 44 * width, 44, *args, **kwargs, &block @label, @icon, @rgb, @fontSize, @round = label, icon, rgb, fontSize, round @click = nil setup end |
Instance Method Details
#clicked(&block) ⇒ Object
21 22 23 24 |
# File 'lib/rubysketch/solitaire/common/button.rb', line 21 def clicked(&block) @click = block nil end |