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
,
28 /* @Namespace=System.Windows.Input */
29 class StylusInfo
: public DependencyObject
{
31 virtual ~StylusInfo () {}
34 /* @PropertyType=TabletDeviceType,ManagedPropertyType=int,DefaultValue=TabletDeviceTypeMouse,GenerateAccessors */
35 const static int DeviceTypeProperty
;
36 /* @PropertyType=bool,DefaultValue=false,GenerateAccessors */
37 const static int IsInvertedProperty
;
39 /* @ManagedAccess=Internal,GenerateCBinding,GeneratePInvoke */
40 StylusInfo () { SetObjectType (Type::STYLUSINFO
); }
45 void SetDeviceType (TabletDeviceType type
);
46 TabletDeviceType
GetDeviceType ();
48 void SetIsInverted (bool inverted
);
49 bool GetIsInverted ();
54 /* @ManagedDependencyProperties=Manual */ // It's a managed struct
55 /* @ManagedEvents=Manual */ // It's a managed struct
56 class StylusPoint
: public DependencyObject
{
58 virtual ~StylusPoint () {}
61 /* @PropertyType=double,DefaultValue=0.5,GenerateAccessors */
62 const static int PressureFactorProperty
;
63 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
64 const static int XProperty
;
65 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
66 const static int YProperty
;
68 /* @GenerateCBinding,GeneratePInvoke */
69 StylusPoint () { SetObjectType (Type::STYLUSPOINT
); }
74 /* @GenerateCBinding,GeneratePInvoke */
75 void SetPressureFactor (double factor
);
76 /* @GenerateCBinding,GeneratePInvoke */
77 double GetPressureFactor ();
79 /* @GenerateCBinding,GeneratePInvoke */
81 /* @GenerateCBinding,GeneratePInvoke */
84 /* @GenerateCBinding,GeneratePInvoke */
86 /* @GenerateCBinding,GeneratePInvoke */
91 /* @Namespace=System.Windows.Input */
92 class StylusPointCollection
: public DependencyObjectCollection
{
94 virtual bool CanAdd (Value
*value
);
96 virtual ~StylusPointCollection () {}
99 /* @GenerateCBinding,GeneratePInvoke */
100 StylusPointCollection () { SetObjectType (Type::STYLUSPOINT_COLLECTION
); }
102 virtual Type::Kind
GetElementType () { return Type::STYLUSPOINT
; }
104 /* @GenerateCBinding,GeneratePInvoke */
105 double AddStylusPoints (StylusPointCollection
*stylusPointCollection
);
111 /* @Namespace=System.Windows.Ink */
112 class DrawingAttributes
: public DependencyObject
{
114 virtual ~DrawingAttributes () {}
117 /* @PropertyType=Color,DefaultValue=Color (0xFF000000),ManagedFieldAccess=Private,GenerateAccessors */
118 const static int ColorProperty
;
119 /* @PropertyType=Color,DefaultValue=Color (0x00000000),ManagedFieldAccess=Private,GenerateAccessors */
120 const static int OutlineColorProperty
;
121 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
122 const static int HeightProperty
;
123 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
124 const static int WidthProperty
;
126 /* @GenerateCBinding,GeneratePInvoke */
127 DrawingAttributes () { SetObjectType (Type::DRAWINGATTRIBUTES
); }
129 void Render (cairo_t
*cr
, StylusPointCollection
*collection
);
130 static void RenderWithoutDrawingAttributes (cairo_t
*cr
, StylusPointCollection
*collection
);
133 // Property Accessors
135 void SetColor (Color
*color
);
138 void SetOutlineColor (Color
*color
);
139 Color
*GetOutlineColor ();
141 void SetHeight (double height
);
144 void SetWidth (double width
);
149 /* @Namespace=System.Windows.Ink */
150 class Stroke
: public DependencyObject
{
155 Rect
AddStylusPointToBounds (StylusPoint
*stylus_point
, const Rect
&bounds
);
156 void ComputeBounds ();
158 bool HitTestEndcapSegment (Point c
, double w
, double h
, Point p1
, Point p2
);
159 bool HitTestEndcapPoint (Point c
, double w
, double h
, Point p1
);
160 bool HitTestEndcap (Point p
, double w
, double h
, StylusPointCollection
*stylusPoints
);
162 bool HitTestSegmentSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
, Point p2
);
163 bool HitTestSegmentPoint (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
);
164 bool HitTestSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, StylusPointCollection
*stylusPoints
);
167 virtual ~Stroke () {}
170 /* @PropertyType=DrawingAttributes,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
171 const static int DrawingAttributesProperty
;
172 /* @PropertyType=StylusPointCollection,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
173 const static int StylusPointsProperty
;
175 /* @GenerateCBinding,GeneratePInvoke */
178 /* @GenerateCBinding,GeneratePInvoke */
179 bool HitTest (StylusPointCollection
*stylusPoints
);
181 Rect
GetOldBounds () { return old_bounds
; }
182 Rect
GetBounds () { return bounds
; }
184 void ResetDirty () { dirty
= Rect (); }
185 Rect
GetDirty () { return dirty
; }
187 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
188 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
189 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
190 virtual void OnSubPropertyChanged (DependencyProperty
*prop
, DependencyObject
*obj
, PropertyChangedEventArgs
*subobj_args
);
193 // Property Accessors
195 void SetDrawingAttributes (DrawingAttributes
*attrs
);
196 DrawingAttributes
*GetDrawingAttributes ();
198 void SetStylusPoints (StylusPointCollection
*points
);
199 StylusPointCollection
*GetStylusPoints ();
203 /* @Namespace=System.Windows.Ink */
204 class StrokeCollection
: public DependencyObjectCollection
{
206 virtual bool CanAdd (Value
*value
);
208 virtual ~StrokeCollection () {}
211 /* @GenerateCBinding,GeneratePInvoke */
212 StrokeCollection () { SetObjectType (Type::STROKE_COLLECTION
); }
214 virtual Type::Kind
GetElementType () { return Type::STROKE
; }
216 virtual bool AddedToCollection (Value
*value
, MoonError
*error
);
218 /* @GenerateCBinding,GeneratePInvoke */
219 StrokeCollection
*HitTest (StylusPointCollection
*stylusPoints
);
225 /* @Namespace=System.Windows.Controls */
226 class InkPresenter
: public Canvas
{
230 virtual ~InkPresenter () {}
232 virtual void PostRender (cairo_t
*cr
, Region
*region
, bool front_to_back
);
235 /* @PropertyType=StrokeCollection,AutoCreateValue,GenerateAccessors */
236 const static int StrokesProperty
;
238 /* @GenerateCBinding,GeneratePInvoke */
241 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
242 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
243 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
245 virtual void ComputeBounds ();
247 virtual Rect
GetRenderBounds ();
249 virtual void ShiftPosition (Point p
);
252 // Property Accessors
254 void SetStrokes (StrokeCollection
*strokes
);
255 StrokeCollection
*GetStrokes ();
261 /* @GeneratePInvoke */
262 void stroke_get_bounds (Stroke
*stroke
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
263 /* @GeneratePInvoke */
264 void stroke_collection_get_bounds (StrokeCollection
*collection
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
268 #endif /* __STYLUS_H__ */