src/video/windows/SDL_windowstaskdialog.h
author Alex Szpakowski <slime73@gmail.com>
Sat, 10 Nov 2018 16:15:48 -0400
changeset 12404 eb60e952b13f
parent 12046 8963fea8c431
child 12503 806492103856
permissions -rw-r--r--
Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id).

Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates).

Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
icculus@11917
     1
/*
icculus@11917
     2
  Simple DirectMedia Layer
icculus@11917
     3
  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
icculus@11917
     4
icculus@11917
     5
  This software is provided 'as-is', without any express or implied
icculus@11917
     6
  warranty.  In no event will the authors be held liable for any damages
icculus@11917
     7
  arising from the use of this software.
icculus@11917
     8
icculus@11917
     9
  Permission is granted to anyone to use this software for any purpose,
icculus@11917
    10
  including commercial applications, and to alter it and redistribute it
icculus@11917
    11
  freely, subject to the following restrictions:
icculus@11917
    12
icculus@11917
    13
  1. The origin of this software must not be misrepresented; you must not
icculus@11917
    14
     claim that you wrote the original software. If you use this software
icculus@11917
    15
     in a product, an acknowledgment in the product documentation would be
icculus@11917
    16
     appreciated but is not required.
icculus@11917
    17
  2. Altered source versions must be plainly marked as such, and must not be
icculus@11917
    18
     misrepresented as being the original software.
icculus@11917
    19
  3. This notice may not be removed or altered from any source distribution.
icculus@11917
    20
*/
icculus@11917
    21
#include <pshpack1.h>
icculus@11917
    22
slouken@11920
    23
typedef HRESULT(CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData);
icculus@11917
    24
icculus@11917
    25
enum _TASKDIALOG_FLAGS
icculus@11917
    26
{
icculus@11917
    27
    TDF_ENABLE_HYPERLINKS = 0x0001,
icculus@11917
    28
    TDF_USE_HICON_MAIN = 0x0002,
icculus@11917
    29
    TDF_USE_HICON_FOOTER = 0x0004,
icculus@11917
    30
    TDF_ALLOW_DIALOG_CANCELLATION = 0x0008,
icculus@11917
    31
    TDF_USE_COMMAND_LINKS = 0x0010,
icculus@11917
    32
    TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020,
icculus@11917
    33
    TDF_EXPAND_FOOTER_AREA = 0x0040,
icculus@11917
    34
    TDF_EXPANDED_BY_DEFAULT = 0x0080,
icculus@11917
    35
    TDF_VERIFICATION_FLAG_CHECKED = 0x0100,
icculus@11917
    36
    TDF_SHOW_PROGRESS_BAR = 0x0200,
icculus@11917
    37
    TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400,
icculus@11917
    38
    TDF_CALLBACK_TIMER = 0x0800,
icculus@11917
    39
    TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000,
icculus@11917
    40
    TDF_RTL_LAYOUT = 0x2000,
icculus@11917
    41
    TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000,
icculus@11917
    42
    TDF_CAN_BE_MINIMIZED = 0x8000,
icculus@11917
    43
    //#if (NTDDI_VERSION >= NTDDI_WIN8)
icculus@11917
    44
    TDF_NO_SET_FOREGROUND = 0x00010000, // Don't call SetForegroundWindow() when activating the dialog
icculus@11917
    45
                                        //#endif // (NTDDI_VERSION >= NTDDI_WIN8)
icculus@11917
    46
                                        TDF_SIZE_TO_CONTENT = 0x01000000  // used by ShellMessageBox to emulate MessageBox sizing behavior
icculus@11917
    47
};
icculus@11917
    48
typedef int TASKDIALOG_FLAGS;                         // Note: _TASKDIALOG_FLAGS is an int
icculus@11917
    49
icculus@11917
    50
