Commit e2245bcd authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

comctl32/taskdialog: Move TaskDialogIndirect and its tests into own source files.

parent 253f233e
......@@ -30,6 +30,7 @@ C_SRCS = \
string.c \
syslink.c \
tab.c \
taskdialog.c \
theme_button.c \
theme_combo.c \
theme_dialog.c \
......
......@@ -1622,45 +1622,6 @@ int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD
}
/***********************************************************************
* 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.@]
*/
HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy, HICON *icon)
......
/*
* 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 \
syslink.c \
tab.c \
taskdialog.c \
toolbar.c \
tooltips.c \
trackbar.c \
......
......@@ -200,24 +200,6 @@ static void test_Alloc(void)
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 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;
test_builtin_classes();
test_TaskDialogIndirect();
test_LoadIconWithScaleDown();
unload_v6_module(ctx_cookie, hCtx);
......
/* 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment