Version: 0.6.0
gxeventui.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: event UI classes special for Selection events.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011 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/catalogui/gxselection.h"
24 
25 #include <wx/event.h>
26 
27 
28 class WXDLLIMPEXP_FWD_GIS_CLU wxGxSelectionEvent;
29 
30 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CLU, wxGXSELECTION_CHANGED, wxGxSelectionEvent);
31 
32 
37 class WXDLLIMPEXP_GIS_CLU wxGxSelectionEvent : public wxEvent
38 {
39 public:
40  wxGxSelectionEvent(wxEventType eventType = wxGXSELECTION_CHANGED, wxGxSelection* pSelection = NULL, long nInitiator = wxNOT_FOUND) : wxEvent(0, eventType), m_nInitiator(nInitiator), m_pSelection(pSelection)
41  {
42  }
43  wxGxSelectionEvent(const wxGxSelectionEvent& event) : wxEvent(event)
44  {
45  m_nInitiator = event.m_nInitiator;
46  m_pSelection = event.m_pSelection;
47  }
48 
49  void SetInitiator(long nInitiator) { m_nInitiator = nInitiator; }
50  long GetInitiator() const { return m_nInitiator; }
51  void SetSelection(wxGxSelection* pSelection) { m_pSelection = pSelection; }
52  wxGxSelection* GetSelection() const { return m_pSelection; }
53 
54  virtual wxEvent *Clone() const { return new wxGxSelectionEvent(*this); }
55 
56 protected:
57  long m_nInitiator;
58  wxGxSelection* m_pSelection;
59 
60 private:
61  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGxSelectionEvent)
62 };
63 
64 typedef void (wxEvtHandler::*wxGxSelectionEventFunction)(wxGxSelectionEvent&);
65 
66 #define wxGxSelectionEventHandler(func) \
67  wxEVENT_HANDLER_CAST(wxGxSelectionEventFunction, func)
68 
69 #define EVT_GXSELECTION_CHANGED(func) wx__DECLARE_EVT0(wxGXSELECTION_CHANGED, wxGxSelectionEventHandler(func))
70 
The GxSelection class event.
Definition: gxeventui.h:37
The GxObject Selection class.
Definition: gxselection.h:30