Version: 0.6.0
gptaskexecdlg.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Toolbox)
3  * Purpose: wxGxTaskExecDlg class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009-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/geoprocessingui/geoprocessingui.h"
24 #include "wxgis/geoprocessing/gptoolmngr.h"
25 #include "wxgis/framework/progressor.h"
26 #include "wxgis/core/event.h"
27 
28 #include "wx/wxhtml.h"
29 #include "wx/imaglist.h"
30 
31 typedef struct _taskmessage
32 {
33  wxGISEnumMessageType nType;
34  wxString sMessage;
35 }TASKMESSAGE;
36 
37 typedef std::vector<TASKMESSAGE> TaskMessageArray;
38 
42 /*
43 class WXDLLIMPEXP_GIS_GPU wxGxTaskExecDlg :
44  public wxDialog,
45  public ITrackCancel
46 {
47  enum
48  {
49  ID_CANCEL_PROCESS = wxID_HIGHEST + 30
50  };
51 public:
52  wxGxTaskExecDlg(wxGISGPToolManager* pToolManager, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
53  virtual ~wxGxTaskExecDlg(void);
54  virtual void SetTaskID(int nTaskID);
55  virtual void FillHtmlWindow();
56  //events
57  virtual void OnExpand(wxCommandEvent & event);
58  virtual void OnCancel(wxCommandEvent & event);
59  virtual void OnCancelTask(wxCommandEvent & event);
60  virtual void OnClose(wxCloseEvent & event);
61  virtual void OnFinish(wxGISProcessEvent & event);
62  //ITrackCancel
63  virtual void PutMessage(wxString sMessage, size_t nIndex, wxGISEnumMessageType nType);
64 protected:
65  wxImageList m_ImageList;
66  bool m_bExpand;
67  wxGISEnumMessageType m_nState;
68  wxHtmlWindow* m_pHtmlWindow;
69  wxBoxSizer* m_bMainSizer;
70  wxBitmap m_ExpandBitmapBW, m_ExpandBitmap, m_ExpandBitmapBWRotated, m_ExpandBitmapRotated;
71  wxBitmapButton* m_bpExpandButton;
72  wxStaticText * m_Text;
73  wxStaticBitmap* m_pStateBitmap;
74  //wxCheckBox* m_pCheckBox;
75  wxBitmapButton* m_bpCloseButton;
76  TaskMessageArray m_MessageArray;
77 
78  wxString m_sHead;
79  wxString m_sNote;
80  wxIcon m_Icon;
81 
82  int m_nTaskID;
83  wxGISGPToolManager* m_pToolManager;
84 
85  DECLARE_EVENT_TABLE();
86 };
87 
88 class WXDLLIMPEXP_GIS_GPU wxGxTaskObject;
92 /*
93 class wxGxTaskObjectExecDlg :
94  public wxGxTaskExecDlg
95 {
96 public:
97  wxGxTaskObjectExecDlg(wxGxTaskObject* pGxTaskObject, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
98  virtual ~wxGxTaskObjectExecDlg(void);
99  //events
100  virtual void OnCancel(wxCommandEvent & event);
101  virtual void OnCancelTask(wxCommandEvent & event);
102  virtual void OnClose(wxCloseEvent& event);
103 protected:
104  wxGxTaskObject* m_pGxTaskObject;
105 };
106 
110 /*
111 class WXDLLIMPEXP_GIS_GPU wxGxTaskObject :
112  public IGxObject,
113  public IGxObjectUI,
114  public IGxTask,
115  public IGxObjectWizard,
116  public ITrackCancel,
117  public IProgressor,
118  public wxEvtHandler
119 {
120 public:
121  wxGxTaskObject(wxGISGPToolManager* pToolManager, wxString sName, wxIcon LargeToolIcon = wxNullIcon, wxIcon SmallToolIcon = wxNullIcon);
122  virtual ~wxGxTaskObject(void);
123  //IGxObject
124  virtual wxString GetName(void){return m_sName;};
125  virtual wxString GetBaseName(void){return GetName();};
126  virtual CPLString GetInternalName(void){return CPLString();};
127  virtual wxString GetCategory(void){return wxString(_("Task"));};
128  virtual bool Attach(IGxObject* pParent, IGxCatalog* pCatalog);
129  virtual void Detach(void);
130  //IGxObjectUI
131  virtual wxIcon GetLargeImage(void);
132  virtual wxIcon GetSmallImage(void);
133  virtual wxString ContextMenu(void){return wxString(wxT("wxGxTaskObject.ContextMenu"));};
134  virtual wxString NewMenu(void){return wxEmptyString;};
135  //IGxObjectWizard
136  virtual bool Invoke(wxWindow* pParentWnd);
137  //IProgressor
138  virtual void SetValue(int value);
139  virtual bool Show(bool bShow){return true;};
140  virtual void SetRange(int range){};
141  virtual int GetRange(void) const {return 100;};
142  virtual int GetValue(void) const {return m_nDonePercent;};
143  virtual void Play(void){};
144  virtual void Stop(void){};
145  virtual void SetYield(bool bYield = false){};
146 //IGxTask
147  virtual wxGISEnumTaskStateType GetState(void);
148  virtual wxDateTime GetStart();
149  virtual wxDateTime GetFinish();
150  virtual double GetDonePercent(){return m_nDonePercent;};
151  virtual wxString GetLastMessage();
152  virtual bool StartTask();
153  virtual bool StopTask();
154  virtual bool PauseTask();
155  virtual int GetPriority(void);
156  virtual void SetPriority(int nNewPriority);
157  //wxGxTaskObject
158  virtual int GetTaskID(void){return m_nTaskID;};
159  virtual void SetTaskID(int nTaskID);
160  virtual void ShowProcess(wxWindow* pParentWnd);
161  virtual void ShowToolConfig(wxWindow* pParentWnd);
162  //ITrackCancel
163  virtual void PutMessage(wxString sMessage, size_t nIndex, wxGISEnumMessageType nType);
164  //events
165  void OnTaskStateChanged(wxGISProcessEvent & event);
166  void OnFinish(wxGISProcessEvent & event);
167 protected:
168  wxGxTaskObjectExecDlg *m_pTaskExecDlg;
169  wxString m_sName;
170  int m_nDonePercent;
171  wxIcon m_LargeToolIcon, m_SmallToolIcon;
172  TaskMessageArray m_MessageArray;
173  int m_nTaskID;
174  wxGISGPToolManager* m_pToolManager;
175  long m_nCookie;
176 
177  DECLARE_EVENT_TABLE();
178 };
179 
180 */