typedef enum _TASKDIALOG_MESSAGES
icculus@11917
    51
{
icculus@11917
    52
    TDM_NAVIGATE_PAGE = WM_USER + 101,
icculus@11917
    53
    TDM_CLICK_BUTTON = WM_USER + 102, // wParam = Button ID
icculus@11917
    54
    TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103, // wParam = 0 (nonMarque) wParam != 0 (Marquee)
icculus@11917
    55
    TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104, // wParam = new progress state
icculus@11917
    56
    TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105, // lParam = MAKELPARAM(nMinRange, nMaxRange)
icculus@11917
    57
    TDM_SET_PROGRESS_BAR_POS = WM_USER + 106, // wParam = new position
icculus@11917
    58
    TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
icculus@11917
    59
    TDM_SET_ELEMENT_TEXT = WM_USER + 108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
icculus@11917
    60
    TDM_CLICK_RADIO_BUTTON = WM_USER + 110, // wParam = Radio Button ID
icculus@11917
    61
    TDM_ENABLE_BUTTON = WM_USER + 111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
icculus@11917
    62
    TDM_ENABLE_RADIO_BUTTON = WM_USER + 112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
icculus@11917
    63
    TDM_CLICK_VERIFICATION = WM_USER + 113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
icculus@11917
    64
    TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
icculus@11917
    65
    TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
icculus@11917
    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)
icculus@11917
    67
} TASKDIALOG_MESSAGES;
icculus@11917
    68
icculus@11917
    69
typedef enum _TASKDIALOG_NOTIFICATIONS
icculus@11917
    70
{
icculus@11917
    71
    TDN_CREATED = 0,
icculus@11917
    72
    TDN_NAVIGATED = 1,
icculus@11917
    73
    TDN_BUTTON_CLICKED = 2,            // wParam = Button ID
icculus@11917
    74
    TDN_HYPERLINK_CLICKED = 3,            // lParam = (LPCWSTR)pszHREF
icculus@11917
    75
    TDN_TIMER = 4,            // wParam = Milliseconds since dialog created or timer reset
icculus@11917
    76
    TDN_DESTROYED = 5,
icculus@11917
    77
    TDN_RADIO_BUTTON_CLICKED = 6,            // wParam = Radio Button ID
icculus@11917
    78
    TDN_DIALOG_CONSTRUCTED = 7,
icculus@11917
    79
    TDN_VERIFICATION_CLICKED = 8,             // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
icculus@11917
    80
    TDN_HELP = 9,
icculus@11917
    81
    TDN_EXPANDO_BUTTON_CLICKED = 10            // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
icculus@11917
    82
} TASKDIALOG_NOTIFICATIONS;
icculus@11917
    83
icculus@11917
    84
typedef struct _TASKDIALOG_BUTTON
icculus@11917
    85
{
icculus@11917
    86
    int     nButtonID;
icculus@11917
    87
    PCWSTR  pszButtonText;
icculus@11917
    88
} TASKDIALOG_BUTTON;
icculus@11917
    89
icculus@11917
    90
typedef enum _TASKDIALOG_ELEMENTS
icculus@11917
    91
{
icculus@11917
    92
    TDE_CONTENT,
icculus@11917
    93
    TDE_EXPANDED_INFORMATION,
icculus@11917
    94
    TDE_FOOTER,
icculus@11917
    95
    TDE_MAIN_INSTRUCTION
icculus@11917
    96
} TASKDIALOG_ELEMENTS;
icculus@11917
    97
icculus@11917
    98
typedef enum _TASKDIALOG_ICON_ELEMENTS
icculus@11917
    99
{
icculus@11917
   100
    TDIE_ICON_MAIN,
icculus@11917
   101
    TDIE_ICON_FOOTER
icculus@11917
   102
} TASKDIALOG_ICON_ELEMENTS;
icculus@11917
   103
icculus@11917
   104
#define TD_WARNING_ICON         MAKEINTRESOURCEW(-1)
icculus@11917
   105
#define TD_ERROR_ICON           MAKEINTRESOURCEW(-2)
icculus@11917
   106
