Class: RColor

Inherits:
Object
  • Object
show all
Defined in:
lib/command_handlers/models/r_color.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display, red, green, blue, alpha = nil) ⇒ RColor

Returns a new instance of RColor.



14
15
16
17
# File 'lib/command_handlers/models/r_color.rb', line 14

def initialize(display, red, green, blue, alpha = nil)
  @display = display
  @color = Color.new(@display, *[red, green, blue, alpha].compact)
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



3
4
5
# File 'lib/command_handlers/models/r_color.rb', line 3

def color
  @color
end

#displayObject (readonly)

Returns the value of attribute display.



2
3
4
# File 'lib/command_handlers/models/r_color.rb', line 2

def display
  @display
end

Class Method Details

.for(display, standard_color) ⇒ Object



8
9
10
11
# File 'lib/command_handlers/models/r_color.rb', line 8

def for(display, standard_color)
  standard_color_swt_constant = org.eclipse.swt.SWT.const_get(standard_color.to_s.upcase.to_sym)
  display.getSystemColor(standard_color_swt_constant)
end