Class: SWT::ImageCommand
- Inherits:
-
TreeCommand
- Object
- TreeCommand
- SWT::ImageCommand
- Defined in:
- lib/swt.rb
Instance Method Summary collapse
-
#initialize(parent, exp) ⇒ ImageCommand
constructor
A new instance of ImageCommand.
- #invoke(stack) ⇒ Object
Methods inherited from TreeCommand
Constructor Details
#initialize(parent, exp) ⇒ ImageCommand
Returns a new instance of ImageCommand.
153 154 155 156 |
# File 'lib/swt.rb', line 153 def initialize(parent,exp) super(parent) @exp=exp end |
Instance Method Details
#invoke(stack) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/swt.rb', line 157 def invoke(stack) image=@exp.call stack.last.getData("object") image=Image.new stack.last.getDisplay, image if image.is_a? String raise "Image expression(#{image},#{@exp}) must be an swt image or a filename: #{stacktrace}" unless image.is_a? Image stack.last.setImage(image) end |