Sha256: 85107e970c1d69c4fc4ccc1841f43cf0341156a6f92e47ef60722d5a9f27b663

Contents?: true

Size: 838 Bytes

Versions: 13

Compression:

Stored size: 838 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 widget?(parent)
              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

13 entries across 13 versions & 1 rubygems

Version Path
glimmer-0.8.2 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.8.1 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.8.0 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.8 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.7 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.6 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.5 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.4 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.3 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.2 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.1 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.7.0 lib/glimmer/dsl/swt/menu_expression.rb
glimmer-0.6.0 lib/glimmer/dsl/swt/menu_expression.rb