mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[UXTHEME] -Rename WND_CONTEXT to WND_DATA to avoid confusion with the DRAW_CONTEXT. The WND_DATA is information valid throughout the life of a window and DRAW_CONTEXT is information throughout a draw operation in the non client area of the window.
svn path=/trunk/; revision=74587
This commit is contained in:
parent
68bca6631d
commit
a652c58c19
4 changed files with 135 additions and 135 deletions
|
@ -239,9 +239,9 @@ static void SCROLL_DrawInterior( PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi,
|
|||
}
|
||||
}
|
||||
|
||||
static void SCROLL_DrawMovingThumb(PWND_CONTEXT pwndContext, PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi, BOOL vertical)
|
||||
static void SCROLL_DrawMovingThumb(PWND_DATA pwndData, PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi, BOOL vertical)
|
||||
{
|
||||
INT pos = pwndContext->SCROLL_TrackingPos;
|
||||
INT pos = pwndData->SCROLL_TrackingPos;
|
||||
INT max_size;
|
||||
|
||||
if( vertical )
|
||||
|
@ -258,7 +258,7 @@ static void SCROLL_DrawMovingThumb(PWND_CONTEXT pwndContext, PDRAW_CONTEXT pcont
|
|||
|
||||
SCROLL_DrawInterior(pcontext, psbi, pos, vertical, SCROLL_THUMB, 0);
|
||||
|
||||
pwndContext->SCROLL_MovingThumb = !pwndContext->SCROLL_MovingThumb;
|
||||
pwndData->SCROLL_MovingThumb = !pwndData->SCROLL_MovingThumb;
|
||||
}
|
||||
|
||||
|
||||
|
@ -269,15 +269,15 @@ ThemeDrawScrollBar(PDRAW_CONTEXT pcontext, INT nBar, POINT* pt)
|
|||
SCROLLBARINFO sbi;
|
||||
BOOL vertical;
|
||||
enum SCROLL_HITTEST htHot = SCROLL_NOWHERE;
|
||||
PWND_CONTEXT pwndContext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
if (((nBar == SB_VERT) && !(pcontext->wi.dwStyle & WS_VSCROLL)) ||
|
||||
((nBar == SB_HORZ) && !(pcontext->wi.dwStyle & WS_HSCROLL))) return;
|
||||
|
||||
if (!(pwndContext = ThemeGetWndContext(pcontext->hWnd)))
|
||||
if (!(pwndData = ThemeGetWndData(pcontext->hWnd)))
|
||||
return;
|
||||
|
||||
if (pwndContext->SCROLL_TrackingWin)
|
||||
if (pwndData->SCROLL_TrackingWin)
|
||||
return;
|
||||
|
||||
/* Retrieve scrollbar info */
|
||||
|
@ -371,7 +371,7 @@ static UINT SCROLL_GetThumbVal( SCROLLINFO *psi, RECT *rect,
|
|||
}
|
||||
|
||||
static void
|
||||
SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg, POINT pt)
|
||||
SCROLL_HandleScrollEvent(PWND_DATA pwndData, HWND hwnd, INT nBar, UINT msg, POINT pt)
|
||||
{
|
||||
/* Previous mouse position for timer events */
|
||||
static POINT prevPt;
|
||||
|
@ -401,7 +401,7 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
return;
|
||||
}
|
||||
|
||||
if ((pwndContext->SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN))
|
||||
if ((pwndData->SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN))
|
||||
return;
|
||||
|
||||
ThemeInitDrawContext(&context, hwnd, 0);
|
||||
|
@ -416,8 +416,8 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
{
|
||||
case WM_LBUTTONDOWN: /* Initialise mouse tracking */
|
||||
HideCaret(hwnd); /* hide caret while holding down LBUTTON */
|
||||
pwndContext->SCROLL_trackVertical = vertical;
|
||||
pwndContext->SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, &sbi, vertical, pt, FALSE );
|
||||
pwndData->SCROLL_trackVertical = vertical;
|
||||
pwndData->SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, &sbi, vertical, pt, FALSE );
|
||||
lastClickPos = vertical ? (pt.y - sbi.rcScrollBar.top) : (pt.x - sbi.rcScrollBar.left);
|
||||
lastMousePos = lastClickPos;
|
||||
trackThumbPos = sbi.xyThumbTop;
|
||||
|
@ -450,15 +450,15 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
//TRACE("Event: hwnd=%p bar=%d msg=%s pt=%d,%d hit=%d\n",
|
||||
// hwnd, nBar, SPY_GetMsgName(msg,hwnd), pt.x, pt.y, hittest );
|
||||
|
||||
switch(pwndContext->SCROLL_trackHitTest)
|
||||
switch(pwndData->SCROLL_trackHitTest)
|
||||
{
|
||||
case SCROLL_NOWHERE: /* No tracking in progress */
|
||||
break;
|
||||
|
||||
case SCROLL_TOP_ARROW:
|
||||
if (hittest == pwndContext->SCROLL_trackHitTest)
|
||||
if (hittest == pwndData->SCROLL_trackHitTest)
|
||||
{
|
||||
SCROLL_DrawArrows( &context, &sbi, vertical, pwndContext->SCROLL_trackHitTest, 0 );
|
||||
SCROLL_DrawArrows( &context, &sbi, vertical, pwndData->SCROLL_trackHitTest, 0 );
|
||||
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
|
||||
{
|
||||
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
|
||||
|
@ -477,8 +477,8 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
break;
|
||||
|
||||
case SCROLL_TOP_RECT:
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndContext->SCROLL_trackHitTest, 0);
|
||||
if (hittest == pwndContext->SCROLL_trackHitTest)
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndData->SCROLL_trackHitTest, 0);
|
||||
if (hittest == pwndData->SCROLL_trackHitTest)
|
||||
{
|
||||
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
|
||||
{
|
||||
|
@ -494,20 +494,20 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
case SCROLL_THUMB:
|
||||
if (msg == WM_LBUTTONDOWN)
|
||||
{
|
||||
pwndContext->SCROLL_TrackingWin = hwnd;
|
||||
pwndContext->SCROLL_TrackingBar = nBar;
|
||||
pwndContext->SCROLL_TrackingPos = trackThumbPos + lastMousePos - lastClickPos;
|
||||
pwndContext->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar,
|
||||
vertical, pwndContext->SCROLL_TrackingPos );
|
||||
if (!pwndContext->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical);
|
||||
pwndData->SCROLL_TrackingWin = hwnd;
|
||||
pwndData->SCROLL_TrackingBar = nBar;
|
||||
pwndData->SCROLL_TrackingPos = trackThumbPos + lastMousePos - lastClickPos;
|
||||
pwndData->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar,
|
||||
vertical, pwndData->SCROLL_TrackingPos );
|
||||
if (!pwndData->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical);
|
||||
}
|
||||
else if (msg == WM_LBUTTONUP)
|
||||
{
|
||||
if (pwndContext->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical);
|
||||
if (pwndData->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical);
|
||||
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, 0, pwndContext->SCROLL_trackHitTest );
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, 0, pwndData->SCROLL_trackHitTest );
|
||||
}
|
||||
else /* WM_MOUSEMOVE */
|
||||
{
|
||||
|
@ -520,28 +520,28 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
pt = SCROLL_ClipPos( &sbi.rcScrollBar, pt );
|
||||
pos = vertical ? (pt.y - sbi.rcScrollBar.top) : (pt.x - sbi.rcScrollBar.left);
|
||||
}
|
||||
if ( (pos != lastMousePos) || (!pwndContext->SCROLL_MovingThumb) )
|
||||
if ( (pos != lastMousePos) || (!pwndData->SCROLL_MovingThumb) )
|
||||
{
|
||||
if (pwndContext->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical);
|
||||
if (pwndData->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical);
|
||||
lastMousePos = pos;
|
||||
pwndContext->SCROLL_TrackingPos = trackThumbPos + pos - lastClickPos;
|
||||
pwndContext->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar,
|
||||
pwndData->SCROLL_TrackingPos = trackThumbPos + pos - lastClickPos;
|
||||
pwndData->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar,
|
||||
vertical,
|
||||
pwndContext->SCROLL_TrackingPos );
|
||||
pwndData->SCROLL_TrackingPos );
|
||||
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
|
||||
MAKEWPARAM( SB_THUMBTRACK, pwndContext->SCROLL_TrackingVal),
|
||||
MAKEWPARAM( SB_THUMBTRACK, pwndData->SCROLL_TrackingVal),
|
||||
(LPARAM)hwndCtl );
|
||||
if (!pwndContext->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical);
|
||||
if (!pwndData->SCROLL_MovingThumb)
|
||||
SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SCROLL_BOTTOM_RECT:
|
||||
if (hittest == pwndContext->SCROLL_trackHitTest)
|
||||
if (hittest == pwndData->SCROLL_trackHitTest)
|
||||
{
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndContext->SCROLL_trackHitTest, 0 );
|
||||
SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndData->SCROLL_trackHitTest, 0 );
|
||||
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
|
||||
{
|
||||
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
|
||||
|
@ -558,9 +558,9 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
break;
|
||||
|
||||
case SCROLL_BOTTOM_ARROW:
|
||||
if (hittest == pwndContext->SCROLL_trackHitTest)
|
||||
if (hittest == pwndData->SCROLL_trackHitTest)
|
||||
{
|
||||
SCROLL_DrawArrows( &context, &sbi, vertical, pwndContext->SCROLL_trackHitTest, 0 );
|
||||
SCROLL_DrawArrows( &context, &sbi, vertical, pwndData->SCROLL_trackHitTest, 0 );
|
||||
if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER))
|
||||
{
|
||||
SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
|
||||
|
@ -592,8 +592,8 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
|
||||
if (msg == WM_LBUTTONUP)
|
||||
{
|
||||
hittest = pwndContext->SCROLL_trackHitTest;
|
||||
pwndContext->SCROLL_trackHitTest = SCROLL_NOWHERE; /* Terminate tracking */
|
||||
hittest = pwndData->SCROLL_trackHitTest;
|
||||
pwndData->SCROLL_trackHitTest = SCROLL_NOWHERE; /* Terminate tracking */
|
||||
|
||||
if (hittest == SCROLL_THUMB)
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg
|
|||
SB_ENDSCROLL, (LPARAM)hwndCtl );
|
||||
|
||||
/* Terminate tracking */
|
||||
pwndContext->SCROLL_TrackingWin = 0;
|
||||
pwndData->SCROLL_TrackingWin = 0;
|
||||
}
|
||||
|
||||
ThemeCleanupDrawContext(&context);
|
||||
|
@ -617,13 +617,13 @@ static void
|
|||
SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
|
||||
{
|
||||
MSG msg;
|
||||
PWND_CONTEXT pwndContext = ThemeGetWndContext(hwnd);
|
||||
if(!pwndContext)
|
||||
PWND_DATA pwndData = ThemeGetWndData(hwnd);
|
||||
if(!pwndData)
|
||||
return;
|
||||
|
||||
ScreenToWindow(hwnd, &pt);
|
||||
|
||||
SCROLL_HandleScrollEvent(pwndContext, hwnd, scrollbar, WM_LBUTTONDOWN, pt );
|
||||
SCROLL_HandleScrollEvent(pwndData, hwnd, scrollbar, WM_LBUTTONDOWN, pt );
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
|
|||
pt.y = GET_Y_LPARAM(msg.lParam);
|
||||
ClientToScreen(hwnd, &pt);
|
||||
ScreenToWindow(hwnd, &pt);
|
||||
SCROLL_HandleScrollEvent(pwndContext, hwnd, scrollbar, msg.message, pt );
|
||||
SCROLL_HandleScrollEvent(pwndData, hwnd, scrollbar, msg.message, pt );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -596,7 +596,7 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
|||
DRAW_CONTEXT context;
|
||||
TRACKMOUSEEVENT tme;
|
||||
DWORD style;
|
||||
PWND_CONTEXT pcontext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
/* First of all check if we have something to do here */
|
||||
style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||
|
@ -604,8 +604,8 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
|||
return 0;
|
||||
|
||||
/* Get theme data for this window */
|
||||
pcontext = ThemeGetWndContext(hWnd);
|
||||
if (pcontext == NULL)
|
||||
pwndData = ThemeGetWndData(hWnd);
|
||||
if (pwndData == NULL)
|
||||
return 0;
|
||||
|
||||
/* Begin tracking in the non client area if we are not tracking yet */
|
||||
|
@ -623,24 +623,24 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
|||
ThemeInitDrawContext(&context, hWnd, 0);
|
||||
if (context.wi.dwStyle & WS_SYSMENU)
|
||||
{
|
||||
if (HT_ISBUTTON(ht) || HT_ISBUTTON(pcontext->lastHitTest))
|
||||
if (HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest))
|
||||
ThemeDrawCaptionButtons(&context, ht, 0);
|
||||
}
|
||||
|
||||
if (context.wi.dwStyle & WS_HSCROLL)
|
||||
{
|
||||
if (ht == HTHSCROLL || pcontext->lastHitTest == HTHSCROLL)
|
||||
if (ht == HTHSCROLL || pwndData->lastHitTest == HTHSCROLL)
|
||||
ThemeDrawScrollBar(&context, SB_HORZ , ht == HTHSCROLL ? pt : NULL);
|
||||
}
|
||||
|
||||
if (context.wi.dwStyle & WS_VSCROLL)
|
||||
{
|
||||
if (ht == HTVSCROLL || pcontext->lastHitTest == HTVSCROLL)
|
||||
if (ht == HTVSCROLL || pwndData->lastHitTest == HTVSCROLL)
|
||||
ThemeDrawScrollBar(&context, SB_VERT, ht == HTVSCROLL ? pt : NULL);
|
||||
}
|
||||
ThemeCleanupDrawContext(&context);
|
||||
|
||||
pcontext->lastHitTest = ht;
|
||||
pwndData->lastHitTest = ht;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ ThemeHandleNcMouseLeave(HWND hWnd)
|
|||
{
|
||||
DRAW_CONTEXT context;
|
||||
DWORD style;
|
||||
PWND_CONTEXT pWndContext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
/* First of all check if we have something to do here */
|
||||
style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||
|
@ -658,23 +658,23 @@ ThemeHandleNcMouseLeave(HWND hWnd)
|
|||
return 0;
|
||||
|
||||
/* Get theme data for this window */
|
||||
pWndContext = ThemeGetWndContext(hWnd);
|
||||
if (pWndContext == NULL)
|
||||
pwndData = ThemeGetWndData(hWnd);
|
||||
if (pwndData == NULL)
|
||||
return 0;
|
||||
|
||||
ThemeInitDrawContext(&context, hWnd, 0);
|
||||
if (context.wi.dwStyle & WS_SYSMENU && HT_ISBUTTON(pWndContext->lastHitTest))
|
||||
if (context.wi.dwStyle & WS_SYSMENU && HT_ISBUTTON(pwndData->lastHitTest))
|
||||
ThemeDrawCaptionButtons(&context, 0, 0);
|
||||
|
||||
if (context.wi.dwStyle & WS_HSCROLL && pWndContext->lastHitTest == HTHSCROLL)
|
||||
if (context.wi.dwStyle & WS_HSCROLL && pwndData->lastHitTest == HTHSCROLL)
|
||||
ThemeDrawScrollBar(&context, SB_HORZ, NULL);
|
||||
|
||||
if (context.wi.dwStyle & WS_VSCROLL && pWndContext->lastHitTest == HTVSCROLL)
|
||||
if (context.wi.dwStyle & WS_VSCROLL && pwndData->lastHitTest == HTVSCROLL)
|
||||
ThemeDrawScrollBar(&context, SB_VERT, NULL);
|
||||
|
||||
ThemeCleanupDrawContext(&context);
|
||||
|
||||
pWndContext->lastHitTest = HTNOWHERE;
|
||||
pwndData->lastHitTest = HTNOWHERE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ ThemeHandleButton(HWND hWnd, WPARAM wParam)
|
|||
WPARAM SCMsg, ht;
|
||||
ULONG Style;
|
||||
DRAW_CONTEXT context;
|
||||
PWND_CONTEXT pWndContext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
Style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||
if (!((Style & WS_CAPTION) && (Style & WS_SYSMENU)))
|
||||
|
@ -713,13 +713,13 @@ ThemeHandleButton(HWND hWnd, WPARAM wParam)
|
|||
}
|
||||
|
||||
/* Get theme data for this window */
|
||||
pWndContext = ThemeGetWndContext(hWnd);
|
||||
if (pWndContext == NULL)
|
||||
pwndData = ThemeGetWndData(hWnd);
|
||||
if (pwndData == NULL)
|
||||
return;
|
||||
|
||||
ThemeInitDrawContext(&context, hWnd, 0);
|
||||
ThemeDrawCaptionButtons(&context, 0, wParam);
|
||||
pWndContext->lastHitTest = wParam;
|
||||
pwndData->lastHitTest = wParam;
|
||||
|
||||
SetCapture(hWnd);
|
||||
|
||||
|
@ -740,11 +740,11 @@ ThemeHandleButton(HWND hWnd, WPARAM wParam)
|
|||
Pressed = (ht == wParam);
|
||||
|
||||
/* Only draw the buttons if the hit test changed */
|
||||
if (ht != pWndContext->lastHitTest &&
|
||||
(HT_ISBUTTON(ht) || HT_ISBUTTON(pWndContext->lastHitTest)))
|
||||
if (ht != pwndData->lastHitTest &&
|
||||
(HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest)))
|
||||
{
|
||||
ThemeDrawCaptionButtons(&context, 0, Pressed ? wParam: 0);
|
||||
pWndContext->lastHitTest = ht;
|
||||
pwndData->lastHitTest = ht;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,72 +14,72 @@ BYTE gabMSGPmessages[UAHOWP_MAX_SIZE];
|
|||
BYTE gabDLGPmessages[UAHOWP_MAX_SIZE];
|
||||
BOOL gbThemeHooksActive = FALSE;
|
||||
|
||||
PWND_CONTEXT ThemeGetWndContext(HWND hWnd)
|
||||
PWND_DATA ThemeGetWndData(HWND hWnd)
|
||||
{
|
||||
PWND_CONTEXT pcontext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
pcontext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext));
|
||||
if(pcontext == NULL)
|
||||
pwndData = (PWND_DATA)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext));
|
||||
if(pwndData == NULL)
|
||||
{
|
||||
pcontext = HeapAlloc(GetProcessHeap(),
|
||||
pwndData = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(WND_CONTEXT));
|
||||
if(pcontext == NULL)
|
||||
sizeof(WND_DATA));
|
||||
if(pwndData == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), pcontext);
|
||||
SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), pwndData);
|
||||
}
|
||||
|
||||
return pcontext;
|
||||
return pwndData;
|
||||
}
|
||||
|
||||
void ThemeDestroyWndContext(HWND hWnd)
|
||||
void ThemeDestroyWndData(HWND hWnd)
|
||||
{
|
||||
PWND_CONTEXT pContext;
|
||||
PWND_DATA pwndData;
|
||||
DWORD ProcessId;
|
||||
|
||||
/*Do not destroy WND_CONTEXT of a window that belong to another process */
|
||||
/*Do not destroy WND_DATA of a window that belong to another process */
|
||||
GetWindowThreadProcessId(hWnd, &ProcessId);
|
||||
if(ProcessId != GetCurrentProcessId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pContext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext));
|
||||
if(pContext == NULL)
|
||||
pwndData = (PWND_DATA)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext));
|
||||
if(pwndData == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(pContext->HasThemeRgn)
|
||||
if(pwndData->HasThemeRgn)
|
||||
{
|
||||
user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
|
||||
}
|
||||
|
||||
if (pContext->hTabBackgroundBrush != NULL)
|
||||
if (pwndData->hTabBackgroundBrush != NULL)
|
||||
{
|
||||
CloseThemeData(GetWindowTheme(hWnd));
|
||||
|
||||
DeleteObject(pContext->hTabBackgroundBrush);
|
||||
pContext->hTabBackgroundBrush = NULL;
|
||||
DeleteObject(pwndData->hTabBackgroundBrush);
|
||||
pwndData->hTabBackgroundBrush = NULL;
|
||||
}
|
||||
|
||||
if (pContext->hTabBackgroundBmp != NULL)
|
||||
if (pwndData->hTabBackgroundBmp != NULL)
|
||||
{
|
||||
DeleteObject(pContext->hTabBackgroundBmp);
|
||||
pContext->hTabBackgroundBmp = NULL;
|
||||
DeleteObject(pwndData->hTabBackgroundBmp);
|
||||
pwndData->hTabBackgroundBmp = NULL;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pContext);
|
||||
HeapFree(GetProcessHeap(), 0, pwndData);
|
||||
|
||||
SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), NULL);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK ThemeCleanupChildWndContext (HWND hWnd, LPARAM msg)
|
||||
{
|
||||
ThemeDestroyWndContext(hWnd);
|
||||
ThemeDestroyWndData(hWnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ static BOOL CALLBACK ThemeCleanupWndContext(HWND hWnd, LPARAM msg)
|
|||
}
|
||||
else
|
||||
{
|
||||
ThemeDestroyWndContext(hWnd);
|
||||
ThemeDestroyWndData(hWnd);
|
||||
EnumChildWindows (hWnd, ThemeCleanupChildWndContext, 0);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ void SetThemeRegion(HWND hWnd)
|
|||
|
||||
int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
|
||||
{
|
||||
PWND_CONTEXT pcontext;
|
||||
PWND_DATA pwndData;
|
||||
DWORD style;
|
||||
|
||||
/* We only proceed to change the window shape if it has a caption */
|
||||
|
@ -159,37 +159,37 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
|
|||
return 0;
|
||||
|
||||
/* Get theme data for this window */
|
||||
pcontext = ThemeGetWndContext(hWnd);
|
||||
if (pcontext == NULL)
|
||||
pwndData = ThemeGetWndData(hWnd);
|
||||
if (pwndData == NULL)
|
||||
return 0;
|
||||
|
||||
/* Do not change the region of the window if its size wasn't changed */
|
||||
if ((pWinPos->flags & SWP_NOSIZE) != 0 && pcontext->DirtyThemeRegion == FALSE)
|
||||
if ((pWinPos->flags & SWP_NOSIZE) != 0 && pwndData->DirtyThemeRegion == FALSE)
|
||||
return 0;
|
||||
|
||||
/* We don't touch the shape of the window if the application sets it on its own */
|
||||
if (pcontext->HasAppDefinedRgn == TRUE)
|
||||
if (pwndData->HasAppDefinedRgn == TRUE)
|
||||
return 0;
|
||||
|
||||
/* Calling SetWindowRgn will call SetWindowPos again so we need to avoid this recursion */
|
||||
if (pcontext->UpdatingRgn == TRUE)
|
||||
if (pwndData->UpdatingRgn == TRUE)
|
||||
return 0;
|
||||
|
||||
if(!IsAppThemed())
|
||||
{
|
||||
if(pcontext->HasThemeRgn)
|
||||
if(pwndData->HasThemeRgn)
|
||||
{
|
||||
pcontext->HasThemeRgn = FALSE;
|
||||
pwndData->HasThemeRgn = FALSE;
|
||||
user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pcontext->DirtyThemeRegion = FALSE;
|
||||
pcontext->HasThemeRgn = TRUE;
|
||||
pcontext->UpdatingRgn = TRUE;
|
||||
pwndData->DirtyThemeRegion = FALSE;
|
||||
pwndData->HasThemeRgn = TRUE;
|
||||
pwndData->UpdatingRgn = TRUE;
|
||||
SetThemeRegion(hWnd);
|
||||
pcontext->UpdatingRgn = FALSE;
|
||||
pwndData->UpdatingRgn = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -241,32 +241,32 @@ ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR
|
|||
{
|
||||
case WM_THEMECHANGED:
|
||||
{
|
||||
PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd);
|
||||
PWND_DATA pwndData = ThemeGetWndData(hWnd);
|
||||
|
||||
if (GetAncestor(hWnd, GA_PARENT) == GetDesktopWindow())
|
||||
UXTHEME_LoadTheme(TRUE);
|
||||
|
||||
if (pcontext == NULL)
|
||||
if (pwndData == NULL)
|
||||
return 0;
|
||||
|
||||
if (pcontext->hTabBackgroundBrush != NULL)
|
||||
if (pwndData->hTabBackgroundBrush != NULL)
|
||||
{
|
||||
DeleteObject(pcontext->hTabBackgroundBrush);
|
||||
pcontext->hTabBackgroundBrush = NULL;
|
||||
DeleteObject(pwndData->hTabBackgroundBrush);
|
||||
pwndData->hTabBackgroundBrush = NULL;
|
||||
}
|
||||
|
||||
if (pcontext->hTabBackgroundBmp != NULL)
|
||||
if (pwndData->hTabBackgroundBmp != NULL)
|
||||
{
|
||||
DeleteObject(pcontext->hTabBackgroundBmp);
|
||||
pcontext->hTabBackgroundBmp = NULL;
|
||||
DeleteObject(pwndData->hTabBackgroundBmp);
|
||||
pwndData->hTabBackgroundBmp = NULL;
|
||||
}
|
||||
}
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd);
|
||||
if (pcontext == NULL)
|
||||
PWND_DATA pwndData = ThemeGetWndData(hWnd);
|
||||
if (pwndData == NULL)
|
||||
return 0;
|
||||
pcontext->DirtyThemeRegion = TRUE;
|
||||
pwndData->DirtyThemeRegion = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ ThemePostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR
|
|||
}
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
ThemeDestroyWndContext(hWnd);
|
||||
ThemeDestroyWndData(hWnd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -295,13 +295,13 @@ ThemePostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR
|
|||
|
||||
HRESULT GetDiaogTextureBrush(HTHEME theme, HWND hwnd, HDC hdc, HBRUSH* result, BOOL changeOrigin)
|
||||
{
|
||||
PWND_CONTEXT pcontext;
|
||||
PWND_DATA pwndData;
|
||||
|
||||
pcontext = ThemeGetWndContext(hwnd);
|
||||
if (pcontext == NULL)
|
||||
pwndData = ThemeGetWndData(hwnd);
|
||||
if (pwndData == NULL)
|
||||
return E_FAIL;
|
||||
|
||||
if (pcontext->hTabBackgroundBrush == NULL)
|
||||
if (pwndData->hTabBackgroundBrush == NULL)
|
||||
{
|
||||
HBITMAP hbmp;
|
||||
RECT dummy, bmpRect;
|
||||
|
@ -337,18 +337,18 @@ HRESULT GetDiaogTextureBrush(HTHEME theme, HWND hwnd, HDC hdc, HBRUSH* result, B
|
|||
DeleteDC(hdcHackPattern);
|
||||
|
||||
/* Keep the handle of the bitmap we created so that it can be used later */
|
||||
pcontext->hTabBackgroundBmp = hbmpHack;
|
||||
pwndData->hTabBackgroundBmp = hbmpHack;
|
||||
hbmp = hbmpHack;
|
||||
}
|
||||
|
||||
/* hbmp is cached so there is no need to free it */
|
||||
pcontext->hTabBackgroundBrush = CreatePatternBrush(hbmp);
|
||||
pwndData->hTabBackgroundBrush = CreatePatternBrush(hbmp);
|
||||
}
|
||||
|
||||
if (!pcontext->hTabBackgroundBrush)
|
||||
if (!pwndData->hTabBackgroundBrush)
|
||||
return E_FAIL;
|
||||
|
||||
*result = pcontext->hTabBackgroundBrush;
|
||||
*result = pwndData->hTabBackgroundBrush;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -417,11 +417,11 @@ ThemeDlgPostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_
|
|||
|
||||
int WINAPI ThemeSetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
|
||||
{
|
||||
PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd);
|
||||
if(pcontext)
|
||||
PWND_DATA pwndData = ThemeGetWndData(hWnd);
|
||||
if(pwndData)
|
||||
{
|
||||
pcontext->HasAppDefinedRgn = TRUE;
|
||||
pcontext->HasThemeRgn = FALSE;
|
||||
pwndData->HasAppDefinedRgn = TRUE;
|
||||
pwndData->HasThemeRgn = FALSE;
|
||||
}
|
||||
|
||||
return user32ApiHook.SetWindowRgn(hWnd, hRgn, bRedraw);
|
||||
|
@ -429,7 +429,7 @@ int WINAPI ThemeSetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
|
|||
|
||||
BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
|
||||
{
|
||||
PWND_CONTEXT pwndContext;
|
||||
PWND_DATA pwndData;
|
||||
DWORD style;
|
||||
BOOL ret;
|
||||
|
||||
|
@ -441,8 +441,8 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
|
|||
if((style & (WS_HSCROLL|WS_VSCROLL))==0)
|
||||
goto dodefault;
|
||||
|
||||
pwndContext = ThemeGetWndContext(hwnd);
|
||||
if (pwndContext == NULL)
|
||||
pwndData = ThemeGetWndData(hwnd);
|
||||
if (pwndData == NULL)
|
||||
goto dodefault;
|
||||
|
||||
/*
|
||||
|
@ -454,10 +454,10 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
|
|||
ret = user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
|
||||
if ( lpsi &&
|
||||
(lpsi->fMask & SIF_TRACKPOS) &&
|
||||
pwndContext->SCROLL_TrackingWin == hwnd &&
|
||||
pwndContext->SCROLL_TrackingBar == fnBar)
|
||||
pwndData->SCROLL_TrackingWin == hwnd &&
|
||||
pwndData->SCROLL_TrackingBar == fnBar)
|
||||
{
|
||||
lpsi->nTrackPos = pwndContext->SCROLL_TrackingVal;
|
||||
lpsi->nTrackPos = pwndData->SCROLL_TrackingVal;
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ enum SCROLL_HITTEST
|
|||
};
|
||||
|
||||
/* The window context stores data for the window needed through the life of the window */
|
||||
typedef struct _WND_CONTEXT
|
||||
typedef struct _WND_DATA
|
||||
{
|
||||
UINT lastHitTest;
|
||||
BOOL HasAppDefinedRgn;
|
||||
|
@ -151,7 +151,7 @@ typedef struct _WND_CONTEXT
|
|||
INT SCROLL_TrackingBar;
|
||||
INT SCROLL_TrackingPos;
|
||||
INT SCROLL_TrackingVal;
|
||||
} WND_CONTEXT, *PWND_CONTEXT;
|
||||
} WND_DATA, *PWND_DATA;
|
||||
|
||||
/* The draw context stores data that are needed by the drawing operations in the non client area of the window */
|
||||
typedef struct _DRAW_CONTEXT
|
||||
|
@ -228,7 +228,7 @@ void ThemeDrawScrollBar(PDRAW_CONTEXT pcontext, INT Bar, POINT* pt);
|
|||
VOID NC_TrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt);
|
||||
void ThemeInitDrawContext(PDRAW_CONTEXT pcontext, HWND hWnd, HRGN hRgn);
|
||||
void ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext);
|
||||
PWND_CONTEXT ThemeGetWndContext(HWND hWnd);
|
||||
PWND_DATA ThemeGetWndData(HWND hWnd);
|
||||
|
||||
extern HINSTANCE hDllInst;
|
||||
extern ATOM atWindowTheme;
|
||||
|
|
Loading…
Reference in a new issue