#ifndef _WX_PROTO_APP
#define _WX_PROTO_APP

#include "protokit.h"
#include "wx/wx.h"

class wxProtoApp : public wxApp, public ProtoDispatcher::Controller
{
    public:
        virtual ~wxProtoApp();
        
        // Some helper methods
        void ActivateTimer(ProtoTimer& theTimer)
            {dispatcher.ActivateTimer(theTimer);}
        
        void DeactivateTimer(ProtoTimer& theTimer)
            {dispatcher.DeactivateTimer(theTimer);}
        
        ProtoSocket::Notifier& GetSocketNotifier() 
            {return static_cast<ProtoSocket::Notifier&>(dispatcher);}
        
        ProtoTimerMgr& GetTimerMgr()
            {return static_cast<ProtoTimerMgr&>(dispatcher);}
        
        static const wxEventType wxPROTO_DISPATCH_EVENT;
        
    protected:
        wxProtoApp();
        
    private:
        int MainLoop();
        void OnDispatchEvent(wxCommandEvent& event);   
        bool SignalDispatchReady();  
        
        ProtoDispatcher dispatcher;
    
        DECLARE_EVENT_TABLE()
};  // end class wxProtoApp

#endif // !_WX_PROTO_APP
