comctl32/listview: Default column width in LVS_LIST to better value.
This commit is contained in:
parent
dbbd2161ab
commit
fc43895f49
|
@ -403,7 +403,7 @@ typedef struct tagLISTVIEW_INFO
|
||||||
#define MAX_EMPTYTEXT_SELECT_WIDTH 80
|
#define MAX_EMPTYTEXT_SELECT_WIDTH 80
|
||||||
|
|
||||||
/* default column width for items in list display mode */
|
/* default column width for items in list display mode */
|
||||||
#define DEFAULT_COLUMN_WIDTH 128
|
#define DEFAULT_COLUMN_WIDTH 96
|
||||||
|
|
||||||
/* Size of "line" scroll for V & H scrolls */
|
/* Size of "line" scroll for V & H scrolls */
|
||||||
#define LISTVIEW_SCROLL_ICON_LINE_SIZE 37
|
#define LISTVIEW_SCROLL_ICON_LINE_SIZE 37
|
||||||
|
@ -2786,15 +2786,20 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
|
||||||
}
|
}
|
||||||
else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
|
else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
|
||||||
{
|
{
|
||||||
|
BOOL empty;
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
for (i = 0; i < infoPtr->nItemCount; i++)
|
for (i = 0; i < infoPtr->nItemCount; i++)
|
||||||
nItemWidth = max(LISTVIEW_GetLabelWidth(infoPtr, i), nItemWidth);
|
nItemWidth = max(LISTVIEW_GetLabelWidth(infoPtr, i), nItemWidth);
|
||||||
|
empty = nItemWidth == 0;
|
||||||
|
|
||||||
if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx;
|
if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx;
|
||||||
if (infoPtr->himlState) nItemWidth += infoPtr->iconStateSize.cx;
|
if (infoPtr->himlState) nItemWidth += infoPtr->iconStateSize.cx;
|
||||||
|
|
||||||
nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING);
|
if (empty)
|
||||||
|
nItemWidth = max(nItemWidth, DEFAULT_COLUMN_WIDTH);
|
||||||
|
else
|
||||||
|
nItemWidth += WIDTH_PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nItemWidth;
|
return nItemWidth;
|
||||||
|
@ -7454,7 +7459,7 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
|
||||||
TRACE(" inserting at %d, sorted=%d, count=%d, iItem=%d\n", nItem, is_sorted, infoPtr->nItemCount, lpLVItem->iItem);
|
TRACE(" inserting at %d, sorted=%d, count=%d, iItem=%d\n", nItem, is_sorted, infoPtr->nItemCount, lpLVItem->iItem);
|
||||||
nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems );
|
nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems );
|
||||||
if (nItem == -1) goto fail;
|
if (nItem == -1) goto fail;
|
||||||
infoPtr->nItemCount++;
|
if (infoPtr->nItemCount++ == 0) LISTVIEW_UpdateItemSize(infoPtr);
|
||||||
|
|
||||||
/* shift indices first so they don't get tangled */
|
/* shift indices first so they don't get tangled */
|
||||||
LISTVIEW_ShiftIndices(infoPtr, nItem, 1);
|
LISTVIEW_ShiftIndices(infoPtr, nItem, 1);
|
||||||
|
|
|
@ -3124,6 +3124,20 @@ static void test_getitemrect(void)
|
||||||
INT order[2];
|
INT order[2];
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
|
/* rectangle isn't empty for empty text items */
|
||||||
|
hwnd = create_custom_listview_control(LVS_LIST);
|
||||||
|
memset(&item, 0, sizeof(item));
|
||||||
|
item.mask = 0;
|
||||||
|
item.iItem = 0;
|
||||||
|
r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
|
||||||
|
expect(0, r);
|
||||||
|
rect.left = LVIR_LABEL;
|
||||||
|
SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
|
||||||
|
expect(0, rect.left);
|
||||||
|
expect(0, rect.top);
|
||||||
|
todo_wine expect(96, rect.right);
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
|
||||||
hwnd = create_listview_control(0);
|
hwnd = create_listview_control(0);
|
||||||
ok(hwnd != NULL, "failed to create a listview window\n");
|
ok(hwnd != NULL, "failed to create a listview window\n");
|
||||||
|
|
||||||
|
@ -3921,6 +3935,7 @@ static void test_getcolumnwidth(void)
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
DWORD_PTR style;
|
DWORD_PTR style;
|
||||||
LVCOLUMNA col;
|
LVCOLUMNA col;
|
||||||
|
LVITEMA itema;
|
||||||
|
|
||||||
/* default column width */
|
/* default column width */
|
||||||
hwnd = create_custom_listview_control(0);
|
hwnd = create_custom_listview_control(0);
|
||||||
|
@ -3938,6 +3953,14 @@ static void test_getcolumnwidth(void)
|
||||||
ret = SendMessage(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
ret = SendMessage(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||||
expect(10, ret);
|
expect(10, ret);
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
|
||||||
|
/* default column width with item added */
|
||||||
|
hwnd = create_custom_listview_control(LVS_LIST);
|
||||||
|
memset(&itema, 0, sizeof(itema));
|
||||||
|
SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
|
||||||
|
ret = SendMessage(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||||
|
expect(96, ret);
|
||||||
|
DestroyWindow(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_scrollnotify(void)
|
static void test_scrollnotify(void)
|
||||||
|
|
Loading…
Reference in New Issue