#define TD_INFORMATION_ICON     MAKEINTRESOURCEW(-3)
icculus@11917
   107
#define TD_SHIELD_ICON          MAKEINTRESOURCEW(-4)
icculus@11917
   108
icculus@11917
   109
enum _TASKDIALOG_COMMON_BUTTON_FLAGS
icculus@11917
   110
{
icculus@11917
   111
    TDCBF_OK_BUTTON = 0x0001, // selected control return value IDOK
icculus@11917
   112
    TDCBF_YES_BUTTON = 0x0002, // selected control return value IDYES
icculus@11917
   113
    TDCBF_NO_BUTTON = 0x0004, // selected control return value IDNO
icculus@11917
   114
    TDCBF_CANCEL_BUTTON = 0x0008, // selected control return value IDCANCEL
icculus@11917
   115
    TDCBF_RETRY_BUTTON = 0x0010, // selected control return value IDRETRY
icculus@11917
   116
    TDCBF_CLOSE_BUTTON = 0x0020  // selected control return value IDCLOSE
icculus@11917
   117
};
icculus@11917
   118
typedef int TASKDIALOG_COMMON_BUTTON_FLAGS;           // Note: _TASKDIALOG_COMMON_BUTTON_FLAGS is an int
icculus@11917
   119
icculus@11917
   120
typedef struct _TASKDIALOGCONFIG
icculus@11917
   121
{
icculus@11917
   122
    UINT        cbSize;
icculus@11917
   123
    HWND        hwndParent;                             // incorrectly named, this is the owner window, not a parent.
icculus@11917
   124
    HINSTANCE   hInstance;                              // used for MAKEINTRESOURCE() strings
icculus@11917
   125
    TASKDIALOG_FLAGS                dwFlags;            // TASKDIALOG_FLAGS (TDF_XXX) flags
icculus@11917
   126
    TASKDIALOG_COMMON_BUTTON_FLAGS  dwCommonButtons;    // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags
icculus@11917
   127
    PCWSTR      pszWindowTitle;                         // string or MAKEINTRESOURCE()
icculus@11917
   128
    union
icculus@11917
   129
    {
icculus@11917
   130
        HICON   hMainIcon;
icculus@11917
   131
        PCWSTR  pszMainIcon;
sezeroz@12046
   132
    } /*DUMMYUNIONNAME*/;
icculus@11917
   133
    PCWSTR      pszMainInstruction;
icculus@11917
   134
    PCWSTR      pszContent;
icculus@11917
   135
    UINT        cButtons;
icculus@11917
   136
    const TASKDIALOG_BUTTON  *pButtons;
icculus@11917
   137
    int         nDefaultButton;
icculus@11917
   138
    UINT        cRadioButtons;
icculus@11917
   139
    const TASKDIALOG_BUTTON  *pRadioButtons;
icculus@11917
   140
    int         nDefaultRadioButton;
icculus@11917
   141
    PCWSTR      pszVerificationText;
icculus@11917
   142
    PCWSTR      pszExpandedInformation;
icculus@11917
   143
    PCWSTR      pszExpandedControlText;
icculus@11917
   144
    PCWSTR      pszCollapsedControlText;
icculus@11917
   145
    union
icculus@11917
   146
    {
icculus@11917
   147
        HICON   hFooterIcon;
icculus@11917
   148
        PCWSTR  pszFooterIcon;
sezeroz@12046
   149
    } /*DUMMYUNIONNAME2*/;
icculus@11917
   150
    PCWSTR      pszFooter;
icculus@11917
   151
    PFTASKDIALOGCALLBACK pfCallback;
icculus@11917
   152
    LONG_PTR    lpCallbackData;
icculus@11917
   153
    UINT        cxWidth;                                // width of the Task Dialog's client area in DLU's. If 0, Task Dialog will calculate the ideal width.
icculus@11917
   154
} TASKDIALOGCONFIG;
icculus@11917
   155
icculus@11917
   156
#include <poppack.h>