Class: Glimmer::SWT::ImageProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/glimmer/swt/image_proxy.rb

Overview

emulating org.eclipse.swt.graphics.Image

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ImageProxy

Returns a new instance of ImageProxy.



17
18
19
20
21
22
23
# File 'lib/glimmer/swt/image_proxy.rb', line 17

def initialize(*args)
  options = args.last.is_a?(Hash) ? args.last : {}
  # TODO support a parent as a first argument before the file path
  @file_path = args.first
  @width = options[:width]
  @height = options[:height]
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



15
16
17
# File 'lib/glimmer/swt/image_proxy.rb', line 15

def file_path
  @file_path
end

#heightObject (readonly)

Returns the value of attribute height.



15
16
17
# File 'lib/glimmer/swt/image_proxy.rb', line 15

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



15
16
17
# File 'lib/glimmer/swt/image_proxy.rb', line 15

def width
  @width
end

Class Method Details

.create(*args, &content) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/glimmer/swt/image_proxy.rb', line 6

def create(*args, &content)
  if args.size == 1 && args.first.is_a?(ImageProxy)
    args.first
  else
    new(*args, &content)
  end
end