00001 #ifndef __UI_Event__
00002 #define __UI_Event__
00003
00004 #include "UI_API.h"
00005 #include <string.h>
00006 #ifdef DEBUG_TRIGGER
00007 #include "UI_Global.h"
00008 #endif
00009 #include "UI_DeviceEvent.h"
00010 #include "UI_Value.h"
00011
00012 class UI_API UI_Event {
00013 public:
00014 UI_Event();
00015
00016 UI_Event(
00017 UI_EventType t,
00018 UI_Object *to,
00019 UI_Object *from = (UI_Object *)0,
00020 UI_DeviceEvent *e = (UI_DeviceEvent *)0
00021 );
00022
00023 UI_Event(
00024 UI_Value *v,
00025 UI_Object *to,
00026 UI_Object *from = (UI_Object *)0,
00027 UI_Reason r = UI_VALUE_CHANGED
00028 );
00029
00030 UI_Event(
00031 UI_Value *v,
00032 UI_Object *to,
00033 UI_EventMethod callback,
00034 UI_Object *from = (UI_Object *)0,
00035 UI_Reason r = UI_VALUE_CHANGED
00036 );
00037
00038 UI_Event(
00039 UI_EventType t,
00040 UI_Object *to,
00041 UI_EventMethod callback,
00042 UI_Object *from = (UI_Object *)0
00043 );
00044
00045 UI_Object *source;
00046 UI_Object *target;
00047 UI_EventMethod method;
00048 UI_Value *value;
00049 UI_EventType type;
00050 UI_DeviceEvent state;
00051 UI_Reason reason;
00052
00053 void trigger()
00054 {
00055 #ifdef DEBUG_TRIGGER
00056 UI_DEBUG(DBG_EVENTS,
00057 UI_debug("Trigger %s, source: %s, target: %s\n",
00058 name(),
00059 source ? source->className() : "NULL",
00060 target ? target->className() : "NULL"));
00061 #endif
00062 if( target )
00063 (target->*method)(this);
00064 }
00065
00066 const char *name() const;
00067 const char *className() const { return "UI_Event"; }
00068 void display() const;
00069 };
00070
00071
00072 #endif