Version: 0.6.0
netevent.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Remote)
3  * Purpose: network events classes
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgis/net/message.h"
24 
25 #include "wx/event.h"
26 
27 class WXDLLIMPEXP_GIS_NET wxGISNetEvent;
28 
29 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_NET, wxGISNET_MSG, wxGISNetEvent);
30 
34 class WXDLLIMPEXP_GIS_NET wxGISNetEvent : public wxEvent
35 {
36 public:
37  wxGISNetEvent(int nUserId = 0, wxEventType eventType = wxGISNET_MSG, const wxNetMessage &msg = wxNetMessage()) : wxEvent(nUserId, eventType)
38  {
39  m_msg = msg;
40  }
41 
42  wxGISNetEvent(const wxGISNetEvent& event) : wxEvent(event)
43  {
44  m_msg = event.m_msg.Clone();
45  }
46 
47  void SetNetMessage(const wxNetMessage &msg) { m_msg = msg; }
48  wxNetMessage GetNetMessage() const { return m_msg; }
49 
50  virtual wxEvent *Clone() const { return new wxGISNetEvent(*this); }
51 
52 protected:
53  wxNetMessage m_msg;
54 
55 private:
56  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGISNetEvent)
57 };
58 
59 typedef void (wxEvtHandler::*wxGISNetEventFunction)(wxGISNetEvent&);
60 
61 #define wxGISNetEventHandler(func) \
62  wxEVENT_HANDLER_CAST(wxGISNetEventFunction, func)
63 
64 #define EVT_GISNET_MSG(func) wx__DECLARE_EVT0(wxGISNET_MSG, wxGISNetEventHandler(func))
65 
67 {
68 public:
69  virtual ~INetEventProcessor(void){};
70  virtual void ProcessNetEvent(wxGISNetEvent& event) = 0;
71 };
Definition: netevent.h:66
Definition: message.h:42
Definition: netevent.h:34