Class: RubyMVC::Views::PeerView
- Inherits:
-
View
- Object
- Toolkit::AbstractWidget
- View
- RubyMVC::Views::PeerView
- Defined in:
- lib/ruby_mvc/views/view.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#frame ⇒ Object
This method is used to retrieve a reference to the parent frame.
-
#widget ⇒ Object
Returns the value of attribute widget.
Attributes inherited from View
Class Method Summary collapse
- .create_widget(klass, options = {}) ⇒ Object
-
.widget(*args, &block) ⇒ Object
This method is used to define the primary widget class through which this view may be added to other widgets.
- .widget_def(targ = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PeerView
constructor
A new instance of PeerView.
- #method_missing(m, *a, &b) ⇒ Object
- #peer ⇒ Object
-
#signal_connect(signal, &b) ⇒ Object
This method is required to ensure that concrete views appropriately manage signal registration.
- #signal_disconnect(signal, &b) ⇒ Object
Methods included from Toolkit::SignalHandler::ClassMethods
#signal, #signals, #valid_signal!, #valid_signal?
Methods included from Toolkit::SignalHandler
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object
116 117 118 |
# File 'lib/ruby_mvc/views/view.rb', line 116 def method_missing(m, *a, &b) @widget.send(m, *a, &b) end |
Instance Attribute Details
#frame ⇒ Object
This method is used to retrieve a reference to the parent frame
87 88 89 |
# File 'lib/ruby_mvc/views/view.rb', line 87 def frame @frame end |
#widget ⇒ Object
Returns the value of attribute widget.
89 90 91 |
# File 'lib/ruby_mvc/views/view.rb', line 89 def @widget end |
Class Method Details
.create_widget(klass, options = {}) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/ruby_mvc/views/view.rb', line 63 def self.(klass, = {}) w = self.(klass) args = (w[:args].clone << ) block = w[:block] args[0].new(*args[1..-1], &block) end |
.widget(*args, &block) ⇒ Object
This method is used to define the primary widget class through which this view may be added to other widgets.
75 76 77 78 |
# File 'lib/ruby_mvc/views/view.rb', line 75 def (*args, &block) puts "Set widget for #{self}: #{args.inspect}" @widget_def = { :args => args, :block => block } end |
Instance Method Details
#peer ⇒ Object
81 82 83 |
# File 'lib/ruby_mvc/views/view.rb', line 81 def peer @widget.peer end |
#signal_connect(signal, &b) ⇒ Object
This method is required to ensure that concrete views appropriately manage signal registration
98 99 100 101 102 103 104 105 106 |
# File 'lib/ruby_mvc/views/view.rb', line 98 def signal_connect(signal, &b) puts "Widget class: #{@widget.class}" if @widget.class.valid_signal? signal @widget.signal_connect(signal, &b) else puts "super" super end end |
#signal_disconnect(signal, &b) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/ruby_mvc/views/view.rb', line 108 def signal_disconnect(signal, &b) if @widget.class.valid_signal? signal @widget.signal_connect(signal, &b) else super end end |