mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 17:16:43 +00:00
[comctl32]
- Merge from the themes branch - Partly sync themed button handling with wine svn path=/trunk/; revision=53751
This commit is contained in:
parent
e3ee8d26e9
commit
7af68227cb
2 changed files with 56 additions and 17 deletions
|
@ -246,18 +246,26 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
|
||||||
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
|
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
|
||||||
DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
|
DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
|
||||||
UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx);
|
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 ];
|
pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
|
||||||
|
|
||||||
if (paint)
|
if(!paint)
|
||||||
{
|
return FALSE;
|
||||||
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(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 @@ LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg,
|
||||||
RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
|
RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
|
||||||
return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
|
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:
|
default:
|
||||||
/* Call old proc */
|
/* Call old proc */
|
||||||
return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
|
return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
|
||||||
|
|
|
@ -35,15 +35,15 @@ typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
|
||||||
ULONG_PTR);
|
ULONG_PTR);
|
||||||
|
|
||||||
extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
||||||
ULONG_PTR);
|
ULONG_PTR) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
||||||
ULONG_PTR);
|
ULONG_PTR) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
||||||
ULONG_PTR);
|
ULONG_PTR) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
||||||
ULONG_PTR);
|
ULONG_PTR) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
|
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 dialogClass[] = {'#','3','2','7','7','0',0};
|
||||||
static const WCHAR comboLboxClass[] = {'C','o','m','b','o','L','b','o','x',0};
|
static const WCHAR comboLboxClass[] = {'C','o','m','b','o','L','b','o','x',0};
|
||||||
|
@ -118,9 +118,7 @@ void THEMING_Initialize (void)
|
||||||
{ 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
|
{ 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
|
||||||
static const WCHAR refDataPropName[] =
|
static const WCHAR refDataPropName[] =
|
||||||
{ 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
|
{ 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
|
||||||
|
|
||||||
if (!IsThemeActive()) return;
|
|
||||||
|
|
||||||
atSubclassProp = GlobalAddAtomW (subclassPropName);
|
atSubclassProp = GlobalAddAtomW (subclassPropName);
|
||||||
atRefDataProp = GlobalAddAtomW (refDataPropName);
|
atRefDataProp = GlobalAddAtomW (refDataPropName);
|
||||||
|
|
||||||
|
@ -133,6 +131,8 @@ void THEMING_Initialize (void)
|
||||||
GetClassInfoExW (NULL, subclasses[i].className, &class);
|
GetClassInfoExW (NULL, subclasses[i].className, &class);
|
||||||
originalProcs[i] = class.lpfnWndProc;
|
originalProcs[i] = class.lpfnWndProc;
|
||||||
class.lpfnWndProc = subclassProcs[i];
|
class.lpfnWndProc = subclassProcs[i];
|
||||||
|
class.style |= CS_GLOBALCLASS;
|
||||||
|
class.hInstance = COMCTL32_hModule;
|
||||||
|
|
||||||
if (!class.lpfnWndProc)
|
if (!class.lpfnWndProc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue