Sha256: 8384ed26d915103952c064ce19eb9cab461fde46853e0825c492fffefbf9c9ca

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

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
            parent.respond_to?(:swt_widget) 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/scrolled_composite_proxy'
require 'glimmer/swt/tree_proxy'
require 'glimmer/swt/table_proxy'
require 'glimmer/swt/table_column_proxy'

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
glimmer-dsl-swt-0.6.1 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.6.0 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.6 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.5 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.4 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.3 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.2 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.1 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.5.0 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.4.1 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.4.0 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.3.1 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.3.0 lib/glimmer/dsl/swt/widget_expression.rb
glimmer-dsl-swt-0.2.4 lib/glimmer/dsl/swt/widget_expression.rb