Andrew Eikum : user32: Allow setting horizontal extent even without WS_HSCROLL.
Alexandre Julliard
julliard at winehq.org
Thu Apr 24 13:43:59 CDT 2014
Module: wine
Branch: master
Commit: c4a28490f304167d2257d2de6315f09d577742f2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c4a28490f304167d2257d2de6315f09d577742f2
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Wed Apr 23 14:58:29 2014 -0500
user32: Allow setting horizontal extent even without WS_HSCROLL.
---
dlls/user32/listbox.c | 6 +++---
dlls/user32/tests/listbox.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index c282d5d..d17797b 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -83,7 +83,7 @@ typedef struct
INT item_height; /* Default item height */
INT page_size; /* Items per listbox page */
INT column_width; /* Column width for multi-column listboxes */
- INT horz_extent; /* Horizontal extent (0 if no hscroll) */
+ INT horz_extent; /* Horizontal extent */
INT horz_pos; /* Horizontal position */
INT nb_tabs; /* Number of tabs in array */
INT *tabs; /* Array of tabs */
@@ -1239,7 +1239,7 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
*/
static LRESULT LISTBOX_SetHorizontalExtent( LB_DESCR *descr, INT extent )
{
- if (!descr->horz_extent || (descr->style & LBS_MULTICOLUMN))
+ if (descr->style & LBS_MULTICOLUMN)
return LB_OKAY;
if (extent <= 0) extent = 1;
if (extent == descr->horz_extent) return LB_OKAY;
@@ -2485,7 +2485,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
descr->item_height = 1;
descr->page_size = 1;
descr->column_width = 150;
- descr->horz_extent = (descr->style & WS_HSCROLL) ? 1 : 0;
+ descr->horz_extent = 0;
descr->horz_pos = 0;
descr->nb_tabs = 0;
descr->tabs = NULL;
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 8e3fbcd..ebcb5e9 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -1617,6 +1617,41 @@ static void test_missing_lbuttonup( void )
DestroyWindow(parent);
}
+static void test_extents(void)
+{
+ HWND listbox, parent;
+ DWORD res;
+
+ parent = create_parent();
+
+ listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
+
+ res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
+ ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+
+ SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
+
+ res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
+ ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+
+ DestroyWindow(listbox);
+
+
+ listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
+
+ res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
+ ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+
+ SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
+
+ res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
+ ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+
+ DestroyWindow(listbox);
+
+ DestroyWindow(parent);
+}
+
START_TEST(listbox)
{
const struct listbox_test SS =
@@ -1698,4 +1733,5 @@ START_TEST(listbox)
test_set_count();
test_GetListBoxInfo();
test_missing_lbuttonup();
+ test_extents();
}
More information about the wine-cvs
mailing list