SDL  2.0
SDL_windowstaskdialog.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include <pshpack1.h>
22 
23 typedef HRESULT(CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData);
24 
26 {
40  TDF_RTL_LAYOUT = 0x2000,
43  //#if (NTDDI_VERSION >= NTDDI_WIN8)
44  TDF_NO_SET_FOREGROUND = 0x00010000, // Don't call SetForegroundWindow() when activating the dialog
45  //#endif // (NTDDI_VERSION >= NTDDI_WIN8)
46  TDF_SIZE_TO_CONTENT = 0x01000000 // used by ShellMessageBox to emulate MessageBox sizing behavior
47 };
48 typedef int TASKDIALOG_FLAGS; // Note: _TASKDIALOG_FLAGS is an int
49 
50 typedef enum _TASKDIALOG_MESSAGES
51 {
52  TDM_NAVIGATE_PAGE = WM_USER + 101,
53  TDM_CLICK_BUTTON = WM_USER + 102, // wParam = Button ID
54  TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103, // wParam = 0 (nonMarque) wParam != 0 (Marquee)
55  TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104, // wParam = new progress state
56  TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105, // lParam = MAKELPARAM(nMinRange, nMaxRange)
57  TDM_SET_PROGRESS_BAR_POS = WM_USER + 106, // wParam = new position
58  TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
59  TDM_SET_ELEMENT_TEXT = WM_USER + 108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
60  TDM_CLICK_RADIO_BUTTON = WM_USER + 110, // wParam = Radio Button ID
61  TDM_ENABLE_BUTTON = WM_USER + 111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
62  TDM_ENABLE_RADIO_BUTTON = WM_USER + 112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
63  TDM_CLICK_VERIFICATION = WM_USER + 113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
64  TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
65  TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
66  TDM_UPDATE_ICON = WM_USER + 116 // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
68 
69 typedef enum _TASKDIALOG_NOTIFICATIONS
70 {
73  TDN_BUTTON_CLICKED = 2, // wParam = Button ID
74  TDN_HYPERLINK_CLICKED = 3, // lParam = (LPCWSTR)pszHREF
75  TDN_TIMER = 4, // wParam = Milliseconds since dialog created or timer reset
77  TDN_RADIO_BUTTON_CLICKED = 6, // wParam = Radio Button ID
79  TDN_VERIFICATION_CLICKED = 8, // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
80  TDN_HELP = 9,
81  TDN_EXPANDO_BUTTON_CLICKED = 10 // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
83 
84 typedef struct _TASKDIALOG_BUTTON
85 {
86  int nButtonID;
87  PCWSTR pszButtonText;
89 
90 typedef enum _TASKDIALOG_ELEMENTS
91 {
97 
98 typedef enum _TASKDIALOG_ICON_ELEMENTS
99 {
103 
104 #define TD_WARNING_ICON MAKEINTRESOURCEW(-1)
105 #define TD_ERROR_ICON MAKEINTRESOURCEW(-2)
106 #define TD_INFORMATION_ICON MAKEINTRESOURCEW(-3)
107 #define TD_SHIELD_ICON MAKEINTRESOURCEW(-4)
108 
110 {
111  TDCBF_OK_BUTTON = 0x0001, // selected control return value IDOK
112  TDCBF_YES_BUTTON = 0x0002, // selected control return value IDYES
113  TDCBF_NO_BUTTON = 0x0004, // selected control return value IDNO
114  TDCBF_CANCEL_BUTTON = 0x0008, // selected control return value IDCANCEL
115  TDCBF_RETRY_BUTTON = 0x0010, // selected control return value IDRETRY
116  TDCBF_CLOSE_BUTTON = 0x0020 // selected control return value IDCLOSE
117 };
118 typedef int TASKDIALOG_COMMON_BUTTON_FLAGS; // Note: _TASKDIALOG_COMMON_BUTTON_FLAGS is an int
119 
120 typedef struct _TASKDIALOGCONFIG
121 {
122  UINT cbSize;
123  HWND hwndParent; // incorrectly named, this is the owner window, not a parent.
124  HINSTANCE hInstance; // used for MAKEINTRESOURCE() strings
125  TASKDIALOG_FLAGS dwFlags; // TASKDIALOG_FLAGS (TDF_XXX) flags
126  TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons; // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags
127  PCWSTR pszWindowTitle; // string or MAKEINTRESOURCE()
128  union
129  {
130  HICON hMainIcon;
131  PCWSTR pszMainIcon;
132  } /*DUMMYUNIONNAME*/;
134  PCWSTR pszContent;
135  UINT cButtons;
145  union
146  {
147  HICON hFooterIcon;
149  } /*DUMMYUNIONNAME2*/;
150  PCWSTR pszFooter;
152  LONG_PTR lpCallbackData;
153  UINT cxWidth; // width of the Task Dialog's client area in DLU's. If 0, Task Dialog will calculate the ideal width.
155 
156 #include <poppack.h>
TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons
const TASKDIALOG_BUTTON * pRadioButtons
PFTASKDIALOGCALLBACK pfCallback
HRESULT(CALLBACK * PFTASKDIALOGCALLBACK)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData)
_TASKDIALOG_COMMON_BUTTON_FLAGS
TASKDIALOG_NOTIFICATIONS
TASKDIALOG_ICON_ELEMENTS
TASKDIALOG_ELEMENTS
int TASKDIALOG_COMMON_BUTTON_FLAGS
_TASKDIALOG_FLAGS
const TASKDIALOG_BUTTON * pButtons
TASKDIALOG_FLAGS dwFlags
int TASKDIALOG_FLAGS
TASKDIALOG_MESSAGES