Class: Glimmer::DSL::Tk::WidgetExpression

Inherits:
Expression
  • Object
show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/tk/widget_expression.rb

Constant Summary collapse

EXCLUDED_KEYWORDS =
%w[root]

Instance Method Summary collapse

Instance Method Details

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



48
49
50
51
# File 'lib/glimmer/dsl/tk/widget_expression.rb', line 48

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

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

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/glimmer/dsl/tk/widget_expression.rb', line 34

def can_interpret?(parent, keyword, *args, &block)
  !EXCLUDED_KEYWORDS.include?(keyword) and
    Glimmer::Tk::WidgetProxy.widget_exists?(keyword) and
    (parent.respond_to?(:tk) or args.first.respond_to?(:tk))
end

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



40
41
42
43
44
45
46
# File 'lib/glimmer/dsl/tk/widget_expression.rb', line 40

def interpret(parent, keyword, *args, &block)
  if keyword == 'toplevel' && args.first.respond_to?(:tk)
    parent = args.first
    args[0] = args.first.tk
  end
  Glimmer::Tk::WidgetProxy.create(keyword, parent, args, &block)
end