Class: Glimmer::DSL::Opal::ShapeExpression

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

Instance Method Summary collapse

Instance Method Details

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



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

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
# File 'lib/glimmer/dsl/opal/shape_expression.rb', line 34

def can_interpret?(parent, keyword, *args, &block)
  # TODO consider parent as WidgetProxy too just like SWT
  (parent.is_a?(Glimmer::SWT::CanvasProxy) or parent.is_a?(Glimmer::SWT::Custom::Shape)) and
    Glimmer::SWT::Custom::Shape.valid?(parent, keyword, args, &block) and
    ((keyword != 'text' && keyword != 'image') || args.size >= 3 || (args.empty? && block_given?))
end

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



41
42
43
# File 'lib/glimmer/dsl/opal/shape_expression.rb', line 41

def interpret(parent, keyword, *args, &block)
  Glimmer::SWT::Custom::Shape.create(parent, keyword, args, &block)
end