Version: 0.6.0
mxeventui.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 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/cartoui/cartoui.h"
24 #include "wx/event.h"
25 
26 
27 class WXDLLIMPEXP_FWD_GIS_CTU wxMxMapViewUIEvent;
28 
29 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_ROTATED, wxMxMapViewUIEvent);
30 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_DRAWING_START, wxMxMapViewUIEvent);
31 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_DRAWING_STOP, wxMxMapViewUIEvent);
32 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_LAYER_ADDED, wxMxMapViewUIEvent);
33 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_LAYER_REMOVED, wxMxMapViewUIEvent);
34 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_CLEARED, wxMxMapViewUIEvent);
35 //wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_LAYER_ORDER_CHANGED, wxMxMapViewEvent);
36 
37 //wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CTU, wxMXMAP_REFRESHED, wxGxMapViewEvent);
38  //AfterDraw Fired after the specified phase is drawn.
39  //AfterItemDraw Fired after an individual view item is drawn. Example: view items include layers in a map or elements in a page layout.
40  //ContentsChanged Fired when the contents of the view changes.
41  //ContentsCleared Fired when the contents of the view is cleared.
42  //FocusMapChanged Fired when a new map is made active.
43  //ItemAdded Fired when an item is added to the view.
44  //ItemDeleted Fired when an item is deleted from the view.
45  //ItemReordered Fired when a view item is reordered.
46  //SelectionChanged Call this function to fire the selection changed event.
47  //SpatialReferenceChanged Fired when the spatial reference is changed.
48  //ViewRefreshed Fired when view is refreshed before draw happens.
49 
50 
54 class WXDLLIMPEXP_GIS_CTU wxMxMapViewUIEvent : public wxEvent
55 {
56 public:
57  wxMxMapViewUIEvent(int nWinId = 0, wxEventType eventType = wxMXMAP_ROTATED, short nLayerId = wxNOT_FOUND, double dAngleRad = 0) : wxEvent(nWinId, eventType)
58  {
59  m_dRotation = dAngleRad;
60  m_nLayerId = nLayerId;
61  }
62  wxMxMapViewUIEvent(const wxMxMapViewUIEvent& event) : wxEvent(event)
63  {
64  m_dRotation = event.m_dRotation;
65  m_nLayerId = event.m_nLayerId;
66  }
67 
68  void SetRotate(double dAngleRad){m_dRotation = dAngleRad;};
69  double GetRotate(void) const {return m_dRotation;};
70  void SetLayerId(size_t nLayerId){ m_nLayerId = nLayerId; };
71  size_t GetLayerId(void) const { return m_nLayerId; };
72 
73  virtual wxEvent *Clone() const { return new wxMxMapViewUIEvent(*this); }
74 
75 protected:
76  double m_dRotation;
77  short m_nLayerId;
78 
79 private:
80  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMxMapViewUIEvent)
81 };
82 
83 typedef void (wxEvtHandler::*wxMxMapViewUIEventFunction)(wxMxMapViewUIEvent&);
84 
85 #define wxMxMapViewUIEventHandler(func) \
86  wxEVENT_HANDLER_CAST(wxMxMapViewUIEventFunction, func)
87 
88 #define EVT_MXMAP_ROTATED(func) wx__DECLARE_EVT0(wxMXMAP_ROTATED, wxMxMapViewUIEventHandler(func))
89 #define EVT_MXMAP_DRAWING_START(func) wx__DECLARE_EVT0(wxMXMAP_DRAWING_START, wxMxMapViewUIEventHandler(func))
90 #define EVT_MXMAP_DRAWING_STOP(func) wx__DECLARE_EVT0(wxMXMAP_DRAWING_STOP, wxMxMapViewUIEventHandler(func))
91 #define EVT_MXMAP_LAYER_ADDED(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_ADDED, wxMxMapViewUIEventHandler(func))
92 #define EVT_MXMAP_LAYER_REMOVED(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_REMOVED, wxMxMapViewUIEventHandler(func))
93 #define EVT_MXMAP_CLEARED(func) wx__DECLARE_EVT0(wxMXMAP_CLEARED, wxMxMapViewUIEventHandler(func))
94 //#define EVT_MXMAP_LAYER_ORDER_CHANGED(func) wx__DECLARE_EVT0(wxMXMAP_LAYER_ORDER_CHANGED, wxMxMapViewEventHandler(func))
Definition: mxeventui.h:54