Class: Glimmer::DSL::MenuBarExpression

Inherits:
StaticExpression show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/menu_bar_expression.rb

Instance Method Summary collapse

Methods included from ParentExpression

#add_content

Methods inherited from StaticExpression

inherited

Methods inherited from Expression

#add_content, #textual?, #widget?

Instance Method Details

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

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/glimmer/dsl/menu_bar_expression.rb', line 13

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



25
26
27
28
# File 'lib/glimmer/dsl/menu_bar_expression.rb', line 25

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