Version: 0.6.0
progressdlg.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: wxGISProgressDlg class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009,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/framework/framework.h"
24 
25 #include <wx/intl.h>
26 
27 #include <wx/string.h>
28 #include <wx/stattext.h>
29 #include <wx/gdicmn.h>
30 #include <wx/font.h>
31 #include <wx/colour.h>
32 #include <wx/settings.h>
33 #include <wx/sizer.h>
34 #include <wx/button.h>
35 #include <wx/dialog.h>
36 
37 
38 #ifdef __WXMSW__
39  #include <shobjidl.h>
40 #endif
41 
42 #ifdef wxGIS_HAVE_UNITY_INTEGRATION
43  #include <unity.h>
44  #define DESKTOP_FILE_NAME "ngm.desktop"
45 #endif // wxGIS_HAVE_UNITY_INTEGRATION
46 
53 class WXDLLIMPEXP_GIS_FRW wxGISProgressDlg :
54  public wxDialog,
55  public ITrackCancel,
56  public IProgressor
57 {
58  DECLARE_CLASS(wxGISProgressDlg)
59 public:
60  wxGISProgressDlg(const wxString &title, const wxString &message, int maximum = 100, wxWindow * parent = NULL, int style = wxCAPTION );
61  virtual ~wxGISProgressDlg(void);
62  //IProgressor
63  virtual bool ShowProgress(bool bShow = true);
64  virtual void SetRange(int range);
65  virtual int GetRange(void) const ;
66  virtual void SetValue(int value);
67  virtual int GetValue(void) const;
68  virtual void Play(void);
69  virtual void Stop(void);
70  virtual void SetYield(bool bYield = false);
71  //ITrackCancel
72  virtual void Cancel(void);
73  virtual bool Continue(void);
74  virtual void Reset(void);
75  virtual void PutMessage(const wxString &sMessage, size_t nIndex = wxNOT_FOUND, wxGISEnumMessageType eType = enumGISMessageUnk);
76  virtual wxString GetLastMessage(void) const {return m_sLastMessage;};
77  //
78  virtual void SetAddPercentToMessage(bool bAdd = false);
79  virtual size_t GetWarningCount() const;
80  virtual const wxVector<MESSAGE>& GetWarnings() const;
81  //events
82  virtual void OnCancel(wxCommandEvent& event);
83 protected:
84  wxButton* m_sdbSizerCancel;
85  wxStdDialogButtonSizer* m_sdbSizer;
86  wxStaticText* m_staticElapsedText;
87  IProgressor *m_pProgressBar;
88  wxStaticText* m_staticText;
89 protected:
90  wxString m_sLastMessage;
91  bool m_bAddPercentToMessage;
92  wxVector<MESSAGE> m_saWarnings;
93  wxDateTime m_dtStart;
94  int m_nPrevDone;
95 #ifdef __WXMSW__
96  ITaskbarList3 *m_pTaskbarList;
97 #endif
98 
99 #ifdef wxGIS_HAVE_UNITY_INTEGRATION
100  UnityLauncherEntry* m_pLauncher;
101 #endif // wxGIS_HAVE_UNITY_INTEGRATION
102 private:
103  DECLARE_EVENT_TABLE()
104 };
virtual void Stop(void)=0
Stop undefined progressor state.
virtual void SetValue(int value)=0
Set progressor position.
virtual void SetYield(bool bYield=false)=0
SetYield Yields control to pending messages in the windowing system.
A TrackCancel interface class.
Definition: core.h:144
virtual bool ShowProgress(bool bShow)=0
Show/hide progressor.
Definition: core.h:92
virtual void SetRange(int range)=0
Set progressor range.
virtual void Play(void)=0
Start undefined progressor state.
Definition: core.h:86
virtual int GetRange(void) const =0
Set progressor range.
Definition: progressdlg.h:53
virtual int GetValue(void) const =0
Get progressor position.