00001 00002 // Name: wxGuiTest/CREventCaptureManager.h 00003 // Author: Reinhold Fuereder 00004 // Created: 2004 00005 // Copyright: (c) 2005 Reinhold Fuereder 00006 // Licence: wxWindows licence 00007 // Modifications: John Ralls, 2007-2008 00008 // Modifications Copyright: (c) 2008 John Ralls 00009 // 00010 // $Id$ 00012 00013 #ifndef CREVENTCAPTUREMANAGER_H 00014 #define CREVENTCAPTUREMANAGER_H 00015 00016 #ifdef __GNUG__ 00017 #pragma interface "CREventCaptureManager.h" 00018 #endif 00019 00020 #include <wxGuiTest/Common.h> 00021 00022 #include <list> 00023 00024 #include <wxGuiTest/CREventFilterInterface.h> 00025 00026 namespace wxTst { 00027 00028 class CRLogInterface; 00029 class CRCapturedEvent; 00030 00031 00035 class CREventCaptureManager : public CREventFilterInterface 00036 { 00037 public: 00043 static CREventCaptureManager * GetInstance (); 00044 00045 00049 static void Destroy (); 00050 00051 00058 virtual void IgnoreWindow (wxWindow *wdw); 00059 00060 00064 virtual void On (); 00065 00066 00070 virtual void Off (); 00071 00072 00078 virtual bool IsOn () const; 00079 00080 00086 virtual void SetLogger (CRLogInterface *log); 00087 00088 00089 // Implement CREventFilterInterface: 00090 00096 virtual void FilterEvent (wxEvent &event); 00097 00101 virtual void EmitPendingEvent (); 00102 00103 00104 protected: 00108 CREventCaptureManager (); 00109 00110 00114 virtual ~CREventCaptureManager (); 00115 00116 00124 virtual bool CanIgnore (wxEvent &event); 00125 00126 00134 virtual wxString GetDescForUnsupportedEvent (wxEvent &event) const; 00135 00136 00143 virtual wxString GetEventDesc (wxEvent &event) const; 00144 00145 00152 virtual wxString GetEventDetails (wxEvent& event) const; 00153 00154 00161 virtual void LogEventDetails (wxEvent& event, const wxString &prefix); 00162 00163 00164 private: 00165 static CREventCaptureManager *ms_instance; 00166 00167 wxWindow *m_ignoreWdw; 00168 00169 bool m_isOn; 00170 wxEvent *m_event; 00171 00172 CRLogInterface *m_log; 00173 std::ofstream *m_logStream; 00174 00175 //typedef std::list< CRCapturedEvent * > EventList; 00176 //EventList m_eventList; 00177 00178 CRCapturedEvent *m_pendingEvent; 00179 00180 private: 00181 // No copy and assignment constructor: 00182 CREventCaptureManager (const CREventCaptureManager &rhs); 00183 CREventCaptureManager & operator= (const CREventCaptureManager &rhs); 00184 }; 00185 00186 } // End namespace wxTst 00187 00188 #endif // CREVENTCAPTUREMANAGER_H 00189