Sha256: ff32f3f4b12b304eb048b31c8be2129129996b98ff3469a08d46927b54cc7bb7

Contents?: true

Size: 854 Bytes

Versions: 30

Compression:

Stored size: 854 Bytes

Contents

require 'glimmer'
require 'glimmer/dsl/static_expression'
require 'glimmer/dsl/parent_expression'
require 'glimmer/swt/menu_proxy'

module Glimmer
  module DSL
    module SWT
      class MenuExpression < StaticExpression
        include ParentExpression
  
        include_package 'org.eclipse.swt.widgets'
  
        def can_interpret?(parent, keyword, *args, &block)
          initial_condition = (keyword == 'menu')
          if initial_condition
            if parent.respond_to?(:swt_widget)
              return true
            else
              raise Glimmer::Error, "menu may only be nested under a widget (like shell or another menu)!"
            end
          end
          false
        end
  
        def interpret(parent, keyword, *args, &block)
          Glimmer::SWT::MenuProxy.new(parent, args)
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
glimmer-dsl-swt-0.6.9 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.8 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.7 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.6 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.5 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.4 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.3 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.2 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.1 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.6.0 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.6 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.5 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.4 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.3 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.2 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.1 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.5.0 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.4.1 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.4.0 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-dsl-swt-0.3.1 lib/glimmer/dsl/swt/menu_expression.rb