lib/Context/View.rb in context-0.0.16 vs lib/Context/View.rb in context-0.0.22
- old
+ new
@@ -10,40 +10,41 @@
def addView(view)
myWidget = getWidget()
if(myWidget != nil)
newWidget = view.getWidget()
if !newWidget.nil?
- myWidget.add(newWidget)
- newWidget.addedTo(myWidget)
+ myWidget.addToThisWidget(newWidget)
+ newWidget.widgetWasAddedTo(myWidget)
end
end
+ view.viewAddedTo(self)
end
+
+ # Override this method to do something when your view has been
+ # added to another view. Most useful for adding subviews
+ def viewAddedTo(parent)
+ end
def removeView(view)
+ view.removingViewFrom(self)
myWidget = getWidget()
if(myWidget != nil)
oldWidget = view.getWidget()
if !oldWidget.nil?
- myWidget.remove(oldWidget)
- oldWidget.removedFrom(myWidget)
+ myWidget.removeFromThisWidget(oldWidget)
+ oldWidget.widgetWasRemovedFrom(myWidget)
end
end
end
+
+ # Override this method to do something when your view being
+ # removed from another view. Most useful for removing subviews
+ def removingViewFrom(parent)
+ end
# Concrete classes should override this method
- def open
- end
-
- # Concrete classes should override this method
- def close
- end
-
- # Concrete classes should override this method
def getWidget
return nil
end
- def notifyKey(widget, key)
- @context.notifyKey(self, key)
- end
end
end