Sha256: 3338637a038abac8e5a1c5904c0fa8292982eeaedde6f2e0e6b3bfcf405bd7bb

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

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

module Glimmer
  module SWT
    module CommandHandlers
      class CustomWidgetCommandHandler
        include CommandHandler

        def can_handle?(parent, command_symbol, *args, &block)
          custom_widget_class = CustomWidget.for(command_symbol)
          custom_widget_class and
            (parent.is_a?(GWidget) || parent.is_a?(CustomWidget) || custom_widget_class.ancestors.include?(CustomShell))
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-0.4.9 lib/glimmer/swt/command_handlers/custom_widget_command_handler.rb