Class: Glimmer::DSL::SWT::MenuBarExpression

Inherits:
StaticExpression
  • Object
show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/swt/menu_bar_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_bar_expression.rb', line 35

def can_interpret?(parent, keyword, *args, &block)
  initial_condition = (keyword == 'menu_bar')
  if initial_condition
    if parent.swt_widget.is_a?(Shell)
      return true
    else
      raise Glimmer::Error, "menu_bar may only be nested under a shell!"
    end
  end
  false
end

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



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

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