Sha256: 5e40b3d3a872b54c5a66ac45313ee72a9fb08b89a763c70b9a263190bcb34c41

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

require File.dirname(__FILE__) + "/../../command_handler"
require File.dirname(__FILE__) + "/../g_layout"

module Glimmer
  module SWT
    module CommandHandlers
      class LayoutCommandHandler
        include CommandHandler

        include_package 'org.eclipse.swt.widgets'
        include_package 'org.eclipse.swt.layout'

        def can_handle?(parent, command_symbol, *args, &block)
          (parent.is_a?(GWidget) || parent.is_a?(CustomWidget)) and
          parent.widget.is_a?(Composite) and
          command_symbol.to_s.end_with?('_layout') and
          GLayout.layout_exists?(command_symbol.to_s)
        end

        def do_handle(parent, command_symbol, *args, &block)
          Glimmer.logger.debug "Layout #{command_symbol} args are: #{args.inspect}"
          GLayout.new(command_symbol.to_s, parent.widget, args)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-0.4.9 lib/glimmer/swt/command_handlers/layout_command_handler.rb
glimmer-0.4.8 lib/glimmer/swt/command_handlers/layout_command_handler.rb
glimmer-0.4.7 lib/glimmer/swt/command_handlers/layout_command_handler.rb