Commit 147cf1da authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

mshtml: Added HTMLWindow2_prompt implementation.

parent 3a54e89f
......@@ -53,3 +53,14 @@ FONT 8, "MS Shell Dlg"
PUSHBUTTON "OK", IDOK, 200, 10, 45, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 200, 28, 45, 14, WS_GROUP | WS_TABSTOP
}
ID_PROMPT_DIALOG DIALOG 0, 0, 200, 90
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
{
LTEXT "", ID_PROMPT_PROMPT, 10, 10, 180, 30
EDITTEXT ID_PROMPT_EDIT, 10, 45, 180, 14, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
}
......@@ -230,12 +230,93 @@ static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
return E_NOTIMPL;
}
typedef struct
{
BSTR message;
BSTR dststr;
VARIANT *textdata;
}prompt_arg;
static INT_PTR CALLBACK prompt_dlgproc(HWND hwnd, UINT msg,
WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
prompt_arg *arg = (prompt_arg*)lparam;
WCHAR wszTitle[100];
if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
sizeof(wszTitle)/sizeof(WCHAR))) {
WARN("Could not load message box title: %d\n", GetLastError());
EndDialog(hwnd, wparam);
return FALSE;
}
SetWindowLongPtrW(hwnd, DWLP_USER, lparam);
SetWindowTextW(hwnd, wszTitle);
SetWindowTextW(GetDlgItem(hwnd, ID_PROMPT_PROMPT), arg->message);
SetWindowTextW(GetDlgItem(hwnd, ID_PROMPT_EDIT), arg->dststr);
return FALSE;
}
case WM_COMMAND:
switch(wparam)
{
case MAKEWPARAM(IDCANCEL, BN_CLICKED):
EndDialog(hwnd, wparam);
return TRUE;
case MAKEWPARAM(IDOK, BN_CLICKED):
{
prompt_arg *arg =
(prompt_arg*)GetWindowLongPtrW(hwnd, DWLP_USER);
HWND hwndPrompt = GetDlgItem(hwnd, ID_PROMPT_EDIT);
INT len = GetWindowTextLengthW(hwndPrompt);
if(!arg->textdata)
{
EndDialog(hwnd, wparam);
return TRUE;
}
V_VT(arg->textdata) = VT_BSTR;
if(!len && !arg->dststr)
V_BSTR(arg->textdata) = NULL;
else
{
V_BSTR(arg->textdata) = SysAllocStringLen(NULL, len);
GetWindowTextW(hwndPrompt, V_BSTR(arg->textdata), len+1);
}
EndDialog(hwnd, wparam);
return TRUE;
}
}
return FALSE;
case WM_CLOSE:
EndDialog(hwnd, IDCANCEL);
return TRUE;
default:
return FALSE;
}
}
static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
BSTR dststr, VARIANT *textdata)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata);
return E_NOTIMPL;
prompt_arg arg;
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata);
if(textdata) V_VT(textdata) = VT_NULL;
arg.message = message;
arg.dststr = dststr;
arg.textdata = textdata;
DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG),
This->doc->hwnd, prompt_dlgproc, (LPARAM)&arg);
return S_OK;
}
static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p)
......
......@@ -26,6 +26,10 @@
#define ID_DWL_INSTALL 7602
#define ID_DWL_STATUS 7603
#define ID_PROMPT_DIALOG 7700
#define ID_PROMPT_PROMPT 7701
#define ID_PROMPT_EDIT 7702
#define IDS_MESSAGE_BOX_TITLE 2213
#define IDS_PRINT_HEADER_TEMPLATE 8403
......
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