Huw Davies : user32:
For LBS_OWNERDRAWVARIABLE listboxes return the fixed item height if the
listbox is empty .
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Dec 6 05:48:56 CST 2006
Module: wine
Branch: master
Commit: 104e1cf6dd28669eb498803d7a242952c0668b1c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=104e1cf6dd28669eb498803d7a242952c0668b1c
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Dec 5 14:32:02 2006 +0000
user32: For LBS_OWNERDRAWVARIABLE listboxes return the fixed item height if the listbox is empty.
---
dlls/user32/listbox.c | 2 +-
dlls/user32/tests/listbox.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 59c4f29..2d1b9f3 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1169,7 +1169,7 @@ static void LISTBOX_InvalidateItemRect(
*/
static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
{
- if (descr->style & LBS_OWNERDRAWVARIABLE)
+ if (descr->style & LBS_OWNERDRAWVARIABLE && descr->nb_items > 0)
{
if ((index < 0) || (index >= descr->nb_items))
{
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 435dc91..257de59 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -214,6 +214,16 @@ static void check_item_height(void)
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %d\n", itemHeight, tm.tmHeight);
DestroyWindow (hLB);
+
+ hLB = CreateWindow ("LISTBOX", "TestList", LBS_OWNERDRAWVARIABLE,
+ 0, 0, 100, 100, NULL, NULL, NULL, 0);
+ itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, 0, 0);
+ ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
+ itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, 5, 0);
+ ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
+ itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, -5, 0);
+ ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
+ DestroyWindow (hLB);
}
static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
More information about the wine-cvs
mailing list