Sha256: 4e9a5c79430460b03d95164baf2c9a03d6c59c4e6bf557206a1d1ed2e01686cd

Contents?: true

Size: 968 Bytes

Versions: 7

Compression:

Stored size: 968 Bytes

Contents

require 'glimmer'
require 'glimmer/dsl/expression'
require 'glimmer/dsl/parent_expression'

module Glimmer
  module DSL
    module SWT
      class WidgetExpression < Expression
        include ParentExpression
  
        EXCLUDED_KEYWORDS = %w[shell display tab_item]
  
        def can_interpret?(parent, keyword, *args, &block)
          !EXCLUDED_KEYWORDS.include?(keyword) and
            widget?(parent) and #TODO change to composite?(parent)
            Glimmer::SWT::WidgetProxy.widget_exists?(keyword)
        end
  
        def interpret(parent, keyword, *args, &block)
          begin
            class_name = "#{keyword.camelcase(:upper)}Proxy".to_sym
            widget_class = Glimmer::SWT.const_get(class_name)
          rescue
            widget_class = Glimmer::SWT::WidgetProxy
          end
          widget_class.new(keyword, parent, args)
        end
      end
    end
  end
end

require 'glimmer/swt/widget_proxy'
require 'glimmer/swt/tree_proxy'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
glimmer-0.8.1 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.8.0 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.7.8 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.7.7 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.7.6 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.7.5 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-0.7.4 lib/glimmer/dsl/swt/widget_expression.rb