Version: 0.6.0
gxevent.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: event classes special for GxCatalog events.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011-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/catalog/catalog.h"
24 #include "wx/event.h"
25 
26 class WXDLLIMPEXP_FWD_GIS_CLT wxGxCatalogEvent;
27 
28 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CLT, wxGXOBJECT_ADDED, wxGxCatalogEvent);
29 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CLT, wxGXOBJECT_CHANGED, wxGxCatalogEvent);
30 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CLT, wxGXOBJECT_DELETED, wxGxCatalogEvent);
31 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CLT, wxGXOBJECT_REFRESHED, wxGxCatalogEvent);
32 
39 class WXDLLIMPEXP_GIS_CLT wxGxCatalogEvent : public wxEvent
40 {
41 public:
42  wxGxCatalogEvent(wxEventType eventType = wxGXOBJECT_ADDED, long nObjectID = wxNOT_FOUND) : wxEvent(0, eventType)
43  {
44  m_nObjectID = nObjectID;
45  }
46 
47  wxGxCatalogEvent(const wxGxCatalogEvent& event) : wxEvent(event)
48  {
49  m_nObjectID = event.m_nObjectID;
50  }
51 
52  void SetObjectID(long nObjectID) { m_nObjectID = nObjectID; }
53  long GetObjectID() const { return m_nObjectID; }
54 
55  virtual wxEvent *Clone() const { return new wxGxCatalogEvent(*this); }
56 
57 protected:
58  long m_nObjectID;
59 
60 private:
61  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGxCatalogEvent)
62 };
63 
64 typedef void (wxEvtHandler::*wxGxCatalogEventFunction)(wxGxCatalogEvent&);
65 
66 #define wxGxCatalogEventHandler(func) \
67  wxEVENT_HANDLER_CAST(wxGxCatalogEventFunction, func)
68 
69 #define EVT_GXOBJECT_ADDED(func) wx__DECLARE_EVT0(wxGXOBJECT_ADDED, wxGxCatalogEventHandler(func))
70 #define EVT_GXOBJECT_CHANGED(func) wx__DECLARE_EVT0(wxGXOBJECT_CHANGED, wxGxCatalogEventHandler(func))
71 #define EVT_GXOBJECT_DELETED(func) wx__DECLARE_EVT0(wxGXOBJECT_DELETED, wxGxCatalogEventHandler(func))
72 #define EVT_GXOBJECT_REFRESHED(func) wx__DECLARE_EVT0(wxGXOBJECT_REFRESHED, wxGxCatalogEventHandler(func))
73 
The Network event.
Definition: gxevent.h:39