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.
19 #include "collection.h"
21 enum TabletDeviceType
{
22 TabletDeviceTypeMouse
,
23 TabletDeviceTypeStylus
,
33 /* @Namespace=System.Windows.Input */
34 class StylusInfo
: public DependencyObject
{
36 virtual ~StylusInfo () {}
39 /* @PropertyType=TabletDeviceType,DefaultValue=TabletDeviceTypeMouse,GenerateAccessors */
40 const static int DeviceTypeProperty
;
41 /* @PropertyType=bool,DefaultValue=false,GenerateAccessors */
42 const static int IsInvertedProperty
;
44 /* @ManagedAccess=Internal,GenerateCBinding,GeneratePInvoke */
45 StylusInfo () { SetObjectType (Type::STYLUSINFO
); }
50 void SetDeviceType (TabletDeviceType type
);
51 TabletDeviceType
GetDeviceType ();
53 void SetIsInverted (bool inverted
);
54 bool GetIsInverted ();
59 /* @ManagedDependencyProperties=Manual */ // It's a managed struct
60 /* @ManagedEvents=Manual */ // It's a managed struct
61 class StylusPoint
: public DependencyObject
{
63 virtual ~StylusPoint () {}
66 /* @PropertyType=double,DefaultValue=0.5,GenerateAccessors */
67 const static int PressureFactorProperty
;
68 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
69 const static int XProperty
;
70 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
71 const static int YProperty
;
73 /* @GenerateCBinding,GeneratePInvoke */
74 StylusPoint () { SetObjectType (Type::STYLUSPOINT
); }
79 /* @GenerateCBinding,GeneratePInvoke */
80 void SetPressureFactor (double factor
);
81 /* @GenerateCBinding,GeneratePInvoke */
82 double GetPressureFactor ();
84 /* @GenerateCBinding,GeneratePInvoke */
86 /* @GenerateCBinding,GeneratePInvoke */
89 /* @GenerateCBinding,GeneratePInvoke */
91 /* @GenerateCBinding,GeneratePInvoke */
96 /* @Namespace=System.Windows.Input */
97 class StylusPointCollection
: public DependencyObjectCollection
{
99 virtual bool CanAdd (Value
*value
);
101 virtual ~StylusPointCollection () {}
104 /* @GenerateCBinding,GeneratePInvoke */
105 StylusPointCollection () { SetObjectType (Type::STYLUSPOINT_COLLECTION
); }
107 virtual Type::Kind
GetElementType () { return Type::STYLUSPOINT
; }
109 /* @GenerateCBinding,GeneratePInvoke */
110 double AddStylusPoints (StylusPointCollection
*stylusPointCollection
);
115 /* @Namespace=System.Windows.Input */
116 class TouchDevice
: public DependencyObject
{
118 virtual ~TouchDevice () {}
121 /* @PropertyType=UIElement,ManagedSetterAccess=Internal,GenerateAccessors */
122 const static int DirectlyOverProperty
;
123 /* @PropertyType=gint32,ManagedSetterAccess=Internal,GenerateAccessors */
124 const static int IdProperty
;
126 /* @GenerateCBinding,GeneratePInvoke */
127 TouchDevice () { SetObjectType (Type::TOUCHDEVICE
); }
130 // Property Accessors
133 /* @GenerateCBinding,GeneratePInvoke */
134 void SetDirectlyOver (UIElement
*element
);
135 /* @GenerateCBinding,GeneratePInvoke */
136 UIElement
*GetDirectlyOver ();
138 /* @GenerateCBinding,GeneratePInvoke */
140 /* @GenerateCBinding,GeneratePInvoke */
144 /* @Namespace=System.Windows.Input */
145 class TouchPoint
: public DependencyObject
{
147 virtual ~TouchPoint () {}
150 /* @PropertyType=TouchAction,ManagedSetterAccess=Internal,GenerateAccessors */
151 const static int ActionProperty
;
152 /* @PropertyType=Point,ManagedSetterAccess=Internal,GenerateAccessors */
153 const static int PositionProperty
;
154 /* @PropertyType=Size,ManagedSetterAccess=Internal,GenerateAccessors */
155 const static int SizeProperty
;
156 /* @PropertyType=TouchDevice,ManagedSetterAccess=Internal,GenerateAccessors */
157 const static int TouchDeviceProperty
;
159 /* @GenerateCBinding,GeneratePInvoke */
160 TouchPoint () { SetObjectType (Type::TOUCHPOINT
); }
163 // Property Accessors
166 /* @GenerateCBinding,GeneratePInvoke */
167 void SetAction (TouchAction action
);
168 /* @GenerateCBinding,GeneratePInvoke */
169 TouchAction
GetAction ();
171 /* @GenerateCBinding,GeneratePInvoke */
172 void SetPosition (Point
*position
);
173 /* @GenerateCBinding,GeneratePInvoke */
174 Point
*GetPosition ();
176 /* @GenerateCBinding,GeneratePInvoke */
177 void SetSize (Size
*size
);
178 /* @GenerateCBinding,GeneratePInvoke */
181 /* @GenerateCBinding,GeneratePInvoke */
182 void SetTouchDevice (TouchDevice
*device
);
183 /* @GenerateCBinding,GeneratePInvoke */
184 TouchDevice
*GetTouchDevice ();
188 /* @Namespace=System.Windows.Input */
189 class TouchPointCollection
: public DependencyObjectCollection
{
191 virtual ~TouchPointCollection () {}
194 /* @GenerateCBinding,GeneratePInvoke */
195 TouchPointCollection () { SetObjectType (Type::TOUCHPOINT_COLLECTION
); }
197 virtual Type::Kind
GetElementType () { return Type::TOUCHPOINT
; }
201 /* @Namespace=System.Windows.Ink */
202 class DrawingAttributes
: public DependencyObject
{
204 virtual ~DrawingAttributes () {}
207 /* @PropertyType=Color,DefaultValue=Color (0xFF000000),ManagedFieldAccess=Private,GenerateAccessors */
208 const static int ColorProperty
;
209 /* @PropertyType=Color,DefaultValue=Color (0x00000000),ManagedFieldAccess=Private,GenerateAccessors */
210 const static int OutlineColorProperty
;
211 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
212 const static int HeightProperty
;
213 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
214 const static int WidthProperty
;
216 /* @GenerateCBinding,GeneratePInvoke */
217 DrawingAttributes () { SetObjectType (Type::DRAWINGATTRIBUTES
); }
219 void Render (cairo_t
*cr
, StylusPointCollection
*collection
);
220 static void RenderWithoutDrawingAttributes (cairo_t
*cr
, StylusPointCollection
*collection
);
223 // Property Accessors
225 void SetColor (Color
*color
);
228 void SetOutlineColor (Color
*color
);
229 Color
*GetOutlineColor ();
231 void SetHeight (double height
);
234 void SetWidth (double width
);
239 /* @Namespace=System.Windows.Ink */
240 class Stroke
: public DependencyObject
{
245 Rect
AddStylusPointToBounds (StylusPoint
*stylus_point
, const Rect
&bounds
);
246 void ComputeBounds ();
248 bool HitTestEndcapSegment (Point c
, double w
, double h
, Point p1
, Point p2
);
249 bool HitTestEndcapPoint (Point c
, double w
, double h
, Point p1
);
250 bool HitTestEndcap (Point p
, double w
, double h
, StylusPointCollection
*stylusPoints
);
252 bool HitTestSegmentSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
, Point p2
);
253 bool HitTestSegmentPoint (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
);
254 bool HitTestSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, StylusPointCollection
*stylusPoints
);
257 virtual ~Stroke () {}
260 /* @PropertyType=DrawingAttributes,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
261 const static int DrawingAttributesProperty
;
262 /* @PropertyType=StylusPointCollection,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
263 const static int StylusPointsProperty
;
265 /* @GenerateCBinding,GeneratePInvoke */
268 /* @GenerateCBinding,GeneratePInvoke */
269 bool HitTest (StylusPointCollection
*stylusPoints
);
271 Rect
GetOldBounds () { return old_bounds
; }
272 Rect
GetBounds () { return bounds
; }
274 void ResetDirty () { dirty
= Rect (); }
275 Rect
GetDirty () { return dirty
; }
277 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
278 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
279 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
280 virtual void OnSubPropertyChanged (DependencyProperty
*prop
, DependencyObject
*obj
, PropertyChangedEventArgs
*subobj_args
);
283 // Property Accessors
285 void SetDrawingAttributes (DrawingAttributes
*attrs
);
286 DrawingAttributes
*GetDrawingAttributes ();
288 void SetStylusPoints (StylusPointCollection
*points
);
289 StylusPointCollection
*GetStylusPoints ();
293 /* @Namespace=System.Windows.Ink */
294 class StrokeCollection
: public DependencyObjectCollection
{
296 virtual bool CanAdd (Value
*value
);
298 virtual ~StrokeCollection () {}
301 /* @GenerateCBinding,GeneratePInvoke */
302 StrokeCollection () { SetObjectType (Type::STROKE_COLLECTION
); }
304 virtual Type::Kind
GetElementType () { return Type::STROKE
; }
306 virtual bool AddedToCollection (Value
*value
, MoonError
*error
);
308 /* @GenerateCBinding,GeneratePInvoke */
309 StrokeCollection
*HitTest (StylusPointCollection
*stylusPoints
);
315 /* @Namespace=System.Windows.Controls */
316 class InkPresenter
: public Canvas
{
320 virtual ~InkPresenter () {}
322 virtual void PostRender (cairo_t
*cr
, Region
*region
, bool front_to_back
);
325 /* @PropertyType=StrokeCollection,AutoCreateValue,GenerateAccessors */
326 const static int StrokesProperty
;
328 /* @GenerateCBinding,GeneratePInvoke */
331 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
332 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
333 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
335 virtual void ComputeBounds ();
337 virtual Rect
GetRenderBounds ();
339 virtual void ShiftPosition (Point p
);
342 // Property Accessors
344 void SetStrokes (StrokeCollection
*strokes
);
345 StrokeCollection
*GetStrokes ();
351 /* @GeneratePInvoke */
352 void stroke_get_bounds (Stroke
*stroke
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
353 /* @GeneratePInvoke */
354 void stroke_collection_get_bounds (StrokeCollection
*collection
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
358 #endif /* __STYLUS_H__ */