Class: Glimmer::DSL::SWT::MenuExpression

Inherits:
StaticExpression
  • Object
show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/swt/menu_expression.rb

Instance Method Summary collapse

Instance Method Details

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/glimmer/dsl/swt/menu_expression.rb', line 35

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

#interpret(parent, keyword, *args, &block) ⇒ Object



47
48
49
# File 'lib/glimmer/dsl/swt/menu_expression.rb', line 47

def interpret(parent, keyword, *args, &block)
  Glimmer::SWT::MenuProxy.new(parent, args)
end