Author: rolf
Date: 2007-12-05 04:32:12 -0500 (Wed, 05 Dec 2007)
New Revision: 90739
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/collection.cpp
trunk/moon/src/control.cpp
trunk/moon/src/dirty.cpp
trunk/moon/src/uielement.cpp
trunk/moon/src/uielement.h
trunk/moon/src/visual.h
Log:
* uielement.h, visual.h, uielement.cpp, collection.cpp, control.cpp,
dirty.cpp: Move UIElement::parent to Visual, rename it to
visual_parent, and make it a real property with accessors.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/ChangeLog 2007-12-05 09:32:12 UTC (rev 90739)
@@ -1,5 +1,11 @@
2007-12-05 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+ * uielement.h, visual.h, uielement.cpp, collection.cpp, control.cpp,
+ dirty.cpp: Move UIElement::parent to Visual, rename it to
visual_parent,
+ and make it a real property with accessors.
+
+2007-12-05 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
* xaml.cpp, dependencyobject.h, collection.cpp, dependencyobject.cpp,
animation.cpp: Rename DependencyObject::parent/SetParent/GetParent to
logical_parent/SetLogicalParent/GetLogicalParent.
Modified: trunk/moon/src/collection.cpp
===================================================================
--- trunk/moon/src/collection.cpp 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/collection.cpp 2007-12-05 09:32:12 UTC (rev 90739)
@@ -444,7 +444,7 @@
if (panel == NULL)
return;
- item->parent = panel;
+ item->SetVisualParent (panel);
item->UpdateTransform ();
item->UpdateTotalOpacity ();
item->UpdateTotalRenderVisibility ();
@@ -460,7 +460,7 @@
item->SetSurface (NULL);
- if (item->parent == NULL)
+ if (item->GetVisualParent () == NULL)
return;
// we can't just call item->Invalidate() here, since dirty.cpp
@@ -469,8 +469,8 @@
// bounds of the child (which is likely suboptimal,
// considering panels without backgrounds might have a more
// optimized region we can redraw).
- item->parent->Invalidate (item->GetSubtreeBounds());
- item->parent = NULL;
+ item->GetVisualParent ()->Invalidate (item->GetSubtreeBounds());
+ item->SetVisualParent (NULL);
}
bool
Modified: trunk/moon/src/control.cpp
===================================================================
--- trunk/moon/src/control.cpp 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/control.cpp 2007-12-05 09:32:12 UTC (rev 90739)
@@ -164,12 +164,12 @@
return NULL;
if (real_object){
- real_object->parent = NULL;
+ real_object->SetVisualParent (NULL);
base_unref (real_object);
}
real_object = (FrameworkElement *) element;
- real_object->parent = this;
+ real_object->SetVisualParent (this);
real_object->Attach (NULL,this);
real_object->UpdateTotalOpacity ();
Modified: trunk/moon/src/dirty.cpp
===================================================================
--- trunk/moon/src/dirty.cpp 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/dirty.cpp 2007-12-05 09:32:12 UTC (rev 90739)
@@ -259,20 +259,20 @@
// el->GetBounds().x, el->GetBounds().y,
el->GetBounds().w, el->GetBounds().h);
if (osubtreebounds != el->GetSubtreeBounds ()) {
- if (el->parent) {
- el->parent->UpdateBounds ();
+ if (el->GetVisualParent ()) {
+ el->GetVisualParent ()->UpdateBounds ();
parent_bounds_updated = true;
}
}
if (obounds != el->GetBounds()) {
- if (el->parent) {
+ if (el->GetVisualParent ()) {
// printf (" + + + calling
UpdateBounds and Invalidate on parent\n");
if (!parent_bounds_updated)
- el->parent->UpdateBounds();
+ el->GetVisualParent
()->UpdateBounds();
Region oregion = Region (obounds);
- el->parent->Invalidate (&oregion);
+ el->GetVisualParent ()->Invalidate
(&oregion);
}
el->Invalidate ();
}
Modified: trunk/moon/src/uielement.cpp
===================================================================
--- trunk/moon/src/uielement.cpp 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/uielement.cpp 2007-12-05 09:32:12 UTC (rev 90739)
@@ -52,7 +52,7 @@
g_warning ("GetTransformFor called on a non-container, you must
implement this in your container\n");
}
-UIElement::UIElement () : opacityMask(NULL), parent(NULL), flags
(UIElement::RENDER_VISIBLE | UIElement::HIT_TEST_VISIBLE)
+UIElement::UIElement () : opacityMask(NULL), flags (UIElement::RENDER_VISIBLE
| UIElement::HIT_TEST_VISIBLE)
{
bounds = Rect (0,0,0,0);
cairo_matrix_init_identity (&absolute_xform);
@@ -198,7 +198,7 @@
if (obj == NULL)
return 0;
- int n = DumpHierarchy (obj->parent);
+ int n = DumpHierarchy (obj->GetVisualParent ());
for (int i = 0; i < n; i++)
putchar (' ');
printf ("%s (%p)\n", obj->GetTypeName(), obj);
@@ -227,23 +227,23 @@
void
UIElement::ComputeTotalOpacity ()
{
- if (parent)
- parent->ComputeTotalOpacity ();
+ if (GetVisualParent ())
+ GetVisualParent ()->ComputeTotalOpacity ();
double local_opacity = GetValue (OpacityProperty)->AsDouble();
- total_opacity = local_opacity * (parent ? parent->GetTotalOpacity () :
1.0);
+ total_opacity = local_opacity * (GetVisualParent () ? GetVisualParent
()->GetTotalOpacity () : 1.0);
}
void
UIElement::ComputeTotalRenderVisibility ()
{
- if (parent)
- parent->ComputeTotalRenderVisibility ();
+ if (GetVisualParent ())
+ GetVisualParent ()->ComputeTotalRenderVisibility ();
bool visible = (flags & UIElement::RENDER_VISIBLE) != 0;
- if (parent)
- visible = visible && parent->GetRenderVisible ();
+ if (GetVisualParent ())
+ visible = visible && GetVisualParent ()->GetRenderVisible ();
if (visible)
flags |= UIElement::TOTAL_RENDER_VISIBLE;
@@ -254,13 +254,13 @@
void
UIElement::ComputeTotalHitTestVisibility ()
{
- if (parent)
- parent->ComputeTotalHitTestVisibility ();
+ if (GetVisualParent ())
+ GetVisualParent ()->ComputeTotalHitTestVisibility ();
bool visible = (flags & UIElement::HIT_TEST_VISIBLE) != 0;
- if (parent)
- visible = visible && parent->GetHitTestVisible ();
+ if (GetVisualParent ())
+ visible = visible && GetVisualParent ()->GetHitTestVisible ();
if (visible)
flags |= UIElement::TOTAL_HIT_TEST_VISIBLE;
@@ -280,8 +280,8 @@
uielement_get_render_affine (this, &local_transform);
transform_origin = GetTransformOrigin ();
- if (parent != NULL)
- parent->GetTransformFor (this, &parent_transform);
+ if (GetVisualParent () != NULL)
+ GetVisualParent ()->GetTransformFor (this, &parent_transform);
else
cairo_matrix_init_identity (&parent_transform);
}
@@ -289,8 +289,8 @@
void
UIElement::ComputeTransform ()
{
- if (parent != NULL)
- absolute_xform = parent->absolute_xform;
+ if (GetVisualParent () != NULL)
+ absolute_xform = GetVisualParent ()->absolute_xform;
else
cairo_matrix_init_identity (&absolute_xform);
@@ -749,7 +749,7 @@
UIElement *
uielement_get_parent (UIElement *item)
{
- return item->parent;
+ return item->GetVisualParent ();
}
bool
Modified: trunk/moon/src/uielement.h
===================================================================
--- trunk/moon/src/uielement.h 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/uielement.h 2007-12-05 09:32:12 UTC (rev 90739)
@@ -44,8 +44,6 @@
virtual ~UIElement ();
virtual Type::Kind GetObjectType () { return Type::UIELEMENT; };
- UIElement *parent;
-
int dirty_flags;
List::Node *up_dirty_node;
List::Node *down_dirty_node;
Modified: trunk/moon/src/visual.h
===================================================================
--- trunk/moon/src/visual.h 2007-12-05 09:29:09 UTC (rev 90738)
+++ trunk/moon/src/visual.h 2007-12-05 09:32:12 UTC (rev 90739)
@@ -17,7 +17,7 @@
class Visual : public DependencyObject {
public:
- Visual () : surface (NULL) {};
+ Visual () : surface (NULL), visual_parent (NULL) {};
virtual Type::Kind GetObjectType () { return Type::VISUAL; };
//
@@ -28,8 +28,12 @@
virtual Surface *GetSurface () { return surface; }
virtual void SetSurface (Surface *surface);
+
+ void SetVisualParent (UIElement* visual_parent) { this->visual_parent =
visual_parent; }
+ UIElement* GetVisualParent () { return visual_parent; }
private:
Surface* surface;
+ UIElement *visual_parent;
};
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches