Author: miguel
Date: 2007-06-14 13:39:20 -0400 (Thu, 14 Jun 2007)
New Revision: 79584

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/animation.cpp
   trunk/moon/src/clock.h
   trunk/moon/src/runtime.cpp
   trunk/moon/src/runtime.h
Log:
2007-06-14  Miguel de Icaza  <[EMAIL PROTECTED]>

        * runtime.cpp (Canvas): Implement OnChildPropertyChanged so we can
        catch cases of Top/Left being set on a child, this makes changes
        to the object after it has been created (adding/removing the
        property) work. 




Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-06-14 17:37:00 UTC (rev 79583)
+++ trunk/moon/src/ChangeLog    2007-06-14 17:39:20 UTC (rev 79584)
@@ -1,3 +1,10 @@
+2007-06-14  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * runtime.cpp (Canvas): Implement OnChildPropertyChanged so we can
+       catch cases of Top/Left being set on a child, this makes changes
+       to the object after it has been created (adding/removing the
+       property) work. 
+
 2007-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * brush.cpp|h: Much closer results for RadialGradients (but I still

Modified: trunk/moon/src/animation.cpp
===================================================================
--- trunk/moon/src/animation.cpp        2007-06-14 17:37:00 UTC (rev 79583)
+++ trunk/moon/src/animation.cpp        2007-06-14 17:39:20 UTC (rev 79584)
@@ -155,6 +155,7 @@
        // Timeline A is a child of TimelineGroup B, then Clock cA
        // will be a child of ClockGroup cB.
        root_clock = CreateClock ();
+       base_ref (root_clock);
 
        // walk the clock tree hooking up the correct properties and
        // creating AnimationStorage's for AnimationClocks.
@@ -258,9 +259,10 @@
 
 Storyboard::~Storyboard ()
 {
+       printf ("Clock %p (ref=%d)\n", root_clock, root_clock->refcount);
        Stop ();
        TimeManager::Instance()->RemoveChild (root_clock);
-       printf ("Unrefing %p\n", root_clock);
+       printf ("Unrefing Clock %p (ref=%d)\n", root_clock, 
root_clock->refcount);
        base_unref (root_clock);
 }
 

Modified: trunk/moon/src/clock.h
===================================================================
--- trunk/moon/src/clock.h      2007-06-14 17:37:00 UTC (rev 79583)
+++ trunk/moon/src/clock.h      2007-06-14 17:39:20 UTC (rev 79584)
@@ -177,6 +177,8 @@
 
 class Clock : public DependencyObject {
  public:
+       ~Clock () {  }
+       
        // events to queue up
        enum {
                CURRENT_GLOBAL_SPEED_INVALIDATED = 0x01,

Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp  2007-06-14 17:37:00 UTC (rev 79583)
+++ trunk/moon/src/runtime.cpp  2007-06-14 17:39:20 UTC (rev 79584)
@@ -933,6 +933,24 @@
        printf ("Prop %s changed in %s\n", prop->name, subprop->name);
 }
 
+bool
+Canvas::OnChildPropertyChanged (DependencyProperty *prop, DependencyObject 
*child)
+{
+       if (prop == TopProperty || prop == LeftProperty){
+               //
+               // Technically the canvas cares about Visuals, but we cant do 
much
+               // with them, all the logic to relayout is in UIElement
+               //
+               if (!Type::Find (child->GetObjectType ())->IsSubclassOf 
(Value::UIELEMENT)){
+                       printf ("Child %d is not a UIELEMENT\n");
+                       return FALSE;
+               }
+               UIElement *ui = (UIElement *) child;
+               ui->FullInvalidate (true);
+       }
+       return FALSE;
+}
+
 void 
 Canvas::handle_motion (Surface *s, int state, double x, double y)
 {
@@ -1537,12 +1555,15 @@
        if (!scope)
                scope = global_NameScope;
 
+       printf ("Looking up in scope %p (Global=%p)\n", scope, 
global_NameScope);
        return scope->FindName (name);
 }
 
 DependencyObject *
 dependency_object_find_name (DependencyObject *obj, const char *name, 
Value::Kind *element_kind)
 {
+       printf ("Looking up in %p the string %p\n", obj, name);
+       printf ("        String: %s\n", name);
        DependencyObject *ret = obj->FindName (name);
 
        if (ret == NULL)

Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h    2007-06-14 17:37:00 UTC (rev 79583)
+++ trunk/moon/src/runtime.h    2007-06-14 17:39:20 UTC (rev 79584)
@@ -235,6 +235,16 @@
 
        virtual void OnPropertyChanged (DependencyProperty *property) {}
        virtual void OnSubPropertyChanged (DependencyProperty *prop, 
DependencyProperty *subprop) { }
+
+       //
+       // OnChildPropertyChanged:
+       //    This is raised on objects when a child of this object has had one 
of its
+       //    properties changed.   This is used so that owning objects can 
monitor if
+       //    one of the attached properties in a child must be acted upon
+       //
+       //    This code will go up in the ownership chain until this is 
handled, by 
+       //    returning TRUE.
+       //
        virtual bool OnChildPropertyChanged (DependencyProperty *prop, 
DependencyObject *child) { return FALSE; }
        
        virtual Value::Kind GetObjectType ();
@@ -784,7 +794,8 @@
        virtual void handle_motion (Surface *s, int state, double x, double y);
        
        virtual void OnSubPropertyChanged (DependencyProperty *prop, 
DependencyProperty *subprop);
-
+       virtual bool OnChildPropertyChanged (DependencyProperty *prop, 
DependencyObject *child);
+       
        static DependencyProperty* TopProperty;
        static DependencyProperty* LeftProperty;
 };

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to