Version: 0.6.0
event.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: event classes special for Process events.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011,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/core/core.h"
24 #include "wx/event.h"
25 
26 class WXDLLIMPEXP_FWD_GIS_CORE wxGISProcessEvent;
27 
28 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CORE, wxPROCESS_START, wxGISProcessEvent);
29 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CORE, wxPROCESS_FINISH, wxGISProcessEvent);
30 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CORE, wxPROCESS_CANCELED, wxGISProcessEvent);
31 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_GIS_CORE, wxPROCESS_STATE_CHANGED, wxGISProcessEvent);
32 
36 class WXDLLIMPEXP_GIS_CORE wxGISProcessEvent : public wxEvent
37 {
38 public:
39  wxGISProcessEvent(wxEventType eventType = wxPROCESS_START, long nProcessID = wxNOT_FOUND, bool bHasErrors = false) : wxEvent(0, eventType), m_nProcessID(nProcessID), m_bHasErrors(bHasErrors)
40  {
41  }
42  wxGISProcessEvent(const wxGISProcessEvent& event) : wxEvent(event), m_nProcessID(event.m_nProcessID), m_bHasErrors(event.m_bHasErrors)
43  {
44  }
45 
46  void SetProcessID(long nProcessID) { m_nProcessID = nProcessID; }
47  long GetProcessID() const { return m_nProcessID; }
48  void SetHasErrors(bool bHasErrors) { m_bHasErrors = bHasErrors; }
49  bool GetHasErrors() const { return m_bHasErrors; }
50 
51  virtual wxEvent *Clone() const { return new wxGISProcessEvent(*this); }
52 
53 protected:
54  long m_nProcessID;
55  bool m_bHasErrors;
56 
57 private:
58  DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGISProcessEvent)
59 };
60 
61 typedef void (wxEvtHandler::*wxGISProcessEventFunction)(wxGISProcessEvent&);
62 
63 #define wxGISProcessEventHandler(func) wxEVENT_HANDLER_CAST(wxGISProcessEventFunction, func)
64 
65 #define EVT_PROCESS_START(func) wx__DECLARE_EVT0(wxPROCESS_START, wxGISProcessEventHandler(func))
66 #define EVT_PROCESS_FINISH(func) wx__DECLARE_EVT0(wxPROCESS_FINISH, wxGISProcessEventHandler(func))
67 #define EVT_PROCESS_CANCELED(func) wx__DECLARE_EVT0(wxPROCESS_CANCELED, wxGISProcessEventHandler(func))
68 #define EVT_PROCESS_STATE_CHANGED(func) wx__DECLARE_EVT0(wxPROCESS_STATE_CHANGED, wxGISProcessEventHandler(func))
69 
The wxGISProcess class event.
Definition: event.h:36