Class: Glimmer::SWT::GColor

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of GColor.



21
22
23
24
25
26
27
# File 'lib/glimmer/swt/g_color.rb', line 21

def initialize(display, red, green, blue, alpha = nil)
  @display = display
  @red = red
  @green = green
  @blue = blue
  @alpha = alpha
end

Instance Attribute Details

#alphaObject (readonly)

Returns the value of attribute alpha.



7
8
9
# File 'lib/glimmer/swt/g_color.rb', line 7

def alpha
  @alpha
end

#blueObject (readonly)

Returns the value of attribute blue.



7
8
9
# File 'lib/glimmer/swt/g_color.rb', line 7

def blue
  @blue
end

#displayObject

Returns the value of attribute display.



7
8
9
# File 'lib/glimmer/swt/g_color.rb', line 7

def display
  @display
end

#greenObject (readonly)

Returns the value of attribute green.



7
8
9
# File 'lib/glimmer/swt/g_color.rb', line 7

def green
  @green
end

#redObject (readonly)

Returns the value of attribute red.



7
8
9
# File 'lib/glimmer/swt/g_color.rb', line 7

def red
  @red
end

Class Method Details

.color_for(display = nil, standard_color) ⇒ Object



14
15
16
17
18
# File 'lib/glimmer/swt/g_color.rb', line 14

def color_for(display = nil, standard_color)
  standard_color = "color_#{standard_color}".to_sym unless standard_color.to_s.include?('color_')
  display ||= GDisplay.instance.display
  display.getSystemColor(GSWT[standard_color])
end

Instance Method Details

#colorObject



29
30
31
# File 'lib/glimmer/swt/g_color.rb', line 29

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