[PATCH v5 2/6] comctl32/listbox: Use a helper to set item height by index
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Feb 19 07:33:56 CST 2019
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/comctl32/listbox.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index a457d63..ba8b7ee 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -168,6 +168,11 @@ static UINT get_item_height( const LB_DESCR *descr, UINT index )
return (descr->style & LBS_NODATA) ? 0 : descr->items[index].height;
}
+static void set_item_height( LB_DESCR *descr, UINT index, UINT height )
+{
+ if (!(descr->style & LBS_NODATA)) descr->items[index].height = height;
+}
+
static BOOL is_item_selected( const LB_DESCR *descr, UINT index )
{
if (!(descr->style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)))
@@ -1233,7 +1238,7 @@ static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BO
return LB_ERR;
}
TRACE("[%p]: item %d height = %d\n", descr->self, index, height );
- descr->items[index].height = height;
+ set_item_height(descr, index, height);
LISTBOX_UpdateScroll( descr );
if (repaint)
LISTBOX_InvalidateItems( descr, index );
@@ -1590,7 +1595,7 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
mis.itemData = data;
mis.itemHeight = descr->item_height;
SendMessageW( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
- item->height = mis.itemHeight ? mis.itemHeight : 1;
+ set_item_height(descr, index, mis.itemHeight ? mis.itemHeight : 1);
TRACE("[%p]: measure item %d (%s) = %d\n",
descr->self, index, str ? debugstr_w(str) : "", get_item_height(descr, index));
}
--
2.20.1
More information about the wine-devel
mailing list