1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: wx/msw/progdlg.h 3 // Purpose: wxProgressDialog 4 // Author: Rickard Westerlund 5 // Created: 2010-07-22 6 // Copyright: (c) 2010 wxWidgets team 7 // Licence: wxWindows licence 8 ///////////////////////////////////////////////////////////////////////////// 9 10 #ifndef _WX_PROGDLG_H_ 11 #define _WX_PROGDLG_H_ 12 13 class wxProgressDialogTaskRunner; 14 class wxProgressDialogSharedData; 15 16 class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog 17 { 18 public: 19 wxProgressDialog(const wxString& title, const wxString& message, 20 int maximum = 100, 21 wxWindow *parent = NULL, 22 int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); 23 24 virtual ~wxProgressDialog(); 25 26 virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL) wxOVERRIDE; 27 virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL) wxOVERRIDE; 28 29 virtual void Resume() wxOVERRIDE; 30 31 virtual int GetValue() const wxOVERRIDE; 32 virtual wxString GetMessage() const wxOVERRIDE; 33 34 virtual void SetRange(int maximum) wxOVERRIDE; 35 36 // Return whether "Cancel" or "Skip" button was pressed, always return 37 // false if the corresponding button is not shown. 38 virtual bool WasSkipped() const wxOVERRIDE; 39 virtual bool WasCancelled() const wxOVERRIDE; 40 41 virtual void SetTitle(const wxString& title) wxOVERRIDE; 42 virtual wxString GetTitle() const wxOVERRIDE; 43 44 virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; 45 virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; 46 virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; 47 virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; 48 virtual void Fit() wxOVERRIDE; 49 50 virtual bool Show( bool show = true ) wxOVERRIDE; 51 52 // Must provide overload to avoid hiding it (and warnings about it) Update()53 virtual void Update() wxOVERRIDE { wxGenericProgressDialog::Update(); } 54 55 virtual WXWidget GetHandle() const wxOVERRIDE; 56 57 private: 58 // Common part of Update() and Pulse(). 59 // 60 // Returns false if the user requested cancelling the dialog. 61 bool DoNativeBeforeUpdate(bool *skip); 62 63 // Dispatch the pending events to let the windows to update, just as the 64 // generic version does. This is done as part of DoNativeBeforeUpdate(). 65 void DispatchEvents(); 66 67 // Updates the various timing information for both determinate 68 // and indeterminate modes. Requires the shared object to have 69 // been entered. 70 void UpdateExpandedInformation(int value); 71 72 // Get the task dialog geometry when using the native dialog. 73 wxRect GetTaskDialogRect() const; 74 75 76 wxProgressDialogTaskRunner *m_taskDialogRunner; 77 78 wxProgressDialogSharedData *m_sharedData; 79 80 // Store the message and title we currently use to be able to return it 81 // from Get{Message,Title}() 82 wxString m_message, 83 m_title; 84 85 wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProgressDialog); 86 }; 87 88 #endif // _WX_PROGDLG_H_ 89