Piotr Caban : comctl32: Make themed button hot when mouse is over it.

Alexandre Julliard julliard at winehq.org
Mon Jun 27 17:41:21 CDT 2011


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Jun 27 14:22:26 2011 +0200

comctl32: Make themed button hot when mouse is over it.

---

 dlls/comctl32/theme_button.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c
index 90e1172..01f16fb 100644
--- a/dlls/comctl32/theme_button.c
+++ b/dlls/comctl32/theme_button.c
@@ -317,6 +317,37 @@ LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg,
                                 RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
         return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
 
+    case WM_MOUSEMOVE:
+    {
+        TRACKMOUSEEVENT mouse_event;
+        mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
+        mouse_event.dwFlags = TME_QUERY;
+        if(!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags&(TME_HOVER|TME_LEAVE)))
+        {
+            mouse_event.dwFlags = TME_HOVER|TME_LEAVE;
+            mouse_event.hwndTrack = hwnd;
+            mouse_event.dwHoverTime = 1;
+            TrackMouseEvent(&mouse_event);
+        }
+        break;
+    }
+
+    case WM_MOUSEHOVER:
+    {
+        int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
+        SetWindowLongW(hwnd, 0, state|BST_HOT);
+        InvalidateRect(hwnd, NULL, FALSE);
+        break;
+    }
+
+    case WM_MOUSELEAVE:
+    {
+        int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
+        SetWindowLongW(hwnd, 0, state&(~BST_HOT));
+        InvalidateRect(hwnd, NULL, FALSE);
+        break;
+    }
+
     default:
 	/* Call old proc */
 	return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);




More information about the wine-cvs mailing list