Class: Glimmer::SWT::GColor
- Inherits:
-
Object
- Object
- Glimmer::SWT::GColor
- Defined in:
- lib/glimmer/swt/g_color.rb
Instance Attribute Summary collapse
-
#alpha ⇒ Object
readonly
Returns the value of attribute alpha.
-
#blue ⇒ Object
readonly
Returns the value of attribute blue.
-
#display ⇒ Object
Returns the value of attribute display.
-
#green ⇒ Object
readonly
Returns the value of attribute green.
-
#red ⇒ Object
readonly
Returns the value of attribute red.
Class Method Summary collapse
Instance Method Summary collapse
- #color ⇒ Object
-
#initialize(display, red, green, blue, alpha = nil) ⇒ GColor
constructor
A new instance of GColor.
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
#alpha ⇒ Object (readonly)
Returns the value of attribute alpha.
7 8 9 |
# File 'lib/glimmer/swt/g_color.rb', line 7 def alpha @alpha end |
#blue ⇒ Object (readonly)
Returns the value of attribute blue.
7 8 9 |
# File 'lib/glimmer/swt/g_color.rb', line 7 def blue @blue end |
#display ⇒ Object
Returns the value of attribute display.
7 8 9 |
# File 'lib/glimmer/swt/g_color.rb', line 7 def display @display end |
#green ⇒ Object (readonly)
Returns the value of attribute green.
7 8 9 |
# File 'lib/glimmer/swt/g_color.rb', line 7 def green @green end |
#red ⇒ Object (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
#color ⇒ Object
29 30 31 |
# File 'lib/glimmer/swt/g_color.rb', line 29 def color @color ||= Color.new(@display, *[@red, @green, @blue, @alpha].compact) end |