Class: Context::View
- Inherits:
-
Object
- Object
- Context::View
- Defined in:
- lib/Context/View.rb
Overview
This is the abstract view class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #addView(view) ⇒ Object
-
#getWidget ⇒ Object
Concrete classes should override this method.
-
#initialize(context) ⇒ View
constructor
A new instance of View.
- #removeView(view) ⇒ Object
-
#removingViewFrom(parent) ⇒ Object
Override this method to do something when your view being removed from another view.
-
#viewAddedTo(parent) ⇒ Object
Override this method to do something when your view has been added to another view.
Constructor Details
#initialize(context) ⇒ View
Returns a new instance of View.
6 7 8 |
# File 'lib/Context/View.rb', line 6 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/Context/View.rb', line 5 def context @context end |
Instance Method Details
#addView(view) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/Context/View.rb', line 10 def addView(view) myWidget = getWidget() if(myWidget != nil) newWidget = view.getWidget() if !newWidget.nil? myWidget.addToThisWidget(newWidget) newWidget.(myWidget) end end view.viewAddedTo(self) end |
#getWidget ⇒ Object
Concrete classes should override this method
45 46 47 |
# File 'lib/Context/View.rb', line 45 def getWidget return nil end |
#removeView(view) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/Context/View.rb', line 27 def removeView(view) view.removingViewFrom(self) myWidget = getWidget() if(myWidget != nil) oldWidget = view.getWidget() if !oldWidget.nil? myWidget.removeFromThisWidget(oldWidget) oldWidget.(myWidget) end end end |
#removingViewFrom(parent) ⇒ Object
Override this method to do something when your view being removed from another view. Most useful for removing subviews
41 42 |
# File 'lib/Context/View.rb', line 41 def removingViewFrom(parent) end |
#viewAddedTo(parent) ⇒ Object
Override this method to do something when your view has been added to another view. Most useful for adding subviews
24 25 |
# File 'lib/Context/View.rb', line 24 def viewAddedTo(parent) end |