Nikolay Sivov : user32: Disable scroll bar control window when both buttons disabled.

Alexandre Julliard julliard at winehq.org
Thu Mar 5 10:31:04 CST 2009


Module: wine
Branch: master
Commit: 032356ec379fbac733d4009381338e882672126e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=032356ec379fbac733d4009381338e882672126e

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Wed Mar  4 17:38:41 2009 -0500

user32: Disable scroll bar control window when both buttons disabled.

---

 dlls/user32/scroll.c       |    3 +++
 dlls/user32/tests/scroll.c |   19 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index b243e27..93f85f2 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -2069,6 +2069,9 @@ BOOL WINAPI EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
     if (bFineWithMe && infoPtr->flags == flags) return FALSE;
     infoPtr->flags = flags;
 
+    if (nBar == SB_CTL && (flags == ESB_DISABLE_BOTH || flags == ESB_ENABLE_BOTH))
+        EnableWindow(hwnd, flags == ESB_ENABLE_BOTH);
+
     SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE );
     return TRUE;
 }
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 9547d54..46080ca 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -54,15 +54,26 @@ static void scrollbar_test1(void)
 
     ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_BOTH );
     ok( ret, "The scrollbar should be disabled.\n" );
-    todo_wine
-    {
-        ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
-    }
+    ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
 
     ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
     ok( ret, "The scrollbar should be enabled.\n" );
     ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
 
+    /* test buttons separately */
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_LTUP );
+    ok( ret, "The scrollbar LTUP button should be disabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
+    ok( ret, "The scrollbar should be enabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_RTDN );
+    ok( ret, "The scrollbar RTDN button should be disabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
+    ok( ret, "The scrollbar should be enabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
 }
 
 static void scrollbar_test2(void)




More information about the wine-cvs mailing list