mirror of
https://github.com/reactos/wine.git
synced 2025-02-22 22:01:51 +00:00
comctl32/listview: Add callback subitem on column insertion.
This commit is contained in:
parent
860329d61d
commit
dd3fc17884
@ -4276,12 +4276,11 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
|
||||
*bChanged = TRUE;
|
||||
}
|
||||
|
||||
if (lpLVItem->mask & LVIF_IMAGE)
|
||||
if (lpSubItem->hdr.iImage != lpLVItem->iImage)
|
||||
{
|
||||
lpSubItem->hdr.iImage = lpLVItem->iImage;
|
||||
*bChanged = TRUE;
|
||||
}
|
||||
if ((lpLVItem->mask & LVIF_IMAGE) && (lpSubItem->hdr.iImage != lpLVItem->iImage))
|
||||
{
|
||||
lpSubItem->hdr.iImage = lpLVItem->iImage;
|
||||
*bChanged = TRUE;
|
||||
}
|
||||
|
||||
if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpSubItem->hdr.pszText, lpLVItem->pszText, isW))
|
||||
{
|
||||
@ -6434,7 +6433,7 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
|
||||
|
||||
if (isubitem)
|
||||
{
|
||||
SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, isubitem);
|
||||
SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, isubitem);
|
||||
pItemHdr = lpSubItem ? &lpSubItem->hdr : &callbackHdr;
|
||||
if (!lpSubItem)
|
||||
{
|
||||
@ -7883,7 +7882,14 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
|
||||
SUBITEM_INFO *lpSubItem;
|
||||
HDPA hdpaSubItems;
|
||||
INT nItem, i;
|
||||
|
||||
LVITEMW item;
|
||||
BOOL changed;
|
||||
|
||||
item.iSubItem = nNewColumn;
|
||||
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
item.iImage = I_IMAGECALLBACK;
|
||||
item.pszText = LPSTR_TEXTCALLBACKW;
|
||||
|
||||
for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
|
||||
{
|
||||
hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem);
|
||||
@ -7893,6 +7899,10 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
|
||||
if (lpSubItem->iSubItem >= nNewColumn)
|
||||
lpSubItem->iSubItem++;
|
||||
}
|
||||
|
||||
/* add new subitem for each item */
|
||||
item.iItem = nItem;
|
||||
set_sub_item(infoPtr, &item, isW, &changed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
static const WCHAR testparentclassW[] =
|
||||
{'L','i','s','t','v','i','e','w',' ','t','e','s','t',' ','p','a','r','e','n','t','W', 0};
|
||||
|
||||
HWND hwndparent, hwndparentW;
|
||||
static HWND hwndparent, hwndparentW;
|
||||
/* prevents edit box creation, LVN_BEGINLABELEDIT return value */
|
||||
static BOOL blockEdit;
|
||||
/* return nonzero on NM_HOVER */
|
||||
@ -54,9 +54,11 @@ static BOOL g_block_hover;
|
||||
static BOOL g_dump_itemchanged;
|
||||
/* format reported to control:
|
||||
-1 falls to defproc, anything else returned */
|
||||
INT notifyFormat;
|
||||
static INT notifyFormat;
|
||||
/* indicates we're running < 5.80 version */
|
||||
BOOL g_is_below_5;
|
||||
static BOOL g_is_below_5;
|
||||
/* item data passed to LVN_GETDISPINFOA */
|
||||
static LVITEMA g_itema;
|
||||
|
||||
static HWND subclass_editbox(HWND hwndListview);
|
||||
|
||||
@ -366,6 +368,12 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
|
||||
nmlv->iItem, nmlv->uNewState, nmlv->uOldState, nmlv->uChanged);
|
||||
}
|
||||
break;
|
||||
case LVN_GETDISPINFOA:
|
||||
{
|
||||
NMLVDISPINFOA *dispinfo = (NMLVDISPINFOA*)lParam;
|
||||
g_itema = dispinfo->item;
|
||||
}
|
||||
break;
|
||||
case NM_HOVER:
|
||||
if (g_block_hover) return 1;
|
||||
break;
|
||||
@ -1187,24 +1195,25 @@ static void test_items(void)
|
||||
static void test_columns(void)
|
||||
{
|
||||
HWND hwnd, hwndheader;
|
||||
LVCOLUMN column;
|
||||
DWORD rc;
|
||||
LVCOLUMNA column;
|
||||
LVITEMA item;
|
||||
INT order[2];
|
||||
CHAR buff[5];
|
||||
DWORD rc;
|
||||
|
||||
hwnd = CreateWindowEx(0, "SysListView32", "foo", LVS_REPORT,
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_REPORT,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
/* Add a column with no mask */
|
||||
memset(&column, 0xcc, sizeof(column));
|
||||
column.mask = 0;
|
||||
rc = ListView_InsertColumn(hwnd, 0, &column);
|
||||
ok(rc==0, "Inserting column with no mask failed with %d\n", rc);
|
||||
rc = SendMessageA(hwnd, LVM_INSERTCOLUMNA, 0, (LPARAM)&column);
|
||||
ok(rc == 0, "Inserting column with no mask failed with %d\n", rc);
|
||||
|
||||
/* Check its width */
|
||||
rc = ListView_GetColumnWidth(hwnd, 0);
|
||||
ok(rc==10 ||
|
||||
broken(rc==0), /* win9x */
|
||||
rc = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||
ok(rc == 10 || broken(rc == 0) /* win9x */,
|
||||
"Inserting column with no mask failed to set width to 10 with %d\n", rc);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
@ -1216,24 +1225,43 @@ static void test_columns(void)
|
||||
memset(&column, 0, sizeof(column));
|
||||
column.mask = LVCF_WIDTH;
|
||||
column.cx = 100;
|
||||
rc = ListView_InsertColumn(hwnd, 0, &column);
|
||||
rc = SendMessageA(hwnd, LVM_INSERTCOLUMNA, 0, (LPARAM)&column);
|
||||
ok(rc == 0, "Inserting column failed with %d\n", rc);
|
||||
|
||||
column.cx = 200;
|
||||
rc = ListView_InsertColumn(hwnd, 1, &column);
|
||||
rc = SendMessageA(hwnd, LVM_INSERTCOLUMNA, 1, (LPARAM)&column);
|
||||
ok(rc == 1, "Inserting column failed with %d\n", rc);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
rc = SendMessage(hwnd, LVM_GETCOLUMNORDERARRAY, 2, (LPARAM)&order);
|
||||
ok(rc != 0, "Expected LVM_GETCOLUMNORDERARRAY to succeed\n");
|
||||
rc = SendMessageA(hwnd, LVM_GETCOLUMNORDERARRAY, 2, (LPARAM)&order);
|
||||
ok(rc == 1, "Expected LVM_GETCOLUMNORDERARRAY to succeed\n");
|
||||
ok(order[0] == 0, "Expected order 0, got %d\n", order[0]);
|
||||
ok(order[1] == 1, "Expected order 1, got %d\n", order[1]);
|
||||
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_getorderarray_seq, "get order array", FALSE);
|
||||
|
||||
/* after column added subitem is considered as present */
|
||||
insert_item(hwnd, 0);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
item.pszText = buff;
|
||||
item.cchTextMax = sizeof(buff);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
item.mask = LVIF_TEXT;
|
||||
memset(&g_itema, 0, sizeof(g_itema));
|
||||
rc = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(rc == 1, "got %d\n", rc);
|
||||
ok(g_itema.iSubItem == 1, "got %d\n", g_itema.iSubItem);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq,
|
||||
"get subitem text after column added", FALSE);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
/* test setting imagelist between WM_NCCREATE and WM_CREATE */
|
||||
static WNDPROC listviewWndProc;
|
||||
static HIMAGELIST test_create_imagelist;
|
||||
@ -3389,7 +3417,6 @@ static void test_getitemrect(void)
|
||||
expect(2 + 16, rect.left);
|
||||
expect(34, rect.right);
|
||||
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user