1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * layoutinformation.cpp
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
10 #include "frameworkelement.h"
16 LayoutInformation::GetClip (FrameworkElement
*item
)
18 FrameworkElement
*element
= item
;
19 Point offset
= Point (0,0);
20 Rect
composite (0,0,INFINITY
, INFINITY
);
23 Geometry
*clip
= GetLayoutClip (element
);
25 if (clip
&& clip
->Is (Type::RECTANGLEGEOMETRY
)) {
26 Rect relative
= *((RectangleGeometry
*)clip
)->GetRect ();
27 relative
.x
-= offset
.x
;
28 relative
.y
-= offset
.y
;
30 composite
= composite
.Intersection (relative
);
33 Point
*local_offset
= GetVisualOffset (element
);
35 offset
.x
+= local_offset
->x
;
36 offset
.y
+= local_offset
->y
;
38 } while ((element
= (FrameworkElement
*)element
->GetVisualParent ()));
40 if (isinf (composite
.width
) || isinf (composite
.height
))
43 RectangleGeometry
*geom
= new RectangleGeometry ();
44 geom
->SetRect (&composite
);