comctl32/taskdialog: Move TaskDialogIndirect and its tests into own source files.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
253f233e52
commit
e2245bcd3c
@ -30,6 +30,7 @@ C_SRCS = \
|
|||||||
string.c \
|
string.c \
|
||||||
syslink.c \
|
syslink.c \
|
||||||
tab.c \
|
tab.c \
|
||||||
|
taskdialog.c \
|
||||||
theme_button.c \
|
theme_button.c \
|
||||||
theme_combo.c \
|
theme_combo.c \
|
||||||
theme_dialog.c \
|
theme_dialog.c \
|
||||||
|
@ -1621,45 +1621,6 @@ int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* TaskDialogIndirect [COMCTL32.@]
|
|
||||||
*/
|
|
||||||
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
|
|
||||||
int *pnRadioButton, BOOL *pfVerificationFlagChecked)
|
|
||||||
{
|
|
||||||
UINT uType = 0;
|
|
||||||
INT ret;
|
|
||||||
FIXME("%p, %p, %p, %p\n", pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
|
|
||||||
|
|
||||||
if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
|
|
||||||
pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON &&
|
|
||||||
pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
|
||||||
uType |= MB_YESNOCANCEL;
|
|
||||||
else
|
|
||||||
if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
|
|
||||||
pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON)
|
|
||||||
uType |= MB_YESNO;
|
|
||||||
else
|
|
||||||
if (pTaskConfig->dwCommonButtons & TDCBF_RETRY_BUTTON &&
|
|
||||||
pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
|
||||||
uType |= MB_RETRYCANCEL;
|
|
||||||
else
|
|
||||||
if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON &&
|
|
||||||
pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
|
||||||
uType |= MB_OKCANCEL;
|
|
||||||
else
|
|
||||||
if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON)
|
|
||||||
uType |= MB_OK;
|
|
||||||
ret = MessageBoxW(pTaskConfig->hwndParent, pTaskConfig->pszMainInstruction,
|
|
||||||
pTaskConfig->pszWindowTitle, uType);
|
|
||||||
FIXME("dwCommonButtons=%x uType=%x ret=%x\n", pTaskConfig->dwCommonButtons, uType, ret);
|
|
||||||
|
|
||||||
if (pnButton) *pnButton = ret;
|
|
||||||
if (pnRadioButton) *pnRadioButton = pTaskConfig->nDefaultButton;
|
|
||||||
if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* LoadIconWithScaleDown [COMCTL32.@]
|
* LoadIconWithScaleDown [COMCTL32.@]
|
||||||
*/
|
*/
|
||||||
|
76
dlls/comctl32/taskdialog.c
Normal file
76
dlls/comctl32/taskdialog.c
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Task dialog control
|
||||||
|
*
|
||||||
|
* Copyright 2017 Fabian Maurer
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "commctrl.h"
|
||||||
|
#include "winerror.h"
|
||||||
|
#include "comctl32.h"
|
||||||
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(taskdialog);
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* TaskDialogIndirect [COMCTL32.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button,
|
||||||
|
int *radio_button, BOOL *verification_flag_checked)
|
||||||
|
{
|
||||||
|
UINT type = 0;
|
||||||
|
INT ret;
|
||||||
|
|
||||||
|
TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked);
|
||||||
|
|
||||||
|
if (taskconfig->dwCommonButtons & TDCBF_YES_BUTTON &&
|
||||||
|
taskconfig->dwCommonButtons & TDCBF_NO_BUTTON &&
|
||||||
|
taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
||||||
|
type |= MB_YESNOCANCEL;
|
||||||
|
else
|
||||||
|
if (taskconfig->dwCommonButtons & TDCBF_YES_BUTTON &&
|
||||||
|
taskconfig->dwCommonButtons & TDCBF_NO_BUTTON)
|
||||||
|
type |= MB_YESNO;
|
||||||
|
else
|
||||||
|
if (taskconfig->dwCommonButtons & TDCBF_RETRY_BUTTON &&
|
||||||
|
taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
||||||
|
type |= MB_RETRYCANCEL;
|
||||||
|
else
|
||||||
|
if (taskconfig->dwCommonButtons & TDCBF_OK_BUTTON &&
|
||||||
|
taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
|
||||||
|
type |= MB_OKCANCEL;
|
||||||
|
else
|
||||||
|
if (taskconfig->dwCommonButtons & TDCBF_OK_BUTTON)
|
||||||
|
type |= MB_OK;
|
||||||
|
|
||||||
|
ret = MessageBoxW(taskconfig->hwndParent, taskconfig->pszMainInstruction,
|
||||||
|
taskconfig->pszWindowTitle, type);
|
||||||
|
|
||||||
|
FIXME("dwCommonButtons=%x type=%x ret=%x\n", taskconfig->dwCommonButtons, type, ret);
|
||||||
|
|
||||||
|
if (button) *button = ret;
|
||||||
|
if (radio_button) *radio_button = taskconfig->nDefaultButton;
|
||||||
|
if (verification_flag_checked) *verification_flag_checked = TRUE;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
@ -22,6 +22,7 @@ C_SRCS = \
|
|||||||
subclass.c \
|
subclass.c \
|
||||||
syslink.c \
|
syslink.c \
|
||||||
tab.c \
|
tab.c \
|
||||||
|
taskdialog.c \
|
||||||
toolbar.c \
|
toolbar.c \
|
||||||
tooltips.c \
|
tooltips.c \
|
||||||
trackbar.c \
|
trackbar.c \
|
||||||
|
@ -200,24 +200,6 @@ static void test_Alloc(void)
|
|||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_TaskDialogIndirect(void)
|
|
||||||
{
|
|
||||||
HINSTANCE hinst;
|
|
||||||
void *ptr, *ptr2;
|
|
||||||
|
|
||||||
hinst = LoadLibraryA("comctl32.dll");
|
|
||||||
|
|
||||||
ptr = GetProcAddress(hinst, "TaskDialogIndirect");
|
|
||||||
if (!ptr)
|
|
||||||
{
|
|
||||||
win_skip("TaskDialogIndirect not exported by name\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr2 = GetProcAddress(hinst, (const CHAR*)345);
|
|
||||||
ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_LoadIconWithScaleDown(void)
|
static void test_LoadIconWithScaleDown(void)
|
||||||
{
|
{
|
||||||
static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0};
|
static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0};
|
||||||
@ -402,7 +384,6 @@ START_TEST(misc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
test_builtin_classes();
|
test_builtin_classes();
|
||||||
test_TaskDialogIndirect();
|
|
||||||
test_LoadIconWithScaleDown();
|
test_LoadIconWithScaleDown();
|
||||||
|
|
||||||
unload_v6_module(ctx_cookie, hCtx);
|
unload_v6_module(ctx_cookie, hCtx);
|
||||||
|
58
dlls/comctl32/tests/taskdialog.c
Normal file
58
dlls/comctl32/tests/taskdialog.c
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* Unit tests for the task dialog control.
|
||||||
|
*
|
||||||
|
* Copyright 2017 Fabian Maurer for the Wine project
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "commctrl.h"
|
||||||
|
|
||||||
|
#include "wine/test.h"
|
||||||
|
#include "v6util.h"
|
||||||
|
|
||||||
|
static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, int *, BOOL *);
|
||||||
|
|
||||||
|
START_TEST(taskdialog)
|
||||||
|
{
|
||||||
|
ULONG_PTR ctx_cookie;
|
||||||
|
void *ptr_ordinal;
|
||||||
|
HINSTANCE hinst;
|
||||||
|
HANDLE hCtx;
|
||||||
|
|
||||||
|
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Check if task dialogs are available */
|
||||||
|
hinst = LoadLibraryA("comctl32.dll");
|
||||||
|
|
||||||
|
pTaskDialogIndirect = (void *)GetProcAddress(hinst, "TaskDialogIndirect");
|
||||||
|
if (!pTaskDialogIndirect)
|
||||||
|
{
|
||||||
|
win_skip("TaskDialogIndirect not exported by name\n");
|
||||||
|
unload_v6_module(ctx_cookie, hCtx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr_ordinal = GetProcAddress(hinst, (const char *)345);
|
||||||
|
ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n",
|
||||||
|
ptr_ordinal, pTaskDialogIndirect);
|
||||||
|
|
||||||
|
unload_v6_module(ctx_cookie, hCtx);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user