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 class StylusPoint
: public DependencyObject
{
57 virtual ~StylusPoint () {}
60 /* @PropertyType=double,DefaultValue=0.5,GenerateAccessors */
61 const static int PressureFactorProperty
;
62 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
63 const static int XProperty
;
64 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
65 const static int YProperty
;
67 /* @GenerateCBinding,GeneratePInvoke */
68 StylusPoint () { SetObjectType (Type::STYLUSPOINT
); }
73 /* @GenerateCBinding,GeneratePInvoke */
74 void SetPressureFactor (double factor
);
75 /* @GenerateCBinding,GeneratePInvoke */
76 double GetPressureFactor ();
78 /* @GenerateCBinding,GeneratePInvoke */
80 /* @GenerateCBinding,GeneratePInvoke */
83 /* @GenerateCBinding,GeneratePInvoke */
85 /* @GenerateCBinding,GeneratePInvoke */
90 /* @Namespace=System.Windows.Input */
91 class StylusPointCollection
: public DependencyObjectCollection
{
93 virtual bool CanAdd (Value
*value
);
95 virtual ~StylusPointCollection () {}
98 /* @GenerateCBinding,GeneratePInvoke */
99 StylusPointCollection () { SetObjectType (Type::STYLUSPOINT_COLLECTION
); }
101 virtual Type::Kind
GetElementType () { return Type::STYLUSPOINT
; }
103 /* @GenerateCBinding,GeneratePInvoke */
104 double AddStylusPoints (StylusPointCollection
*stylusPointCollection
);
110 /* @Namespace=System.Windows.Ink */
111 class DrawingAttributes
: public DependencyObject
{
113 virtual ~DrawingAttributes () {}
116 /* @PropertyType=Color,DefaultValue=Color (0xFF000000),ManagedFieldAccess=Private,GenerateAccessors */
117 const static int ColorProperty
;
118 /* @PropertyType=Color,DefaultValue=Color (0x00000000),ManagedFieldAccess=Private,GenerateAccessors */
119 const static int OutlineColorProperty
;
120 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
121 const static int HeightProperty
;
122 /* @PropertyType=double,DefaultValue=3.0,ManagedFieldAccess=Private,GenerateAccessors */
123 const static int WidthProperty
;
125 /* @GenerateCBinding,GeneratePInvoke */
126 DrawingAttributes () { SetObjectType (Type::DRAWINGATTRIBUTES
); }
128 void Render (cairo_t
*cr
, StylusPointCollection
*collection
);
129 static void RenderWithoutDrawingAttributes (cairo_t
*cr
, StylusPointCollection
*collection
);
132 // Property Accessors
134 void SetColor (Color
*color
);
137 void SetOutlineColor (Color
*color
);
138 Color
*GetOutlineColor ();
140 void SetHeight (double height
);
143 void SetWidth (double width
);
148 /* @Namespace=System.Windows.Ink */
149 class Stroke
: public DependencyObject
{
154 Rect
AddStylusPointToBounds (StylusPoint
*stylus_point
, const Rect
&bounds
);
155 void ComputeBounds ();
157 bool HitTestEndcapSegment (Point c
, double w
, double h
, Point p1
, Point p2
);
158 bool HitTestEndcapPoint (Point c
, double w
, double h
, Point p1
);
159 bool HitTestEndcap (Point p
, double w
, double h
, StylusPointCollection
*stylusPoints
);
161 bool HitTestSegmentSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
, Point p2
);
162 bool HitTestSegmentPoint (Point stroke_p1
, Point stroke_p2
, double w
, double h
, Point p1
);
163 bool HitTestSegment (Point stroke_p1
, Point stroke_p2
, double w
, double h
, StylusPointCollection
*stylusPoints
);
166 virtual ~Stroke () {}
169 /* @PropertyType=DrawingAttributes,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
170 const static int DrawingAttributesProperty
;
171 /* @PropertyType=StylusPointCollection,AutoCreateValue,ManagedFieldAccess=Private,GenerateAccessors */
172 const static int StylusPointsProperty
;
174 /* @GenerateCBinding,GeneratePInvoke */
177 /* @GenerateCBinding,GeneratePInvoke */
178 bool HitTest (StylusPointCollection
*stylusPoints
);
180 Rect
GetOldBounds () { return old_bounds
; }
181 Rect
GetBounds () { return bounds
; }
183 void ResetDirty () { dirty
= Rect (); }
184 Rect
GetDirty () { return dirty
; }
186 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
187 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
188 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
189 virtual void OnSubPropertyChanged (DependencyProperty
*prop
, DependencyObject
*obj
, PropertyChangedEventArgs
*subobj_args
);
192 // Property Accessors
194 void SetDrawingAttributes (DrawingAttributes
*attrs
);
195 DrawingAttributes
*GetDrawingAttributes ();
197 void SetStylusPoints (StylusPointCollection
*points
);
198 StylusPointCollection
*GetStylusPoints ();
202 /* @Namespace=System.Windows.Ink */
203 class StrokeCollection
: public DependencyObjectCollection
{
205 virtual bool CanAdd (Value
*value
);
207 virtual ~StrokeCollection () {}
210 /* @GenerateCBinding,GeneratePInvoke */
211 StrokeCollection () { SetObjectType (Type::STROKE_COLLECTION
); }
213 virtual Type::Kind
GetElementType () { return Type::STROKE
; }
215 virtual bool AddedToCollection (Value
*value
, MoonError
*error
);
217 /* @GenerateCBinding,GeneratePInvoke */
218 StrokeCollection
*HitTest (StylusPointCollection
*stylusPoints
);
224 /* @Namespace=System.Windows.Controls */
225 class InkPresenter
: public Canvas
{
229 virtual ~InkPresenter () {}
231 virtual void PostRender (cairo_t
*cr
, Region
*region
, bool front_to_back
);
234 /* @PropertyType=StrokeCollection,AutoCreateValue,GenerateAccessors */
235 const static int StrokesProperty
;
237 /* @GenerateCBinding,GeneratePInvoke */
240 virtual void OnCollectionChanged (Collection
*col
, CollectionChangedEventArgs
*args
);
241 virtual void OnCollectionItemChanged (Collection
*col
, DependencyObject
*obj
, PropertyChangedEventArgs
*args
);
242 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
244 virtual void ComputeBounds ();
246 virtual Rect
GetRenderBounds ();
248 virtual void ShiftPosition (Point p
);
251 // Property Accessors
253 void SetStrokes (StrokeCollection
*strokes
);
254 StrokeCollection
*GetStrokes ();
260 /* @GeneratePInvoke */
261 void stroke_get_bounds (Stroke
*stroke
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
262 /* @GeneratePInvoke */
263 void stroke_collection_get_bounds (StrokeCollection
*collection
, /* @MarshalAs=Rect,IsRef */ Rect
*bounds
);
267 #endif /* __STYLUS_H__ */