blob: a476f7884a85d89e473da3eabcc8c8c94ec8e726 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* ProgressDialog.h
* ----------------
* Purpose: An abortable, progress-indicating dialog, e.g. for showing conversion progress.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
OPENMPT_NAMESPACE_BEGIN
class CProgressDialog : public CDialog
{
private:
ITaskbarList3 *m_taskBarList = nullptr;
uint64 m_min = 0, m_max = 0, m_shift = 0;
const bool m_customDialog;
public:
bool m_abort = false;
CProgressDialog(CWnd *parent = nullptr, UINT resourceID = 0);
~CProgressDialog();
// Set the window title
void SetTitle(const TCHAR *title);
// Set the text on abort button
void SetAbortText(const TCHAR *abort);
// Set the text to be displayed along the progress bar.
void SetText(const TCHAR *text);
// Set the minimum and maximum value of the progress bar.
void SetRange(uint64 min, uint64 max);
// Set the current progress.
void SetProgress(uint64 progress);
// Show the progress in the task bar as well
void EnableTaskbarProgress();
// Process all queued Windows messages
void ProcessMessages();
// Run method for this dialog that must implement the action to be carried out - unless a custom resourceID was provided,
// in which case the user is responsible for running the dialog and the implementation of this function may be a no-op.
virtual void Run() = 0;
protected:
BOOL OnInitDialog() override;
void OnCancel() override { m_abort = true; }
DECLARE_MESSAGE_MAP()
};
OPENMPT_NAMESPACE_END
|