1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
13 #ifndef __TRANSFORM_H__
14 #define __TRANSFORM_H__
19 #include "collection.h"
21 /* @Namespace=System.Windows.Media */
22 class GeneralTransform
: public DependencyObject
{
24 cairo_matrix_t _matrix
;
27 virtual ~GeneralTransform () {};
29 virtual void UpdateTransform ();
30 void MaybeUpdateTransform ();
33 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
34 GeneralTransform () : need_update (true) { SetObjectType (Type::GENERALTRANSFORM
); }
36 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
38 virtual void GetTransform (cairo_matrix_t
*value
);
40 /* @GenerateCBinding,GeneratePInvoke */
43 Point
Transform (Point point
);
47 /* @Namespace=System.Windows.Media */
48 class Transform
: public GeneralTransform
{
50 virtual ~Transform () {}
53 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
54 Transform () { SetObjectType (Type::TRANSFORM
); }
58 /* @Namespace=System.Windows.Media */
59 class RotateTransform
: public Transform
{
61 virtual ~RotateTransform () {}
62 virtual void UpdateTransform ();
65 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
66 const static int AngleProperty
;
67 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
68 const static int CenterXProperty
;
69 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
70 const static int CenterYProperty
;
72 /* @GenerateCBinding,GeneratePInvoke */
73 RotateTransform () { SetObjectType (Type::ROTATETRANSFORM
); }
78 void SetAngle (double angle
);
81 void SetCenterX (double centerX
);
84 void SetCenterY (double centerY
);
89 /* @Namespace=System.Windows.Media */
90 class TranslateTransform
: public Transform
{
92 virtual ~TranslateTransform () { }
93 virtual void UpdateTransform ();
96 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
97 const static int XProperty
;
98 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
99 const static int YProperty
;
101 /* @GenerateCBinding,GeneratePInvoke */
102 TranslateTransform () { SetObjectType (Type::TRANSLATETRANSFORM
); }
105 // Property Accessors
107 void SetX (double x
);
110 void SetY (double y
);
115 /* @Namespace=System.Windows.Media */
116 class ScaleTransform
: public Transform
{
118 virtual ~ScaleTransform () {}
119 virtual void UpdateTransform ();
122 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
123 const static int CenterXProperty
;
124 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
125 const static int CenterYProperty
;
126 /* @PropertyType=double,DefaultValue=1.0,GenerateAccessors */
127 const static int ScaleXProperty
;
128 /* @PropertyType=double,DefaultValue=1.0,GenerateAccessors */
129 const static int ScaleYProperty
;
131 /* @GenerateCBinding,GeneratePInvoke */
132 ScaleTransform () { SetObjectType (Type::SCALETRANSFORM
); }
135 // Property Accessors
137 void SetCenterX (double centerX
);
138 double GetCenterX ();
140 void SetCenterY (double centerY
);
141 double GetCenterY ();
143 void SetScaleX (double scaleX
);
146 void SetScaleY (double scaleY
);
151 /* @Namespace=System.Windows.Media */
152 class SkewTransform
: public Transform
{
154 virtual ~SkewTransform () {}
155 virtual void UpdateTransform ();
158 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
159 const static int AngleXProperty
;
160 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
161 const static int AngleYProperty
;
162 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
163 const static int CenterXProperty
;
164 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
165 const static int CenterYProperty
;
167 /* @GenerateCBinding,GeneratePInvoke */
168 SkewTransform () { SetObjectType (Type::SKEWTRANSFORM
); }
171 // Property Accessors
173 void SetAngleX (double angleX
);
176 void SetAngleY (double angleY
);
179 void SetCenterX (double centerX
);
180 double GetCenterX ();
182 void SetCenterY (double centerY
);
183 double GetCenterY ();
187 /* @Namespace=None */ // The managed Matrix is a struct
188 /* @ManagedDependencyProperties=Manual */
189 /* @ManagedEvents=None */
190 class Matrix
: public DependencyObject
{
191 cairo_matrix_t matrix
;
194 virtual ~Matrix () {}
197 /* @PropertyType=double,DefaultValue=1.0,GenerateAccessors */
198 const static int M11Property
;
199 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
200 const static int M12Property
;
201 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
202 const static int M21Property
;
203 /* @PropertyType=double,DefaultValue=1.0,GenerateAccessors */
204 const static int M22Property
;
205 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
206 const static int OffsetXProperty
;
207 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
208 const static int OffsetYProperty
;
210 /* @GenerateCBinding,GeneratePInvoke */
212 Matrix (cairo_matrix_t
*m
);
214 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
216 cairo_matrix_t
GetUnderlyingMatrix ();
218 /* @GenerateCBinding,GeneratePInvoke */
219 cairo_matrix_t
*GetMatrixValues () { return &matrix
; }
222 // Property Accessors
224 void SetM11 (double m11
);
227 void SetM12 (double m12
);
230 void SetM21 (double m21
);
233 void SetM22 (double m22
);
236 void SetOffsetX (double offsetX
);
237 double GetOffsetX ();
239 void SetOffsetY (double offsetY
);
240 double GetOffsetY ();
243 /* @Namespace=System.Windows.Media */
244 // this type does not really exists - its purpose is to let the unmanaged (1.x) matrix be a dependency object
245 // and the later (2.x) managed code use a struct (non-DO) for the matrix
246 class UnmanagedMatrix
: public Matrix
{
249 virtual ~UnmanagedMatrix () {}
252 /* @GenerateCBinding,GeneratePInvoke */
253 UnmanagedMatrix () { SetObjectType (Type::UNMANAGEDMATRIX
); }
256 /* @Namespace=System.Windows.Media */
257 class MatrixTransform
: public Transform
{
259 virtual ~MatrixTransform () {}
261 virtual void UpdateTransform ();
264 /* @PropertyType=Matrix,GenerateAccessors */
265 const static int MatrixProperty
;
267 /* @GenerateCBinding,GeneratePInvoke */
268 MatrixTransform () { SetObjectType (Type::MATRIXTRANSFORM
); }
270 virtual void OnSubPropertyChanged (DependencyProperty
*prop
, DependencyObject
*obj
, PropertyChangedEventArgs
*subobj_args
);
273 // Property Accessors
275 void SetMatrix (Matrix
*matrix
);
276 Matrix
*GetMatrix ();
280 /* @Namespace=System.Windows.Media */
281 class TransformCollection
: public DependencyObjectCollection
{
283 virtual ~TransformCollection () {}
286 /* @GenerateCBinding,GeneratePInvoke */
287 TransformCollection () { SetObjectType (Type::TRANSFORM_COLLECTION
); }
289 virtual Type::Kind
GetElementType () { return Type::TRANSFORM
; }
293 /* @ContentProperty="Children" */
294 /* @Namespace=System.Windows.Media */
295 class TransformGroup
: public Transform
{
297 virtual ~TransformGroup () {}
299 virtual void UpdateTransform ();
302 /* @PropertyType=TransformCollection,AutoCreateValue,GenerateAccessors */
303 const static int ChildrenProperty
;
305 /* @GenerateCBinding,GeneratePInvoke */
308 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
309 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
310 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
313 // Property Accessors
315 void SetChildren (TransformCollection
*children
);
316 TransformCollection
*GetChildren ();
322 /* @GeneratePInvoke */
323 void general_transform_transform_point (GeneralTransform
*t
, /* @MarshalAs=Point,IsRef */ Point
*p
, /* @MarshalAs=Point,IsRef */ Point
*r
);