Commit 578aae07 authored by Eric Wheeler's avatar Eric Wheeler Committed by Alexandre Julliard

comctl32/listview: Add Get/SetSelectedColumn() support.

Selected column should be using different background color, this patch does not implement this. Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2ff7160c
...@@ -99,7 +99,6 @@ ...@@ -99,7 +99,6 @@
* -- LVM_GETINSERTMARKRECT * -- LVM_GETINSERTMARKRECT
* -- LVM_GETNUMBEROFWORKAREAS * -- LVM_GETNUMBEROFWORKAREAS
* -- LVM_GETOUTLINECOLOR, LVM_SETOUTLINECOLOR * -- LVM_GETOUTLINECOLOR, LVM_SETOUTLINECOLOR
* -- LVM_GETSELECTEDCOLUMN, LVM_SETSELECTEDCOLUMN
* -- LVM_GETISEARCHSTRINGW, LVM_GETISEARCHSTRINGA * -- LVM_GETISEARCHSTRINGW, LVM_GETISEARCHSTRINGA
* -- LVM_GETTILEINFO, LVM_SETTILEINFO * -- LVM_GETTILEINFO, LVM_SETTILEINFO
* -- LVM_GETTILEVIEWINFO, LVM_SETTILEVIEWINFO * -- LVM_GETTILEVIEWINFO, LVM_SETTILEVIEWINFO
...@@ -248,6 +247,7 @@ typedef struct tagLISTVIEW_INFO ...@@ -248,6 +247,7 @@ typedef struct tagLISTVIEW_INFO
/* columns */ /* columns */
HDPA hdpaColumns; /* array of COLUMN_INFO pointers */ HDPA hdpaColumns; /* array of COLUMN_INFO pointers */
BOOL colRectsDirty; /* trigger column rectangles requery from header */ BOOL colRectsDirty; /* trigger column rectangles requery from header */
INT selected_column; /* index for LVM_SETSELECTEDCOLUMN/LVM_GETSELECTEDCOLUMN */
/* item metrics */ /* item metrics */
BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */
...@@ -9506,6 +9506,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW * ...@@ -9506,6 +9506,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *
infoPtr->itemEdit.fEnabled = FALSE; infoPtr->itemEdit.fEnabled = FALSE;
infoPtr->iVersion = COMCTL32_VERSION; infoPtr->iVersion = COMCTL32_VERSION;
infoPtr->colRectsDirty = FALSE; infoPtr->colRectsDirty = FALSE;
infoPtr->selected_column = -1;
/* get default font (icon title) */ /* get default font (icon title) */
SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
...@@ -11465,7 +11466,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -11465,7 +11466,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* case LVM_GETOUTLINECOLOR: */ /* case LVM_GETOUTLINECOLOR: */
/* case LVM_GETSELECTEDCOLUMN: */ case LVM_GETSELECTEDCOLUMN:
return infoPtr->selected_column;
case LVM_GETSELECTEDCOUNT: case LVM_GETSELECTEDCOUNT:
return LISTVIEW_GetSelectedCount(infoPtr); return LISTVIEW_GetSelectedCount(infoPtr);
...@@ -11638,7 +11640,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -11638,7 +11640,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* case LVM_SETOUTLINECOLOR: */ /* case LVM_SETOUTLINECOLOR: */
/* case LVM_SETSELECTEDCOLUMN: */ case LVM_SETSELECTEDCOLUMN:
infoPtr->selected_column = (INT)wParam;
return TRUE;
case LVM_SETSELECTIONMARK: case LVM_SETSELECTIONMARK:
return LISTVIEW_SetSelectionMark(infoPtr, (INT)lParam); return LISTVIEW_SetSelectionMark(infoPtr, (INT)lParam);
......
...@@ -6659,6 +6659,42 @@ static void test_item_state_change(void) ...@@ -6659,6 +6659,42 @@ static void test_item_state_change(void)
} }
} }
static void test_selected_column(void)
{
static const DWORD styles[] = { LVS_ICON, LVS_LIST, LVS_REPORT, LVS_SMALLICON };
int ret, i;
HWND hwnd;
for (i = 0; i < ARRAY_SIZE(styles); ++i)
{
hwnd = create_listview_control(styles[i]);
/* Initial value */
ret = SendMessageA(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0);
ok(ret == -1, "Unexpected column %d.\n", ret);
ret = SendMessageA(hwnd, LVM_SETSELECTEDCOLUMN, -100, 0);
ok(ret == 1, "Unexpected return value %d.\n", ret);
ret = SendMessageA(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0);
ok(ret == -100, "Unexpected column %d.\n", ret);
ret = SendMessageA(hwnd, LVM_SETSELECTEDCOLUMN, 100, 0);
ok(ret == 1, "Unexpected return value %d.\n", ret);
ret = SendMessageA(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0);
ok(ret == 100, "Unexpected column %d.\n", ret);
ret = SendMessageA(hwnd, LVM_SETSELECTEDCOLUMN, -1, 0);
ok(ret == 1, "Unexpected return value %d.\n", ret);
ret = SendMessageA(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0);
ok(ret == -1, "Unexpected column %d.\n", ret);
DestroyWindow(hwnd);
}
}
START_TEST(listview) START_TEST(listview)
{ {
ULONG_PTR ctx_cookie; ULONG_PTR ctx_cookie;
...@@ -6766,6 +6802,7 @@ START_TEST(listview) ...@@ -6766,6 +6802,7 @@ START_TEST(listview)
test_LVN_ENDLABELEDIT(); test_LVN_ENDLABELEDIT();
test_LVM_GETCOUNTPERPAGE(); test_LVM_GETCOUNTPERPAGE();
test_item_state_change(); test_item_state_change();
test_selected_column();
unload_v6_module(ctx_cookie, hCtx); 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