1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 * A wrapper class for the IProgressDialog interface. Thats
\r
24 * the dialog used by the shell/IE to show progress in e.g.
\r
25 * copying, downloading, ...
\r
27 * \remark you need to call AfxOleInit() before using this class, preferably in
\r
28 * your app's InitInistance() method.
\r
37 * sets the title of the progress dialog box.
\r
38 * \param szTitle pointer to a NULL-terminated string that contains the dialog box title
\r
40 void SetTitle ( LPCTSTR szTitle );
\r
42 * sets the title of the progress dialog box to a string resource value.
\r
44 void SetTitle ( UINT idTitle);
\r
47 * Displays a message.
\r
48 * \param dwLine line number on which the text is to be displayed. There are three lines possible, two lines if SetCalculateTime() is set to true.
\r
49 * \param szText NULL-terminated string that contains the line text.
\r
50 * \param bCompactPath set to true if you want the text to be compacted (if it is a path) to fit on the line.
\r
52 * \remark This call should be made *after* the dialog has been shown - this allows
\r
53 * the system to measure the space available for the text, and do path compaction properly
\r
55 void SetLine ( DWORD dwLine, LPCTSTR szText, bool bCompactPath = false );
\r
59 * Wrappers around set line, to do a CString::Format type operation
\r
60 * See SetLine for more details
\r
62 * \remark These calls should be made *after* the dialog has been shown - this allows
\r
63 * the system to measure the space available for the text, and do path compaction properly
\r
65 void FormatPathLine ( DWORD dwLine, UINT idFormatText, ...);
\r
66 void FormatNonPathLine ( DWORD dwLine, UINT idFormatText, ...);
\r
69 * Sets a message to be displayed if the user clicks the cancel button.
\r
70 * \param szMessage pointer to a NULL-terminated string that contains the message.
\r
71 * \remark Even though the user clicks Cancel, the application cannot immediately
\r
72 * call Stop() to close the dialog box. The application
\r
73 * must wait until the next time it calls HasUserCancelled() to
\r
74 * discover that the user has canceled the operation. Since this delay might be
\r
75 * significant, the progress dialog box provides the user with immediate feedback
\r
76 * by clearing text lines 1 and 2 and displaying the cancel message on line 3.
\r
77 * The message is intended to let the user know that the delay is normal and that
\r
78 * the progress dialog box will be closed shortly. It is typically is set to
\r
79 * something like "Please wait while ...".
\r
81 void SetCancelMsg ( LPCTSTR szMessage );
\r
83 void SetCancelMsg ( UINT idMessage );
\r
85 * Specifies an AVI-clip that will run in the dialog box.
\r
86 * \param uRsrcID AVI resource identifier. To create this value use the MAKEINTRESOURCE macro.
\r
88 void SetAnimation ( UINT uRsrcID );
\r
91 * Specifies an AVI-clip that will run in the dialog box.
\r
92 * \param hinst instance handle to the module from which the avi resource should be loaded.
\r
93 * \param uRsrcID AVI resource identifier. To create this value use the MAKEINTRESOURCE macro.
\r
95 void SetAnimation ( HINSTANCE hinst, UINT uRsrcID );
\r
98 * Specifies that the progress dialog should have a line indicating the time remaining to complete.
\r
99 * \param bCalculate false to deactivate the time remaining line.
\r
101 void SetTime ( bool bTime = true );
\r
104 * Specifies if the progress bar should be shown or not.
\r
106 void SetShowProgressBar ( bool bShow = true );
\r
109 * Resets the progress dialog box timer to zero.
\r
110 * \remark the timer is used to estimate the remaining time. It is started when your
\r
111 * application calls ShowModal() or ShowModeless(). Unless your application will
\r
112 * start immediately, it should call ResetTimer() just before starting the operation.
\r
113 * This practice ensures that the time estimates will be as accurate as possible.
\r
114 * This method should not be called after the first call to UpdateProgress().
\r
119 * Shows the progress dialog box modal.
\r
122 HRESULT ShowModal ( CWnd* pwndParent );
\r
124 HRESULT ShowModal ( HWND hWndParent );
\r
126 * Shows the progress dialog box modeless.
\r
129 HRESULT ShowModeless ( CWnd* pwndParent );
\r
131 HRESULT ShowModeless ( HWND hWndParent );
\r
134 * Stops the progress dialog box and removes it from the screen.
\r
139 * Updates the progress dialog box with the current state of the operation.
\r
140 * \param dwProgress Application-defined value that indicates what proportion of the operation has been completed at the time the method was called
\r
141 * \param dwMax Application-defined value that specifies what value dwCompleted will have when the operation is complete
\r
143 void SetProgress ( DWORD dwProgress, DWORD dwMax );
\r
145 * Updates the progress dialog box with the current state of the operation.
\r
146 * \param u64Progress Application-defined value that indicates what proportion of the operation has been completed at the time the method was called
\r
147 * \param u64ProgressMax Application-defined value that specifies what value dwCompleted will have when the operation is complete
\r
149 void SetProgress64 ( ULONGLONG u64Progress, ULONGLONG u64ProgressMax );
\r
152 * Checks whether the user has canceled the operation.
\r
154 bool HasUserCancelled();
\r
157 * Checks whether this object was created successfully. If the return value is false then
\r
158 * you MUST NOT use the current instance of this class.
\r
160 bool IsValid() const { return m_bValid; }
\r
163 * Checks whether the window is shown.
\r
165 bool IsVisible() const { return m_isVisible; }
\r
168 * After a call to Stop() to hide the progress dialog,
\r
169 * call EnsureValid() to recreate the dialog and fill in the
\r
172 bool EnsureValid();
\r
175 IProgressDialog* m_pIDlg;
\r
178 DWORD m_dwDlgFlags;
\r