Class: Glimmer::DSL::Libui::ShapeExpression

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

Instance Method Summary collapse

Instance Method Details

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



50
51
52
53
54
55
# File 'lib/glimmer/dsl/libui/shape_expression.rb', line 50

def add_content(parent, keyword, *args, &block)
  options = args.last.is_a?(Hash) ? args.last : {}
  options[:post_add_content] = true if !options.include?(:post_add_content)
  super
  parent&.post_add_content if options[:post_add_content]
end

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

Returns:

  • (Boolean)


34
35
36
37
38
39
40
41
42
# File 'lib/glimmer/dsl/libui/shape_expression.rb', line 34

def can_interpret?(parent, keyword, *args, &block)
  Glimmer::LibUI::Shape.exists?(keyword) and
    (
      parent.is_a?(Glimmer::LibUI::ControlProxy::PathProxy) or
      parent.is_a?(Glimmer::LibUI::Shape) or
      parent.is_a?(Glimmer::LibUI::ControlProxy::AreaProxy) or
      (parent.nil? && Glimmer::LibUI::ControlProxy::AreaProxy.current_area_draw_params)
    )
end

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



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

def interpret(parent, keyword, *args, &block)
  keyword = Glimmer::LibUI::Shape::KEYWORD_ALIASES[keyword] || keyword
  args = [args] if args.size > 1 && Glimmer::LibUI::Shape.shape_class(keyword).parameters.size == 1
  Glimmer::LibUI::Shape.create(keyword, parent, args, &block)
end