Sha256: 362e4d5960296a39c267d079d09e9b97adfb28640c1b8bd8149aed2eacc16fdf

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

require File.dirname(__FILE__) + "/../../command_handler"
require File.dirname(__FILE__) + "/../custom_widget"
require File.dirname(__FILE__) + "/../g_widget"

module Glimmer
  module SWT
    module CommandHandlers
      class CustomWidgetCommandHandler
        include CommandHandler

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

        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-0.4.6 lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb
glimmer-0.4.5 lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb
glimmer-0.4.4 lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb