Class: Glimmer::DSL::Opal::MenuExpression

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

Instance Method Summary collapse

Instance Method Details

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



50
51
52
53
# File 'lib/glimmer/dsl/opal/menu_expression.rb', line 50

def add_content(parent, keyword, *args, &block)
  super(parent, keyword, *args, &block)
  parent.post_add_content
end

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

Returns:

  • (Boolean)


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

def can_interpret?(parent, keyword, *args, &block)
  initial_condition = (keyword == 'menu')
  if initial_condition
    if parent.is_a?(Glimmer::SWT::WidgetProxy)
      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



46
47
48
# File 'lib/glimmer/dsl/opal/menu_expression.rb', line 46

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