Class: Glimmer::SWT::CommandHandlers::CustomWidgetCommandHandler

Inherits:
Object
  • Object
show all
Includes:
CommandHandler
Defined in:
lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb

Instance Method Summary collapse

Instance Method Details

#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb', line 11

def can_handle?(parent, command_symbol, *args, &block)
  (parent.is_a?(GWidget) || parent.is_a?(SWT::CustomWidget)) and
  SWT::CustomWidget.for(command_symbol)
end

#do_handle(parent, command_symbol, *args, &block) ⇒ Object



16
17
18
19
20
# File 'lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb', line 16

def do_handle(parent, command_symbol, *args, &block)
  options = args.pop if args.last.is_a?(Hash)
  Glimmer.logger.debug "Custom widget #{command_symbol} styles are: [" + args.inspect + "] and options are: #{options}"
  SWT::CustomWidget.for(command_symbol).new(parent, *args, options, &block)
end