Class: Glimmer::DSL::SWT::WidgetExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::SWT::WidgetExpression
- Includes:
- ParentExpression
- Defined in:
- lib/glimmer/dsl/swt/widget_expression.rb
Constant Summary collapse
- EXCLUDED_KEYWORDS =
%w[shell display tab_item c_tab_item] + Glimmer::SWT::Custom::Shape.keywords - ['text']
Instance Method Summary collapse
- #add_content(parent, keyword, *args, &block) ⇒ Object
- #can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
- #interpret(parent, keyword, *args, &block) ⇒ Object
Instance Method Details
#add_content(parent, keyword, *args, &block) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/glimmer/dsl/swt/widget_expression.rb', line 49 def add_content(parent, keyword, *args, &block) return if block&.parameters&.count == 2 super parent.post_add_content parent.finish_add_content! end |
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/glimmer/dsl/swt/widget_expression.rb', line 35 def can_interpret?(parent, keyword, *args, &block) !EXCLUDED_KEYWORDS.include?(keyword) and parent.respond_to?(:swt_widget) and !parent.is_a?(Glimmer::SWT::Custom::Shape) and !((keyword.to_s == 'text') and (args.first.is_a?(String) or parent..class == org.eclipse.swt..Canvas)) and Glimmer::SWT::WidgetProxy.(keyword) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
43 44 45 46 47 |
# File 'lib/glimmer/dsl/swt/widget_expression.rb', line 43 def interpret(parent, keyword, *args, &block) Glimmer::SWT::WidgetProxy.create(keyword, parent, args).tap do || .paint_pixel_by_pixel(&block) if block&.parameters&.count == 2 end end |