Author: gadamopoulos
Date: Mon Sep 19 13:11:35 2011
New Revision: 53751
URL:
http://svn.reactos.org/svn/reactos?rev=53751&view=rev
Log:
[comctl32]
- Merge from the themes branch
- Partly sync themed button handling with wine
Modified:
trunk/reactos/dll/win32/comctl32/theme_button.c
trunk/reactos/dll/win32/comctl32/theming.c
Modified: trunk/reactos/dll/win32/comctl32/theme_button.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_b…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] Mon Sep 19 13:11:35 2011
@@ -246,18 +246,26 @@
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx);
- ButtonState drawState = IsWindowEnabled(hwnd) ? STATE_NORMAL : STATE_DISABLED;
+ int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
+ ButtonState drawState;
pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
- if (paint)
- {
- hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
- paint(theme, hwnd, hDC, drawState, dtFlags);
- if (!hParamDC) EndPaint(hwnd, &ps);
- return TRUE;
- }
-
- return FALSE; /* Delegate drawing to the non-themed code. */
+ if(!paint)
+ return FALSE;
+
+ if(IsWindowEnabled(hwnd))
+ {
+ if(state & BST_PUSHED) drawState = STATE_PRESSED;
+ else if(state & BST_HOT) drawState = STATE_HOT;
+ else if(state & BST_FOCUS) drawState = STATE_DEFAULTED;
+ else drawState = STATE_NORMAL;
+ }
+ else drawState = STATE_DISABLED;
+
+ hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
+ paint(theme, hwnd, hDC, drawState, dtFlags);
+ if (!hParamDC) EndPaint(hwnd, &ps);
+ return TRUE;
}
/**********************************************************************
@@ -309,6 +317,37 @@
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);
Modified: trunk/reactos/dll/win32/comctl32/theming.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theming…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] Mon Sep 19 13:11:35 2011
@@ -35,15 +35,15 @@
ULONG_PTR);
extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
- ULONG_PTR);
+ ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
- ULONG_PTR);
+ ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
- ULONG_PTR);
+ ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
- ULONG_PTR);
+ ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
- ULONG_PTR);
+ ULONG_PTR) DECLSPEC_HIDDEN;
static const WCHAR dialogClass[] =
{'#','3','2','7','7','0',0};
static const WCHAR comboLboxClass[] =
{'C','o','m','b','o','L','b','o','x',0};
@@ -118,9 +118,7 @@
{
'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0
};
static const WCHAR refDataPropName[] =
{
'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0
};
-
- if (!IsThemeActive()) return;
-
+
atSubclassProp = GlobalAddAtomW (subclassPropName);
atRefDataProp = GlobalAddAtomW (refDataPropName);
@@ -133,6 +131,8 @@
GetClassInfoExW (NULL, subclasses[i].className, &class);
originalProcs[i] = class.lpfnWndProc;
class.lpfnWndProc = subclassProcs[i];
+ class.style |= CS_GLOBALCLASS;
+ class.hInstance = COMCTL32_hModule;
if (!class.lpfnWndProc)
{