Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
hugin1/base_wx/MyProgressDialog.h
Go to the documentation of this file.00001 // -*- c-basic-offset: 4 -*- 00024 #ifndef _MYPROGRESSDIALOG_H 00025 #define _MYPROGRESSDIALOG_H 00026 00027 #include <hugin_shared.h> 00028 #include "panoinc.h" 00029 #include "panoinc_WX.h" 00030 00031 #include "common/utils.h" 00032 00033 00034 00035 class WXIMPEX ProgressReporterDialog : public utils::ProgressReporter, public wxProgressDialog 00036 { 00037 public: 00038 ProgressReporterDialog(double maxProgress, const wxString& title, const wxString& message, 00039 wxWindow * parent = NULL, 00040 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME, 00041 const wxSize & sz = wxDefaultSize) 00042 : wxProgressDialog(title, message+wxString((wxChar)' ',10), 100, parent, style), 00043 m_progress(0),m_maxProgress(maxProgress), m_abort(false) 00044 { }; 00045 00046 virtual ~ProgressReporterDialog(); 00047 00048 virtual bool increaseProgress(double delta); 00049 virtual bool increaseProgress(double delta, const std::string & msg); 00050 00051 // TODO entire ProgressReporter and ProgressDisplay API needs be updated to use wstring. 00052 // Temporarily implemented only for this function. from here --> 00053 virtual bool increaseProgress(double delta, const std::wstring & msg); 00054 // <- to here 00055 00056 virtual void setMessage(const std::string & msg); 00057 00058 protected: 00059 double m_progress; 00060 double m_maxProgress; 00061 wxString m_message; 00062 bool m_abort; 00063 }; 00064 00069 class WXIMPEX MyProgressDialog : public wxProgressDialog, public utils::MultiProgressDisplay 00070 { 00071 public: 00074 MyProgressDialog(const wxString& title, const wxString& message, 00075 wxWindow * parent = NULL, 00076 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL, 00077 const wxSize & sz = wxDefaultSize) 00078 : wxProgressDialog(title, message, 100, parent, style) 00079 { 00080 SetSize(sz); 00081 } 00084 virtual ~MyProgressDialog() {}; 00085 00087 virtual void updateProgressDisplay(); 00088 00089 // override to abort the current operation. 00090 virtual void abortOperation() 00091 { 00092 DEBUG_TRACE(""); 00093 } 00094 private: 00095 }; 00096 00097 class OptProgressDialog : public MyProgressDialog 00098 { 00099 public: 00100 // work around a flaw in wxProgresDialog that results in incorrect layout 00101 // by pre-allocting sufficient horizontal and vertical space 00102 OptProgressDialog(wxWindow * parent = NULL, 00103 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT ) 00104 : MyProgressDialog(_("Optimizing Panorama"), (wxString((wxChar)' ', 80) + wxT("\n \n \n \n ")), parent, style) 00105 { } 00106 00107 virtual void abortOperation(); 00108 }; 00109 00110 00111 #endif // _MYPROGRESSDIALOG_H
1.3.9.1