Version: 0.6.0
mxevent.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: event UI classes special for MapView events.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011,2013,2014 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/carto/carto.h"
24 #include "wx/event.h"
25 
26 
27 class WXDLLIMPEXP_GIS_CRT wxMxMapViewEvent;
28 
29 
30 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CRT, wxMXMAP_LAYER_CHANGED, wxMxMapViewEvent);
31 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CRT, wxMXMAP_LAYER_LOADING, wxMxMapViewEvent);
32 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CRT, wxMXMAP_LAYER_DS_CLOSED, wxMxMapViewEvent);
33 
40 class WXDLLIMPEXP_GIS_CRT wxMxMapViewEvent : public wxEvent
41 {
42 public:
43  wxMxMapViewEvent(wxEventType eventType = wxMXMAP_LAYER_CHANGED, short nLayerId = 0) : wxEvent(0, eventType)
44  {
45  m_nLayerId = nLayerId;
46  }
47 
48  wxMxMapViewEvent(const wxMxMapViewEvent& event) : wxEvent(event)
49  {
50  m_nLayerId = event.m_nLayerId;
51  }
52 
53  void SetLayerId(size_t nLayerId){ m_nLayerId = nLayerId; };
54  size_t GetLayerId(void) const { return m_nLayerId; };
55 
56  virtual wxEvent *Clone() const { return new wxMxMapViewEvent(*this); }
57 
58 protected:
59  short m_nLayerId;
60 
61 private:
62  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMxMapViewEvent)
63 };
64 
65 typedef void (wxEvtHandler::*wxMxMapViewEventFunction)(wxMxMapViewEvent&);
66 
67 #define wxMxMapViewEventHandler(func) \
68  wxEVENT_HANDLER_CAST(wxMxMapViewEventFunction, func)
69 
70 #define EVT_MXMAP_LAYER_CHANGED(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_CHANGED, wxMxMapViewEventHandler(func))
71 #define EVT_MXMAP_LAYER_LOADING(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_LOADING, wxMxMapViewEventHandler(func))
72 #define EVT_MXMAP_LAYER_DS_CLOSED(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_DS_CLOSED, wxMxMapViewEventHandler(func))
Definition: mxevent.h:40