Class: Glimmer::Gtk::WidgetProxy::DrawingAreaProxy
- Inherits:
-
Glimmer::Gtk::WidgetProxy
- Object
- Glimmer::Gtk::WidgetProxy
- Glimmer::Gtk::WidgetProxy::DrawingAreaProxy
- Includes:
- Transformable
- Defined in:
- lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb
Overview
Proxy for Gtk drawing area objects
Follows the Proxy Design Pattern
Constant Summary
Constants inherited from Glimmer::Gtk::WidgetProxy
Instance Attribute Summary collapse
-
#shapes ⇒ Object
readonly
Returns the value of attribute shapes.
Attributes inherited from Glimmer::Gtk::WidgetProxy
#args, #block, #gtk, #keyword, #parent_proxy
Instance Method Summary collapse
-
#initialize(keyword, parent, args, &block) ⇒ DrawingAreaProxy
constructor
A new instance of DrawingAreaProxy.
- #paint(*args) ⇒ Object
- #post_add_content ⇒ Object
- #post_initialize_child(child) ⇒ Object
Methods included from Transformable
#apply_transforms, #rotate, #scale, #translate
Methods inherited from Glimmer::Gtk::WidgetProxy
constant_symbol, #content, create, descendant_keyword_constant_map, exist?, gtk_constant_symbol, keyword, map_descendant_keyword_constants_for, #method_missing, reset_descendant_keyword_constant_map, #respond_to?, #respond_to_gtk?, #send_to_gtk, widget_proxy_class, #window_proxy
Constructor Details
#initialize(keyword, parent, args, &block) ⇒ DrawingAreaProxy
Returns a new instance of DrawingAreaProxy.
73 74 75 76 |
# File 'lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb', line 73 def initialize(keyword, parent, args, &block) @shapes = [] super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::Gtk::WidgetProxy
Instance Attribute Details
#shapes ⇒ Object (readonly)
Returns the value of attribute shapes.
71 72 73 |
# File 'lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb', line 71 def shapes @shapes end |
Instance Method Details
#paint(*args) ⇒ Object
103 104 105 |
# File 'lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb', line 103 def paint(*args) @paint = args end |
#post_add_content ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb', line 78 def post_add_content super @gtk.signal_connect(:draw) do |, cairo_context| if @paint previous_matrix = cairo_context.matrix apply_transforms(cairo_context, target: :drawing_area) Shape.set_source_dynamically(cairo_context, @paint) cairo_context.paint cairo_context.set_matrix(previous_matrix) end shapes.each do |shape| shape.draw(, cairo_context) end end end |