00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef CRNATIVEEVENT_H
00012 #define CRNATIVEEVENT_H
00013
00014 #ifdef __GNUG__
00015 #pragma interface "CRNativeEvents.h"
00016 #endif
00017
00018 #include <wxGuiTest/Common.h>
00019 #include <wx/defs.h>
00020 #include <wx/event.h>
00021 #include <map>
00022
00023 extern const wxEventType wxEVT_NOT_TRANSLATED;
00024
00025 namespace wxTst {
00026
00029 enum CREventCat{
00030 Undefined = 0x0,
00031 System = 0x1,
00032 AppManipulation = 0x1 << 1,
00033 WindowManipulation = 0x1 << 2,
00034 MouseEvent = 0x1 << 3,
00035 KeyEvent = 0x1 << 4,
00036 HotKeyEvent = 0x1 << 5,
00037 MenuEvent = 0x1 << 6,
00038 MDIEvent = 0x1 << 7,
00039 ClipboardEvent = 0x1 << 8,
00040 Command = 0x1 << 9,
00041 TextEvent = 0x1 << 10
00042
00043 };
00044
00045 typedef unsigned int CREventMask;
00046
00052
00053 struct CREvent {
00054 wxString m_name;
00055 wxEventType m_evt;
00056 CREventCat m_cat;
00057
00058 CREvent() : m_name(_T("")), m_evt(0), m_cat(Undefined){}
00059 CREvent(const wxEventType, const wxString, const CREventCat);
00060 };
00061
00062 typedef std::map<wxEventType, CREvent> CREventMap;
00063
00068
00069 class CRNativeEvent {
00070 public:
00073 CRNativeEvent();
00077 CRNativeEvent(CREvent);
00080 CRNativeEvent(wxEventType);
00084 CRNativeEvent(const wxString&);
00088 virtual ~CRNativeEvent() { }
00092 virtual const wxString getEventString() const;
00096 virtual void* getNativeEvent() = 0;
00100 virtual const wxEventType getEventType() { return m_wxevent.m_evt; }
00106 static void setCREventMask(CREventMask mask) { s_eventMask = mask; }
00109 static const CREventMask getCREventMask() { return s_eventMask; }
00110
00111 protected:
00112 wxString m_eventString;
00113 static const wxString s_delim;
00114 static const wxString s_inDelim;
00115 static CREventMask s_eventMask;
00116 static CREventMap s_eventMap;
00117 CREvent m_wxevent;
00118 static void initEventMap();
00119
00120 private:
00121 static inline void CRNativeEvent::pushEvent(const wxEventType,
00122 const wxString,
00123 const CREventCat);
00124 };
00125 }
00126 #endif //CRNATIVEEVENT_H