comdlg32: Implement support for custom control subitems.
This commit is contained in:
parent
23571b6a0a
commit
d4f0aa2bb2
|
@ -3120,14 +3120,62 @@ static HRESULT WINAPI IFileDialogCustomize_fnSetCheckButtonState(IFileDialogCust
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT get_combobox_index_from_id(HWND cb_hwnd, DWORD dwIDItem)
|
||||||
|
{
|
||||||
|
UINT count = SendMessageW(cb_hwnd, CB_GETCOUNT, 0, 0);
|
||||||
|
UINT i;
|
||||||
|
if(!count || (count == CB_ERR))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for(i = 0; i < count; i++)
|
||||||
|
if(SendMessageW(cb_hwnd, CB_GETITEMDATA, i, 0) == dwIDItem)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
TRACE("Item with id %d not found in combobox %p (item count: %d)\n", dwIDItem, cb_hwnd, count);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IFileDialogCustomize_fnAddControlItem(IFileDialogCustomize *iface,
|
static HRESULT WINAPI IFileDialogCustomize_fnAddControlItem(IFileDialogCustomize *iface,
|
||||||
DWORD dwIDCtl,
|
DWORD dwIDCtl,
|
||||||
DWORD dwIDItem,
|
DWORD dwIDItem,
|
||||||
LPCWSTR pszLabel)
|
LPCWSTR pszLabel)
|
||||||
{
|
{
|
||||||
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
||||||
FIXME("stub - %p (%d, %d, %s)\n", This, dwIDCtl, dwIDItem, debugstr_w(pszLabel));
|
customctrl *ctrl = get_cctrl(This, dwIDCtl);
|
||||||
return E_NOTIMPL;
|
TRACE("%p (%d, %d, %s)\n", This, dwIDCtl, dwIDItem, debugstr_w(pszLabel));
|
||||||
|
|
||||||
|
if(!ctrl) return E_FAIL;
|
||||||
|
|
||||||
|
switch(ctrl->type)
|
||||||
|
{
|
||||||
|
case IDLG_CCTRL_COMBOBOX:
|
||||||
|
{
|
||||||
|
UINT index;
|
||||||
|
|
||||||
|
if(get_combobox_index_from_id(ctrl->hwnd, dwIDItem) != -1)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
index = SendMessageW(ctrl->hwnd, CB_ADDSTRING, 0, (LPARAM)pszLabel);
|
||||||
|
SendMessageW(ctrl->hwnd, CB_SETITEMDATA, index, dwIDItem);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
case IDLG_CCTRL_MENU:
|
||||||
|
{
|
||||||
|
TBBUTTON tbb;
|
||||||
|
SendMessageW(ctrl->hwnd, TB_GETBUTTON, 0, (LPARAM)&tbb);
|
||||||
|
|
||||||
|
if(GetMenuState((HMENU)tbb.dwData, dwIDItem, MF_BYCOMMAND) != -1)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
AppendMenuW((HMENU)tbb.dwData, MF_STRING, dwIDItem, pszLabel);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_NOINTERFACE; /* win7 */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IFileDialogCustomize_fnRemoveControlItem(IFileDialogCustomize *iface,
|
static HRESULT WINAPI IFileDialogCustomize_fnRemoveControlItem(IFileDialogCustomize *iface,
|
||||||
|
@ -3135,8 +3183,46 @@ static HRESULT WINAPI IFileDialogCustomize_fnRemoveControlItem(IFileDialogCustom
|
||||||
DWORD dwIDItem)
|
DWORD dwIDItem)
|
||||||
{
|
{
|
||||||
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
||||||
FIXME("stub - %p (%d, %d)\n", This, dwIDCtl, dwIDItem);
|
customctrl *ctrl = get_cctrl(This, dwIDCtl);
|
||||||
return E_NOTIMPL;
|
TRACE("%p (%d, %d)\n", This, dwIDCtl, dwIDItem);
|
||||||
|
|
||||||
|
if(!ctrl) return E_FAIL;
|
||||||
|
|
||||||
|
switch(ctrl->type)
|
||||||
|
{
|
||||||
|
case IDLG_CCTRL_COMBOBOX:
|
||||||
|
{
|
||||||
|
UINT i, count = SendMessageW(ctrl->hwnd, CB_GETCOUNT, 0, 0);
|
||||||
|
if(!count || (count == CB_ERR))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
for(i = 0; i < count; i++)
|
||||||
|
if(SendMessageW(ctrl->hwnd, CB_GETITEMDATA, 0, 0) == dwIDItem)
|
||||||
|
{
|
||||||
|
if(SendMessageW(ctrl->hwnd, CB_DELETESTRING, i, 0) == CB_ERR)
|
||||||
|
return E_FAIL;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
case IDLG_CCTRL_MENU:
|
||||||
|
{
|
||||||
|
TBBUTTON tbb;
|
||||||
|
HMENU hmenu;
|
||||||
|
SendMessageW(ctrl->hwnd, TB_GETBUTTON, 0, (LPARAM)&tbb);
|
||||||
|
hmenu = (HMENU)tbb.dwData;
|
||||||
|
|
||||||
|
if(!hmenu || !DeleteMenu(hmenu, dwIDItem, MF_BYCOMMAND))
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IFileDialogCustomize_fnRemoveAllControlItems(IFileDialogCustomize *iface,
|
static HRESULT WINAPI IFileDialogCustomize_fnRemoveAllControlItems(IFileDialogCustomize *iface,
|
||||||
|
@ -3174,7 +3260,26 @@ static HRESULT WINAPI IFileDialogCustomize_fnGetSelectedControlItem(IFileDialogC
|
||||||
DWORD *pdwIDItem)
|
DWORD *pdwIDItem)
|
||||||
{
|
{
|
||||||
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
||||||
FIXME("stub - %p\n", This);
|
customctrl *ctrl = get_cctrl(This, dwIDCtl);
|
||||||
|
TRACE("%p (%d, %p)\n", This, dwIDCtl, pdwIDItem);
|
||||||
|
|
||||||
|
if(!ctrl) return E_FAIL;
|
||||||
|
|
||||||
|
switch(ctrl->type)
|
||||||
|
{
|
||||||
|
case IDLG_CCTRL_COMBOBOX:
|
||||||
|
{
|
||||||
|
UINT index = SendMessageW(ctrl->hwnd, CB_GETCURSEL, 0, 0);
|
||||||
|
if(index == CB_ERR)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
*pdwIDItem = SendMessageW(ctrl->hwnd, CB_GETITEMDATA, index, 0);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
FIXME("Unsupported control type %d\n", ctrl->type);
|
||||||
|
}
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3183,8 +3288,30 @@ static HRESULT WINAPI IFileDialogCustomize_fnSetSelectedControlItem(IFileDialogC
|
||||||
DWORD dwIDItem)
|
DWORD dwIDItem)
|
||||||
{
|
{
|
||||||
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
FileDialogImpl *This = impl_from_IFileDialogCustomize(iface);
|
||||||
FIXME("stub - %p (%d, %d)\n", This, dwIDCtl, dwIDItem);
|
customctrl *ctrl = get_cctrl(This, dwIDCtl);
|
||||||
return E_NOTIMPL;
|
TRACE("%p (%d, %d)\n", This, dwIDCtl, dwIDItem);
|
||||||
|
|
||||||
|
if(!ctrl) return E_INVALIDARG;
|
||||||
|
|
||||||
|
switch(ctrl->type)
|
||||||
|
{
|
||||||
|
case IDLG_CCTRL_COMBOBOX:
|
||||||
|
{
|
||||||
|
UINT index = get_combobox_index_from_id(ctrl->hwnd, dwIDItem);
|
||||||
|
|
||||||
|
if(index == -1)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if(SendMessageW(ctrl->hwnd, CB_SETCURSEL, index, 0) == CB_ERR)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
FIXME("Unsupported control type %d\n", ctrl->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IFileDialogCustomize_fnStartVisualGroup(IFileDialogCustomize *iface,
|
static HRESULT WINAPI IFileDialogCustomize_fnStartVisualGroup(IFileDialogCustomize *iface,
|
||||||
|
|
|
@ -1323,6 +1323,14 @@ static void test_customize_onfolderchange(IFileDialog *pfd)
|
||||||
item_parent = GetParent(item);
|
item_parent = GetParent(item);
|
||||||
GetClassNameW(item_parent, buf, 1024);
|
GetClassNameW(item_parent, buf, 1024);
|
||||||
ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
|
ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
|
||||||
|
item = find_window(dlg_hwnd, NULL, radiobutton1W);
|
||||||
|
todo_wine ok(item != NULL, "Failed to find item.\n");
|
||||||
|
item_parent = GetParent(item);
|
||||||
|
GetClassNameW(item_parent, buf, 1024);
|
||||||
|
todo_wine ok(!lstrcmpW(buf, RadioButtonListW), "Got %s\n", wine_dbgstr_w(buf));
|
||||||
|
item_parent = GetParent(item_parent);
|
||||||
|
GetClassNameW(item_parent, buf, 1024);
|
||||||
|
ok(!lstrcmpW(buf, floatnotifysinkW), "Got %s\n", wine_dbgstr_w(buf));
|
||||||
|
|
||||||
item = find_window(dlg_hwnd, NULL, pushbutton1W);
|
item = find_window(dlg_hwnd, NULL, pushbutton1W);
|
||||||
ok(item == NULL, "Found item: %p\n", item);
|
ok(item == NULL, "Found item: %p\n", item);
|
||||||
|
@ -1397,6 +1405,9 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1410,6 +1421,28 @@ static void test_customize(void)
|
||||||
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == 0xdeadbeef, "got 0x%08x.\n", cdstate);
|
ok(cdstate == 0xdeadbeef, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
todo_wine ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(!cdstate, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
todo_wine ok(hr == E_NOTIMPL, "got 0x%08x (control: %d).\n", hr, i);
|
todo_wine ok(hr == E_NOTIMPL, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1423,6 +1456,11 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1435,6 +1473,10 @@ static void test_customize(void)
|
||||||
hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
|
hr = IFileDialogCustomize_GetControlState(pfdc, i, &cdstate);
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1448,6 +1490,11 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1461,6 +1508,11 @@ static void test_customize(void)
|
||||||
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, radiobutton1W);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, radiobutton1W);
|
||||||
|
todo_wine ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, radiobutton2W);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, radiobutton2W);
|
||||||
todo_wine ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
todo_wine ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1474,6 +1526,9 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, checkbutton2W);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, checkbutton2W);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1509,6 +1564,9 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
/* Does not affect the text in the editbox */
|
/* Does not affect the text in the editbox */
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, editbox2W);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, editbox2W);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
@ -1542,6 +1600,9 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, separatorW);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, separatorW);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1555,6 +1616,9 @@ static void test_customize(void)
|
||||||
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, text2W);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, text2W);
|
||||||
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1562,6 +1626,10 @@ static void test_customize(void)
|
||||||
todo_wine ok(hr == E_UNEXPECTED, "got 0x%08x.\n", hr);
|
todo_wine ok(hr == E_UNEXPECTED, "got 0x%08x.\n", hr);
|
||||||
hr = IFileDialogCustomize_StartVisualGroup(pfdc, ++i, visualgroup1W);
|
hr = IFileDialogCustomize_StartVisualGroup(pfdc, ++i, visualgroup1W);
|
||||||
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
todo_wine ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, visualgroup2W);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, visualgroup2W);
|
||||||
todo_wine ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
todo_wine ok(hr == S_OK, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
|
|
||||||
|
@ -1576,6 +1644,8 @@ static void test_customize(void)
|
||||||
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
i++; /* Nonexisting control */
|
i++; /* Nonexisting control */
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, 0, label);
|
||||||
|
todo_wine ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
hr = IFileDialogCustomize_SetControlLabel(pfdc, i, label2);
|
||||||
ok(hr == E_INVALIDARG, "got 0x%08x (control: %d).\n", hr, i);
|
ok(hr == E_INVALIDARG, "got 0x%08x (control: %d).\n", hr, i);
|
||||||
cdstate = 0xdeadbeef;
|
cdstate = 0xdeadbeef;
|
||||||
|
@ -1599,6 +1669,224 @@ static void test_customize(void)
|
||||||
IFileDialogCustomize_Release(pfdc);
|
IFileDialogCustomize_Release(pfdc);
|
||||||
ref = IFileOpenDialog_Release(pfod);
|
ref = IFileOpenDialog_Release(pfod);
|
||||||
ok(!ref, "Refcount not zero (%d).\n", ref);
|
ok(!ref, "Refcount not zero (%d).\n", ref);
|
||||||
|
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IFileDialog, (void**)&pfod);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
hr = IFileDialogCustomize_AddMenu(pfdc, ++i, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
DWORD selected;
|
||||||
|
UINT j = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(cdstate == 0, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
todo_wine ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hr = IFileDialogCustomize_AddPushButton(pfdc, ++i, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_AddComboBox(pfdc, ++i);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
DWORD selected = -1;
|
||||||
|
UINT j = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == E_FAIL, "got 0x%08x.\n", hr);
|
||||||
|
ok(selected == -1, "got %d.\n", selected);
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == 0, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(selected == j, "got %d.\n", selected);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
|
||||||
|
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_AddRadioButtonList(pfdc, ++i);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
DWORD selected = -1;
|
||||||
|
UINT j = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == E_FAIL, "got 0x%08x.\n", hr);
|
||||||
|
ok(selected == -1, "got %d.\n", selected);
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == 0, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(selected == j, "got %d.\n", selected);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, j);
|
||||||
|
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hr = IFileDialogCustomize_EnableOpenDropDown(pfdc, ++i);
|
||||||
|
todo_wine ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
DWORD selected = -1;
|
||||||
|
UINT j = 0;
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_AddControlItem(pfdc, i, j, label);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_GetSelectedControlItem(pfdc, i, &selected);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(selected == 0, "got %d.\n", selected);
|
||||||
|
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, 0);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == 0, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetControlItemState(pfdc, i, 0, CDCS_ENABLEDVISIBLE);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
cdstate = 0xdeadbeef;
|
||||||
|
hr = IFileDialogCustomize_GetControlItemState(pfdc, i, 0, &cdstate);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
ok(cdstate == CDCS_ENABLEDVISIBLE, "got 0x%08x.\n", cdstate);
|
||||||
|
hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, 0);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i);
|
||||||
|
ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr);
|
||||||
|
|
||||||
|
for(j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, j);
|
||||||
|
ok(hr == S_OK, "got 0x%08x.\n", hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileDialogCustomize_Release(pfdc);
|
||||||
|
ref = IFileOpenDialog_Release(pfod);
|
||||||
|
ok(!ref, "Refcount not zero (%d).\n", ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(itemdlg)
|
START_TEST(itemdlg)
|
||||||
|
|
Loading…
Reference in New Issue