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 #include <appbase/ProgressDisplayOld.h>
00031 #include <appbase/ProgressReporterOld.h>
00032 
00033 class WXIMPEX ProgressReporterDialog : public AppBase::ProgressReporter, public wxProgressDialog
00034 {
00035 public:
00036     ProgressReporterDialog(double maxProgress, const wxString& title, const wxString& message,
00037                          wxWindow * parent = NULL, 
00038                          int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME,
00039                          const wxSize & sz = wxDefaultSize)
00040     : wxProgressDialog(title, message+wxString((wxChar)' ',10), 100, parent, style), 
00041       m_progress(0),m_maxProgress(maxProgress), m_abort(false)
00042       {  };
00043 
00044     virtual ~ProgressReporterDialog();
00045 
00046     virtual bool increaseProgress(double delta);
00047     virtual bool increaseProgress(double delta, const std::string & msg);
00048     
00049     // TODO entire ProgressReporter and ProgressDisplay API needs be updated to use wstring.
00050     // Temporarily implemented only for this function. from here -->
00051     virtual bool increaseProgress(double delta, const std::wstring & msg);
00052     // <- to here
00053 
00054     virtual void setMessage(const std::string & msg);
00055 
00056 protected:
00057     double m_progress;
00058     double m_maxProgress;
00059     wxString m_message;
00060     bool m_abort;
00061 };
00062 
00067 class WXIMPEX MyProgressDialog : public wxProgressDialog, public AppBase::MultiProgressDisplay
00068 {
00069 public:
00072     MyProgressDialog(const wxString& title, const wxString& message,
00073                      wxWindow * parent = NULL, 
00074                      int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL,
00075                      const wxSize & sz = wxDefaultSize)
00076         : wxProgressDialog(title, message, 100, parent, style)
00077         { 
00078             SetSize(sz);
00079         }
00082     virtual ~MyProgressDialog() {};
00083 
00085     virtual void updateProgressDisplay();
00086 
00087     // override to abort the current operation.
00088     virtual void abortOperation()
00089     {
00090         DEBUG_TRACE("");
00091     }
00092 private:
00093 };
00094 
00095 class OptProgressDialog : public MyProgressDialog
00096 {
00097 public:
00098     // work around a flaw in wxProgresDialog that results in incorrect layout
00099         // by pre-allocting sufficient horizontal and vertical space
00100     OptProgressDialog(wxWindow * parent = NULL,
00101                       int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT )
00102         : MyProgressDialog(_("Optimizing Panorama"), (wxString((wxChar)' ', 80) + wxT("\n \n \n \n ")), parent, style)
00103         { }
00104 
00105     virtual void abortOperation();
00106 };
00107 
00108 
00109 #endif // _MYPROGRESSDIALOG_H

Generated on 5 Dec 2014 for Hugintrunk by  doxygen 1.4.7