Sha256: 15bb8c9efedc05dd1b2f04c4bf042f9e4a458edeb9aba0a30e8d1b19df917a9e

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

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

module Glimmer
  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) 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-0.4.3 lib/glimmer/command_handlers/layout_command_handler.rb
glimmer-0.4.2 lib/glimmer/command_handlers/layout_command_handler.rb
glimmer-0.4.1 lib/glimmer/command_handlers/layout_command_handler.rb