| 1 |
#ifndef _WX_PROTO_APP |
| 2 |
#define _WX_PROTO_APP |
| 3 |
|
| 4 |
|
| 5 |
#ifndef _WIN32_WCE |
| 6 |
#include "protokit.h" |
| 7 |
#endif // !_WIN32_WCE |
| 8 |
|
| 9 |
#include <wx/wx.h> |
| 10 |
|
| 11 |
#ifdef _WIN32_WCE |
| 12 |
#ifndef LPGUID |
| 13 |
typedef GUID *LPGUID; |
| 14 |
#endif // !LPGUID |
| 15 |
#include "protokit.h" |
| 16 |
#endif // _WIN32_WCE |
| 17 |
|
| 18 |
/** |
| 19 |
* @class wxProtoApp |
| 20 |
* |
| 21 |
* @brief Base class that can be used to create applications using Protolib components |
| 22 |
* and the wxWidgets GUI toolkit. |
| 23 |
* |
| 24 |
*/ |
| 25 |
class wxProtoApp : public wxApp, public ProtoDispatcher::Controller |
| 26 |
{ |
| 27 |
public: |
| 28 |
virtual ~wxProtoApp(); |
| 29 |
|
| 30 |
// Some helper methods |
| 31 |
void ActivateTimer(ProtoTimer& theTimer) |
| 32 |
{dispatcher.ActivateTimer(theTimer);} |
| 33 |
|
| 34 |
void DeactivateTimer(ProtoTimer& theTimer) |
| 35 |
{dispatcher.DeactivateTimer(theTimer);} |
| 36 |
|
| 37 |
ProtoSocket::Notifier& GetSocketNotifier() |
| 38 |
{return static_cast<ProtoSocket::Notifier&>(dispatcher);} |
| 39 |
|
| 40 |
ProtoTimerMgr& GetTimerMgr() |
| 41 |
{return static_cast<ProtoTimerMgr&>(dispatcher);} |
| 42 |
|
| 43 |
static const wxEventType wxPROTO_DISPATCH_EVENT; |
| 44 |
|
| 45 |
protected: |
| 46 |
wxProtoApp(bool appDispatch = true); |
| 47 |
ProtoDispatcher dispatcher; |
| 48 |
|
| 49 |
private: |
| 50 |
int MainLoop(); |
| 51 |
void OnDispatchEvent(wxCommandEvent& event); |
| 52 |
void OnIdleEvent(wxIdleEvent& event); |
| 53 |
bool SignalDispatchReady(); |
| 54 |
static void DoGUIEvent(ProtoDispatcher::Descriptor descriptor, |
| 55 |
ProtoDispatcher::Event theEvent, |
| 56 |
const void* userData); |
| 57 |
bool app_dispatch; |
| 58 |
|
| 59 |
DECLARE_EVENT_TABLE() |
| 60 |
}; // end class wxProtoApp |
| 61 |
|
| 62 |
#endif // !_WX_PROTO_APP |