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 Point
*local_offset
= GetVisualOffset (element
);
28 Rect relative
= *GetLayoutSlot (element
);
29 offset
= offset
+ *local_offset
;
30 relative
.x
-= offset
.x
;
31 relative
.y
-= offset
.y
;
32 relative
= relative
.GrowBy (-*element
->GetMargin ());
34 composite
= composite
.Intersection (relative
);
39 element
= (FrameworkElement
*)element
->GetVisualParent ();
41 if (element
&& (element
->Is (Type::CANVAS
) || element
->Is (Type::USERCONTROL
)))
45 if (isinf (composite
.width
))
48 RectangleGeometry
*geom
= new RectangleGeometry ();
49 geom
->SetRect (&composite
);