2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / src / trigger.h
blob96f4603f03aac7f94bf49fad02cc31afa9bed34b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * trigger.h
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
8 *
9 */
11 #ifndef __MOON_TRIGGER_H__
12 #define __MOON_TRIGGER_H__
14 #include <glib.h>
16 #include "dependencyobject.h"
18 /* @Namespace=System.Windows */
19 class TriggerBase : public DependencyObject {
20 public:
21 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
22 TriggerBase () { SetObjectType (Type::TRIGGERBASE); }
25 /* @Namespace=System.Windows */
26 class TriggerAction : public DependencyObject {
27 public:
28 /* @GenerateCBinding,GeneratePInvoke,ManagedAccess=Internal */
29 TriggerAction () { SetObjectType (Type::TRIGGERACTION); }
31 /* @GenerateCBinding */
32 virtual void Fire () {}
34 protected:
35 virtual ~TriggerAction () {}
39 /* @ContentProperty="Actions" */
40 /* @Namespace=System.Windows */
41 class EventTrigger : public TriggerBase {
42 int registered_event_id;
44 static void event_trigger_fire_actions (EventObject *sender, EventArgs *calldata, gpointer closure);
46 protected:
47 virtual ~EventTrigger ();
49 public:
50 /* @PropertyType=TriggerActionCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
51 const static int ActionsProperty;
52 /* @PropertyType=string,ManagedPropertyType=RoutedEvent,ManagedFieldAccess=Internal,GenerateAccessors */
53 const static int RoutedEventProperty;
55 /* @GenerateCBinding,GeneratePInvoke */
56 EventTrigger ();
58 void SetTarget (DependencyObject *target);
59 void RemoveTarget (DependencyObject *target);
62 // Property Accessors
64 void SetActions (TriggerActionCollection *value);
65 TriggerActionCollection *GetActions ();
67 void SetRoutedEvent (const char *event);
68 const char *GetRoutedEvent ();
71 G_BEGIN_DECLS
72 void event_trigger_action_add (EventTrigger *trigger, TriggerAction *action);
73 G_END_DECLS
75 #endif /* __MOON_TRIGGER_H__ */