1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
11 #ifndef __EVENTARGS_H__
12 #define __EVENTARGS_H__
17 #include <gdk/gdkevents.h>
18 #include "dependencyobject.h"
23 class StylusPointCollection
;
27 * EventArgs needs to be ref counted since js can keep objects around until
28 * after the event has been emitted.
32 class EventArgs
: public DependencyObject
{
37 virtual ~EventArgs ();
38 EventArgs (Type::Kind type
);
42 class RenderingEventArgs
: public EventArgs
{
44 RenderingEventArgs (TimeSpan renderingTime
);
46 /* @GenerateCBinding,GeneratePInvoke */
47 TimeSpan
GetRenderingTime ();
50 virtual ~RenderingEventArgs ();
54 TimeSpan renderingTime
;
57 enum CollectionChangedAction
{
58 CollectionChangedActionAdd
,
59 CollectionChangedActionRemove
,
60 CollectionChangedActionReplace
,
61 CollectionChangedActionClearing
,
62 CollectionChangedActionCleared
,
66 class CollectionChangedEventArgs
: public EventArgs
{
68 /* @GenerateCBinding,GeneratePInvoke */
69 CollectionChangedEventArgs ();
71 CollectionChangedEventArgs (CollectionChangedAction action
, Value
*new_value
, Value
*old_value
, int index
);
73 /* @GenerateCBinding,GeneratePInvoke */
74 void SetChangedAction (CollectionChangedAction action
);
76 /* @GenerateCBinding,GeneratePInvoke */
77 CollectionChangedAction
GetChangedAction ();
79 /* @GenerateCBinding,GeneratePInvoke */
80 void SetNewItem (Value
*item
);
82 /* @GenerateCBinding,GeneratePInvoke */
85 /* @GenerateCBinding,GeneratePInvoke */
86 void SetOldItem (Value
*item
);
88 /* @GenerateCBinding,GeneratePInvoke */
91 /* @GenerateCBinding,GeneratePInvoke */
92 void SetIndex (int index
);
94 /* @GenerateCBinding,GeneratePInvoke */
98 virtual ~CollectionChangedEventArgs ();
102 CollectionChangedAction action
;
108 /* @Namespace=None */
109 class CollectionItemChangedEventArgs
: public EventArgs
{
111 CollectionItemChangedEventArgs (DependencyObject
*collectionItem
,
112 DependencyProperty
*property
,
116 this->collectionItem
= collectionItem
;
117 this->property
= property
;
118 this->oldValue
= oldValue
;
119 this->newValue
= newValue
;
122 DependencyObject
* GetCollectionItem() { return collectionItem
; }
123 DependencyProperty
* GetProperty() { return property
; }
124 Value
* GetOldValue () { return oldValue
; }
125 Value
* GetNewValue () { return newValue
; }
128 DependencyObject
*collectionItem
;
129 DependencyProperty
*property
;
134 /* @Namespace=None */
135 class DownloadProgressEventArgs
: public EventArgs
{
140 virtual ~DownloadProgressEventArgs ();
143 DownloadProgressEventArgs ();
144 DownloadProgressEventArgs (double progress
);
146 void SetProgress (double progress
);
148 /* @GenerateCBinding,GeneratePInvoke */
149 double GetProgress ();
152 /* @Namespace=None */
153 class RoutedEventArgs
: public EventArgs
{
155 /* @GenerateCBinding,GeneratePInvoke */
158 RoutedEventArgs (DependencyObject
*source
);
160 /* @GenerateCBinding,GeneratePInvoke */
161 DependencyObject
*GetSource ();
163 /* @GenerateCBinding,GeneratePInvoke */
164 void SetSource(DependencyObject
*el
);
166 /* @GenerateCBinding,GeneratePInvoke */
167 void SetHandled (bool handled
);
169 /* @GenerateCBinding,GeneratePInvoke */
173 virtual ~RoutedEventArgs ();
174 RoutedEventArgs (DependencyObject
*source
, Type::Kind kind
);
175 RoutedEventArgs (Type::Kind kind
);
178 DependencyObject
*source
;
182 /* @Namespace=None */
183 class ExceptionRoutedEventArgs
: public RoutedEventArgs
{
185 virtual ~ExceptionRoutedEventArgs ();
188 ExceptionRoutedEventArgs ();
192 /* @Namespace=None */
193 class KeyEventArgs
: public RoutedEventArgs
{
195 /* @GenerateCBinding,GeneratePInvoke */
197 KeyEventArgs (GdkEventKey
*event
);
199 /* @GenerateCBinding,GeneratePInvoke */
202 /* @GenerateCBinding,GeneratePInvoke */
203 int GetPlatformKeyCode ();
205 // accessors for the native GdkEventKey
206 GdkEventKey
*GetEvent ();
207 GdkModifierType
GetModifiers ();
208 gunichar
GetUnicode ();
213 virtual ~KeyEventArgs ();
219 /* @Namespace=None */
220 class MouseEventArgs
: public RoutedEventArgs
{
222 /* @GenerateCBinding,GeneratePInvoke */
224 MouseEventArgs (GdkEvent
*event
);
226 GdkEvent
*GetEvent () { return event
; }
231 int GetClickCount ();
233 /* @GenerateCBinding,GeneratePInvoke */
234 void GetPosition (UIElement
*relative_to
, double *x
, double *y
);
236 /* @GenerateCBinding,GeneratePInvoke */
237 StylusInfo
*GetStylusInfo ();
239 /* @GenerateCBinding,GeneratePInvoke */
240 StylusPointCollection
*GetStylusPoints (UIElement
*ink_presenter
);
243 virtual ~MouseEventArgs ();
249 /* @Namespace=None */
250 class MouseWheelEventArgs
: public RoutedEventArgs
{
252 /* @GenerateCBinding,GeneratePInvoke */
253 MouseWheelEventArgs ();
254 MouseWheelEventArgs (GdkEvent
*event
);
256 GdkEvent
*GetEvent () { return event
; }
258 /* @GenerateCBinding,GeneratePInvoke */
259 int GetWheelDelta ();
262 virtual ~MouseWheelEventArgs ();
268 #endif /* __EVENTARGS_H__ */