Class: Glimmer::SWT::CommandHandlers::ColorCommandHandler
- Inherits:
-
Object
- Object
- Glimmer::SWT::CommandHandlers::ColorCommandHandler
- Includes:
- CommandHandler
- Defined in:
- lib/glimmer/swt/command_handlers/color_command_handler.rb
Instance Method Summary collapse
- #can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
- #do_handle(parent, command_symbol, *args, &block) ⇒ Object
Instance Method Details
#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
12 13 14 15 |
# File 'lib/glimmer/swt/command_handlers/color_command_handler.rb', line 12 def can_handle?(parent, command_symbol, *args, &block) ['rgba', 'rgb'].include?(command_symbol.to_s) and (3..5).include?(args.count) end |
#do_handle(parent, command_symbol, *args, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/glimmer/swt/command_handlers/color_command_handler.rb', line 17 def do_handle(parent, command_symbol, *args, &block) if args.first.is_a?(Display) || args.first.nil? display = args.delete_at(0) elsif parent.is_a?(GWidget) display = parent..display else display = GDisplay.instance.display end GColor.new(display, *args) end |