mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[UXTHEME] nonclient.c: Formatting only
This commit is contained in:
parent
118869f69c
commit
fa29a61271
1 changed files with 85 additions and 86 deletions
|
@ -5,14 +5,14 @@
|
||||||
* PURPOSE: uxtheme non client area management
|
* PURPOSE: uxtheme non client area management
|
||||||
* PROGRAMMER: Giannis Adamopoulos
|
* PROGRAMMER: Giannis Adamopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uxthemep.h"
|
#include "uxthemep.h"
|
||||||
|
|
||||||
#define NC_PREVIEW_MSGBOX_HALF_WIDTH 75
|
#define NC_PREVIEW_MSGBOX_HALF_WIDTH 75
|
||||||
#define NC_PREVIEW_MSGBOX_OFFSET_X -29
|
#define NC_PREVIEW_MSGBOX_OFFSET_X -29
|
||||||
#define NC_PREVIEW_MSGBOX_OFFSET_Y 71
|
#define NC_PREVIEW_MSGBOX_OFFSET_Y 71
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
IsWindowActive(HWND hWnd, DWORD ExStyle)
|
IsWindowActive(HWND hWnd, DWORD ExStyle)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
@ -35,13 +35,14 @@ BOOL
|
||||||
IsScrollBarVisible(HWND hWnd, INT hBar)
|
IsScrollBarVisible(HWND hWnd, INT hBar)
|
||||||
{
|
{
|
||||||
SCROLLBARINFO sbi = {sizeof(SCROLLBARINFO)};
|
SCROLLBARINFO sbi = {sizeof(SCROLLBARINFO)};
|
||||||
if(!GetScrollBarInfo(hWnd, hBar, &sbi))
|
|
||||||
|
if (!GetScrollBarInfo(hWnd, hBar, &sbi))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
|
return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
UserHasWindowEdge(DWORD Style, DWORD ExStyle)
|
UserHasWindowEdge(DWORD Style, DWORD ExStyle)
|
||||||
{
|
{
|
||||||
if (Style & WS_MINIMIZE)
|
if (Style & WS_MINIMIZE)
|
||||||
|
@ -115,12 +116,12 @@ HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT* pRect, int iPa
|
||||||
InternalGetWindowText(pcontext->hWnd, pszText, len);
|
InternalGetWindowText(pcontext->hWnd, pszText, len);
|
||||||
|
|
||||||
hr = GetThemeSysFont(pcontext->theme, TMT_CAPTIONFONT, &logfont);
|
hr = GetThemeSysFont(pcontext->theme, TMT_CAPTIONFONT, &logfont);
|
||||||
if(SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hFont = CreateFontIndirectW(&logfont);
|
hFont = CreateFontIndirectW(&logfont);
|
||||||
|
|
||||||
if(hFont)
|
if (hFont)
|
||||||
oldFont = SelectObject(pcontext->hDC, hFont);
|
oldFont = SelectObject(pcontext->hDC, hFont);
|
||||||
|
|
||||||
textColor = GetThemeSysColor(pcontext->theme, pcontext->Active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT);
|
textColor = GetThemeSysColor(pcontext->theme, pcontext->Active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT);
|
||||||
|
|
||||||
GetThemeEnumValue(pcontext->theme, iPartId, iStateId, TMT_CONTENTALIGNMENT, &align);
|
GetThemeEnumValue(pcontext->theme, iPartId, iStateId, TMT_CONTENTALIGNMENT, &align);
|
||||||
|
@ -130,14 +131,14 @@ HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT* pRect, int iPa
|
||||||
drawStyles |= DT_RIGHT;
|
drawStyles |= DT_RIGHT;
|
||||||
|
|
||||||
oldTextColor = SetTextColor(pcontext->hDC, textColor);
|
oldTextColor = SetTextColor(pcontext->hDC, textColor);
|
||||||
DrawThemeText(pcontext->theme,
|
DrawThemeText(pcontext->theme,
|
||||||
pcontext->hDC,
|
pcontext->hDC,
|
||||||
iPartId,
|
iPartId,
|
||||||
iStateId,
|
iStateId,
|
||||||
pszText,
|
pszText,
|
||||||
len - 1,
|
len - 1,
|
||||||
drawStyles,
|
drawStyles,
|
||||||
0,
|
0,
|
||||||
pRect);
|
pRect);
|
||||||
SetTextColor(pcontext->hDC, oldTextColor);
|
SetTextColor(pcontext->hDC, oldTextColor);
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ ThemeInitDrawContext(PDRAW_CONTEXT pcontext,
|
||||||
pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
|
pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
|
||||||
pcontext->CaptionHeight += GetSystemMetrics(pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMCAPTION : SM_CYCAPTION );
|
pcontext->CaptionHeight += GetSystemMetrics(pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMCAPTION : SM_CYCAPTION );
|
||||||
|
|
||||||
if(hRgn <= (HRGN)1)
|
if (hRgn <= (HRGN)1)
|
||||||
{
|
{
|
||||||
hRgn = CreateRectRgnIndirect(&pcontext->wi.rcWindow);
|
hRgn = CreateRectRgnIndirect(&pcontext->wi.rcWindow);
|
||||||
}
|
}
|
||||||
|
@ -182,20 +183,20 @@ ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
|
||||||
{
|
{
|
||||||
ReleaseDC(pcontext->hWnd ,pcontext->hDC);
|
ReleaseDC(pcontext->hWnd ,pcontext->hDC);
|
||||||
|
|
||||||
if(pcontext->hRgn != NULL)
|
if (pcontext->hRgn != NULL)
|
||||||
{
|
{
|
||||||
DeleteObject(pcontext->hRgn);
|
DeleteObject(pcontext->hRgn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ThemeStartBufferedPaint(PDRAW_CONTEXT pcontext, int cx, int cy)
|
ThemeStartBufferedPaint(PDRAW_CONTEXT pcontext, int cx, int cy)
|
||||||
{
|
{
|
||||||
HBITMAP hbmp;
|
HBITMAP hbmp;
|
||||||
|
|
||||||
pcontext->hDCScreen = pcontext->hDC;
|
pcontext->hDCScreen = pcontext->hDC;
|
||||||
pcontext->hDC = CreateCompatibleDC(pcontext->hDCScreen);
|
pcontext->hDC = CreateCompatibleDC(pcontext->hDCScreen);
|
||||||
hbmp = CreateCompatibleBitmap(pcontext->hDCScreen, cx, cy);
|
hbmp = CreateCompatibleBitmap(pcontext->hDCScreen, cx, cy);
|
||||||
pcontext->hbmpOld = (HBITMAP)SelectObject(pcontext->hDC, hbmp);
|
pcontext->hbmpOld = (HBITMAP)SelectObject(pcontext->hDC, hbmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@ static void ThemeCalculateCaptionButtonsPosEx(WINDOWINFO* wi, HWND hWnd, HTHEME
|
||||||
|
|
||||||
/* First of all check if we have something to do here */
|
/* First of all check if we have something to do here */
|
||||||
style = GetWindowLongW(hWnd, GWL_STYLE);
|
style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||||
if((style & (WS_CAPTION | WS_SYSMENU)) != (WS_CAPTION | WS_SYSMENU))
|
if ((style & (WS_CAPTION | WS_SYSMENU)) != (WS_CAPTION | WS_SYSMENU))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get theme data for this window */
|
/* Get theme data for this window */
|
||||||
|
@ -242,7 +243,7 @@ static void ThemeCalculateCaptionButtonsPosEx(WINDOWINFO* wi, HWND hWnd, HTHEME
|
||||||
rcCurrent.bottom = wi->rcWindow.bottom - wi->rcWindow.top;
|
rcCurrent.bottom = wi->rcWindow.bottom - wi->rcWindow.top;
|
||||||
|
|
||||||
/* Add a padding around the objects of the caption */
|
/* Add a padding around the objects of the caption */
|
||||||
InflateRect(&rcCurrent, -(int)wi->cyWindowBorders-BUTTON_GAP_SIZE,
|
InflateRect(&rcCurrent, -(int)wi->cyWindowBorders-BUTTON_GAP_SIZE,
|
||||||
-(int)wi->cyWindowBorders-BUTTON_GAP_SIZE);
|
-(int)wi->cyWindowBorders-BUTTON_GAP_SIZE);
|
||||||
|
|
||||||
iPartId = wi->dwExStyle & WS_EX_TOOLWINDOW ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
|
iPartId = wi->dwExStyle & WS_EX_TOOLWINDOW ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
|
||||||
|
@ -270,17 +271,18 @@ void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme)
|
||||||
{
|
{
|
||||||
INT btnHeight;
|
INT btnHeight;
|
||||||
WINDOWINFO wi = {sizeof(wi)};
|
WINDOWINFO wi = {sizeof(wi)};
|
||||||
if(!GetWindowInfo(hWnd, &wi))
|
|
||||||
|
if (!GetWindowInfo(hWnd, &wi))
|
||||||
return;
|
return;
|
||||||
btnHeight = GetSystemMetrics(wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMSIZE : SM_CYSIZE);
|
btnHeight = GetSystemMetrics(wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMSIZE : SM_CYSIZE);
|
||||||
|
|
||||||
ThemeCalculateCaptionButtonsPosEx(&wi, hWnd, htheme, btnHeight);
|
ThemeCalculateCaptionButtonsPosEx(&wi, hWnd, htheme, btnHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
|
ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
|
||||||
RECT* prcCurrent,
|
RECT* prcCurrent,
|
||||||
CAPTIONBUTTON buttonId,
|
CAPTIONBUTTON buttonId,
|
||||||
INT iStateId)
|
INT iStateId)
|
||||||
{
|
{
|
||||||
INT iPartId;
|
INT iPartId;
|
||||||
|
@ -323,12 +325,12 @@ ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
|
||||||
else
|
else
|
||||||
iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
|
iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
iPartId = pcontext->wi.dwStyle & WS_MINIMIZE ? WP_RESTOREBUTTON : WP_MINBUTTON;
|
iPartId = pcontext->wi.dwStyle & WS_MINIMIZE ? WP_RESTOREBUTTON : WP_MINBUTTON;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//FIXME: Implement Help Button
|
//FIXME: Implement Help Button
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,13 +352,13 @@ ThemeGetButtonState(DWORD htCurrect, DWORD htHot, DWORD htDown, BOOL Active)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used only from mouse event handlers */
|
/* Used only from mouse event handlers */
|
||||||
static void
|
static void
|
||||||
ThemeDrawCaptionButtons(PDRAW_CONTEXT pcontext, DWORD htHot, DWORD htDown)
|
ThemeDrawCaptionButtons(PDRAW_CONTEXT pcontext, DWORD htHot, DWORD htDown)
|
||||||
{
|
{
|
||||||
/* Draw the buttons */
|
/* Draw the buttons */
|
||||||
ThemeDrawCaptionButton(pcontext, NULL, CLOSEBUTTON,
|
ThemeDrawCaptionButton(pcontext, NULL, CLOSEBUTTON,
|
||||||
ThemeGetButtonState(HTCLOSE, htHot, htDown, pcontext->Active));
|
ThemeGetButtonState(HTCLOSE, htHot, htDown, pcontext->Active));
|
||||||
ThemeDrawCaptionButton(pcontext, NULL, MAXBUTTON,
|
ThemeDrawCaptionButton(pcontext, NULL, MAXBUTTON,
|
||||||
ThemeGetButtonState(HTMAXBUTTON, htHot, htDown, pcontext->Active));
|
ThemeGetButtonState(HTMAXBUTTON, htHot, htDown, pcontext->Active));
|
||||||
ThemeDrawCaptionButton(pcontext, NULL, MINBUTTON,
|
ThemeDrawCaptionButton(pcontext, NULL, MINBUTTON,
|
||||||
ThemeGetButtonState(HTMINBUTTON, htHot, htDown, pcontext->Active));
|
ThemeGetButtonState(HTMINBUTTON, htHot, htDown, pcontext->Active));
|
||||||
|
@ -365,7 +367,7 @@ ThemeDrawCaptionButtons(PDRAW_CONTEXT pcontext, DWORD htHot, DWORD htDown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used from WM_NCPAINT and WM_NCACTIVATE handlers */
|
/* Used from WM_NCPAINT and WM_NCACTIVATE handlers */
|
||||||
static void
|
static void
|
||||||
ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
{
|
{
|
||||||
RECT rcPart;
|
RECT rcPart;
|
||||||
|
@ -398,7 +400,7 @@ ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
DrawThemeBackground(pcontext->theme, pcontext->hDC,iPart,iState,&rcPart,NULL);
|
DrawThemeBackground(pcontext->theme, pcontext->hDC,iPart,iState,&rcPart,NULL);
|
||||||
|
|
||||||
/* Add a padding around the objects of the caption */
|
/* Add a padding around the objects of the caption */
|
||||||
InflateRect(&rcPart, -(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE,
|
InflateRect(&rcPart, -(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE,
|
||||||
-(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE);
|
-(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE);
|
||||||
|
|
||||||
/* Draw the caption buttons */
|
/* Draw the caption buttons */
|
||||||
|
@ -411,7 +413,7 @@ ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
ThemeDrawCaptionButton(pcontext, &rcPart, MINBUTTON, iState);
|
ThemeDrawCaptionButton(pcontext, &rcPart, MINBUTTON, iState);
|
||||||
ThemeDrawCaptionButton(pcontext, &rcPart, HELPBUTTON, iState);
|
ThemeDrawCaptionButton(pcontext, &rcPart, HELPBUTTON, iState);
|
||||||
}
|
}
|
||||||
|
|
||||||
rcPart.top += 3 ;
|
rcPart.top += 3 ;
|
||||||
|
|
||||||
/* Draw the icon */
|
/* Draw the icon */
|
||||||
|
@ -429,7 +431,7 @@ ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
ThemeDrawCaptionText(pcontext, &rcPart, iPart, iState);
|
ThemeDrawCaptionText(pcontext, &rcPart, iPart, iState);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ThemeDrawBorders(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
ThemeDrawBorders(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
{
|
{
|
||||||
RECT rcPart;
|
RECT rcPart;
|
||||||
|
@ -454,14 +456,14 @@ ThemeDrawBorders(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
DrawThemeBackground(pcontext->theme, pcontext->hDC,WP_FRAMERIGHT, iState, &rcPart, NULL);
|
DrawThemeBackground(pcontext->theme, pcontext->hDC,WP_FRAMERIGHT, iState, &rcPart, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DrawClassicFrame(PDRAW_CONTEXT context, RECT* prcCurrent)
|
DrawClassicFrame(PDRAW_CONTEXT context, RECT* prcCurrent)
|
||||||
{
|
{
|
||||||
/* Draw outer edge */
|
/* Draw outer edge */
|
||||||
if (UserHasWindowEdge(context->wi.dwStyle, context->wi.dwExStyle))
|
if (UserHasWindowEdge(context->wi.dwStyle, context->wi.dwExStyle))
|
||||||
{
|
{
|
||||||
DrawEdge(context->hDC, prcCurrent, EDGE_RAISED, BF_RECT | BF_ADJUST);
|
DrawEdge(context->hDC, prcCurrent, EDGE_RAISED, BF_RECT | BF_ADJUST);
|
||||||
}
|
}
|
||||||
else if (context->wi.dwExStyle & WS_EX_STATICEDGE)
|
else if (context->wi.dwExStyle & WS_EX_STATICEDGE)
|
||||||
{
|
{
|
||||||
DrawEdge(context->hDC, prcCurrent, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
|
DrawEdge(context->hDC, prcCurrent, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
|
||||||
|
@ -481,13 +483,13 @@ DrawClassicFrame(PDRAW_CONTEXT context, RECT* prcCurrent)
|
||||||
context->Active ? COLOR_ACTIVEBORDER : COLOR_INACTIVEBORDER));
|
context->Active ? COLOR_ACTIVEBORDER : COLOR_INACTIVEBORDER));
|
||||||
|
|
||||||
/* Draw frame */
|
/* Draw frame */
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
||||||
prcCurrent->right - prcCurrent->left, Height, PATCOPY);
|
prcCurrent->right - prcCurrent->left, Height, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
||||||
Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
|
||||||
prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
|
prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
|
||||||
-Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
-Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
||||||
|
|
||||||
InflateRect(prcCurrent, -Width, -Height);
|
InflateRect(prcCurrent, -Width, -Height);
|
||||||
|
@ -506,13 +508,13 @@ DrawClassicFrame(PDRAW_CONTEXT context, RECT* prcCurrent)
|
||||||
COLOR_WINDOWFRAME));
|
COLOR_WINDOWFRAME));
|
||||||
|
|
||||||
/* Draw frame */
|
/* Draw frame */
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
||||||
prcCurrent->right - prcCurrent->left, Height, PATCOPY);
|
prcCurrent->right - prcCurrent->left, Height, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
|
||||||
Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
|
PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
|
||||||
prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
|
prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
|
||||||
PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
|
PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
|
||||||
-Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
-Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
|
||||||
|
|
||||||
InflateRect(prcCurrent, -Width, -Height);
|
InflateRect(prcCurrent, -Width, -Height);
|
||||||
|
@ -522,11 +524,11 @@ DrawClassicFrame(PDRAW_CONTEXT context, RECT* prcCurrent)
|
||||||
static void ThemeDrawMenuBar(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
static void ThemeDrawMenuBar(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
{
|
{
|
||||||
/* Let the window manager paint the menu */
|
/* Let the window manager paint the menu */
|
||||||
prcCurrent->top += PaintMenuBar(pcontext->hWnd,
|
prcCurrent->top += PaintMenuBar(pcontext->hWnd,
|
||||||
pcontext->hDC,
|
pcontext->hDC,
|
||||||
pcontext->wi.cxWindowBorders,
|
|
||||||
pcontext->wi.cxWindowBorders,
|
pcontext->wi.cxWindowBorders,
|
||||||
prcCurrent->top,
|
pcontext->wi.cxWindowBorders,
|
||||||
|
prcCurrent->top,
|
||||||
pcontext->Active);
|
pcontext->Active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,13 +565,13 @@ static void ThemeDrawScrollBarsGrip(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBuffering)
|
ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBuffering)
|
||||||
{
|
{
|
||||||
if(!(pcontext->wi.dwStyle & WS_VISIBLE))
|
if (!(pcontext->wi.dwStyle & WS_VISIBLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION)
|
if ((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION)
|
||||||
{
|
{
|
||||||
if (bDoDoubleBuffering)
|
if (bDoDoubleBuffering)
|
||||||
ThemeStartBufferedPaint(pcontext, prcCurrent->right, pcontext->CaptionHeight);
|
ThemeStartBufferedPaint(pcontext, prcCurrent->right, pcontext->CaptionHeight);
|
||||||
|
@ -583,24 +585,24 @@ ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBufferi
|
||||||
DrawClassicFrame(pcontext, prcCurrent);
|
DrawClassicFrame(pcontext, prcCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pcontext->wi.dwStyle & WS_MINIMIZE)
|
if (pcontext->wi.dwStyle & WS_MINIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(HAS_MENU(pcontext->hWnd, pcontext->wi.dwStyle))
|
if (HAS_MENU(pcontext->hWnd, pcontext->wi.dwStyle))
|
||||||
ThemeDrawMenuBar(pcontext, prcCurrent);
|
ThemeDrawMenuBar(pcontext, prcCurrent);
|
||||||
|
|
||||||
if (pcontext->wi.dwExStyle & WS_EX_CLIENTEDGE)
|
if (pcontext->wi.dwExStyle & WS_EX_CLIENTEDGE)
|
||||||
DrawEdge(pcontext->hDC, prcCurrent, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
DrawEdge(pcontext->hDC, prcCurrent, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||||
|
|
||||||
if((pcontext->wi.dwStyle & WS_HSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL))
|
if ((pcontext->wi.dwStyle & WS_HSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL))
|
||||||
ThemeDrawScrollBar(pcontext, SB_HORZ , NULL);
|
ThemeDrawScrollBar(pcontext, SB_HORZ , NULL);
|
||||||
|
|
||||||
if((pcontext->wi.dwStyle & WS_VSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
|
if ((pcontext->wi.dwStyle & WS_VSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
|
||||||
ThemeDrawScrollBar(pcontext, SB_VERT, NULL);
|
ThemeDrawScrollBar(pcontext, SB_VERT, NULL);
|
||||||
|
|
||||||
if((pcontext->wi.dwStyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL) &&
|
if ((pcontext->wi.dwStyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL) &&
|
||||||
IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL) &&
|
IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL) &&
|
||||||
IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
|
IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
|
||||||
{
|
{
|
||||||
ThemeDrawScrollBarsGrip(pcontext, prcCurrent);
|
ThemeDrawScrollBarsGrip(pcontext, prcCurrent);
|
||||||
}
|
}
|
||||||
|
@ -610,7 +612,7 @@ ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBufferi
|
||||||
* Message handlers
|
* Message handlers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
|
ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
|
||||||
{
|
{
|
||||||
DRAW_CONTEXT context;
|
DRAW_CONTEXT context;
|
||||||
|
@ -627,7 +629,7 @@ ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
||||||
{
|
{
|
||||||
DRAW_CONTEXT context;
|
DRAW_CONTEXT context;
|
||||||
|
@ -637,7 +639,7 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
||||||
|
|
||||||
/* First of all check if we have something to do here */
|
/* First of all check if we have something to do here */
|
||||||
style = GetWindowLongW(hWnd, GWL_STYLE);
|
style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||||
if((style & (WS_CAPTION|WS_HSCROLL|WS_VSCROLL))==0)
|
if ((style & (WS_CAPTION|WS_HSCROLL|WS_VSCROLL))==0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Get theme data for this window */
|
/* Get theme data for this window */
|
||||||
|
@ -682,7 +684,7 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
ThemeHandleNcMouseLeave(HWND hWnd)
|
ThemeHandleNcMouseLeave(HWND hWnd)
|
||||||
{
|
{
|
||||||
DRAW_CONTEXT context;
|
DRAW_CONTEXT context;
|
||||||
|
@ -691,7 +693,7 @@ ThemeHandleNcMouseLeave(HWND hWnd)
|
||||||
|
|
||||||
/* First of all check if we have something to do here */
|
/* First of all check if we have something to do here */
|
||||||
style = GetWindowLongW(hWnd, GWL_STYLE);
|
style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||||
if((style & (WS_CAPTION|WS_HSCROLL|WS_VSCROLL))==0)
|
if ((style & (WS_CAPTION|WS_HSCROLL|WS_VSCROLL))==0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Get theme data for this window */
|
/* Get theme data for this window */
|
||||||
|
@ -794,7 +796,6 @@ ThemeHandleButton(HWND hWnd, WPARAM wParam)
|
||||||
SendMessageW(hWnd, WM_SYSCOMMAND, SCMsg, 0);
|
SendMessageW(hWnd, WM_SYSCOMMAND, SCMsg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
DefWndNCHitTest(HWND hWnd, POINT Point)
|
DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
{
|
{
|
||||||
|
@ -825,9 +826,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
ThickFrame = (wi.dwStyle & WS_THICKFRAME);
|
ThickFrame = (wi.dwStyle & WS_THICKFRAME);
|
||||||
if (Point.y < WindowRect.top)
|
if (Point.y < WindowRect.top)
|
||||||
{
|
{
|
||||||
if(wi.dwStyle & WS_MINIMIZE)
|
if (wi.dwStyle & WS_MINIMIZE)
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
if(!ThickFrame)
|
if (!ThickFrame)
|
||||||
return HTBORDER;
|
return HTBORDER;
|
||||||
if (Point.x < (WindowRect.left + XSize))
|
if (Point.x < (WindowRect.left + XSize))
|
||||||
return HTTOPLEFT;
|
return HTTOPLEFT;
|
||||||
|
@ -837,9 +838,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
}
|
}
|
||||||
if (Point.y >= WindowRect.bottom)
|
if (Point.y >= WindowRect.bottom)
|
||||||
{
|
{
|
||||||
if(wi.dwStyle & WS_MINIMIZE)
|
if (wi.dwStyle & WS_MINIMIZE)
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
if(!ThickFrame)
|
if (!ThickFrame)
|
||||||
return HTBORDER;
|
return HTBORDER;
|
||||||
if (Point.x < (WindowRect.left + XSize))
|
if (Point.x < (WindowRect.left + XSize))
|
||||||
return HTBOTTOMLEFT;
|
return HTBOTTOMLEFT;
|
||||||
|
@ -849,9 +850,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
}
|
}
|
||||||
if (Point.x < WindowRect.left)
|
if (Point.x < WindowRect.left)
|
||||||
{
|
{
|
||||||
if(wi.dwStyle & WS_MINIMIZE)
|
if (wi.dwStyle & WS_MINIMIZE)
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
if(!ThickFrame)
|
if (!ThickFrame)
|
||||||
return HTBORDER;
|
return HTBORDER;
|
||||||
if (Point.y < (WindowRect.top + YSize))
|
if (Point.y < (WindowRect.top + YSize))
|
||||||
return HTTOPLEFT;
|
return HTTOPLEFT;
|
||||||
|
@ -861,9 +862,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
}
|
}
|
||||||
if (Point.x >= WindowRect.right)
|
if (Point.x >= WindowRect.right)
|
||||||
{
|
{
|
||||||
if(wi.dwStyle & WS_MINIMIZE)
|
if (wi.dwStyle & WS_MINIMIZE)
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
if(!ThickFrame)
|
if (!ThickFrame)
|
||||||
return HTBORDER;
|
return HTBORDER;
|
||||||
if (Point.y < (WindowRect.top + YSize))
|
if (Point.y < (WindowRect.top + YSize))
|
||||||
return HTTOPRIGHT;
|
return HTTOPRIGHT;
|
||||||
|
@ -897,7 +898,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
|
|
||||||
if (!(wi.dwExStyle & WS_EX_TOOLWINDOW))
|
if (!(wi.dwExStyle & WS_EX_TOOLWINDOW))
|
||||||
{
|
{
|
||||||
// if(!(wi.dwExStyle & WS_EX_DLGMODALFRAME))
|
// if (!(wi.dwExStyle & WS_EX_DLGMODALFRAME))
|
||||||
// FIXME: The real test should check whether there is
|
// FIXME: The real test should check whether there is
|
||||||
// an icon for the system window, and if so, do the
|
// an icon for the system window, and if so, do the
|
||||||
// rect.left increase.
|
// rect.left increase.
|
||||||
|
@ -924,7 +925,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(wi.dwStyle & WS_MINIMIZE))
|
if (!(wi.dwStyle & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
HMENU menu;
|
HMENU menu;
|
||||||
|
|
||||||
|
@ -973,7 +974,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
|
|
||||||
TempRect.top = TempRect2.top;
|
TempRect.top = TempRect2.top;
|
||||||
TempRect.bottom = TempRect2.bottom;
|
TempRect.bottom = TempRect2.bottom;
|
||||||
if(Parent)
|
if (Parent)
|
||||||
GetClientRect(Parent, &ParentRect);
|
GetClientRect(Parent, &ParentRect);
|
||||||
if (PtInRect(&TempRect, Point) && HASSIZEGRIP(wi.dwStyle, wi.dwExStyle,
|
if (PtInRect(&TempRect, Point) && HASSIZEGRIP(wi.dwStyle, wi.dwExStyle,
|
||||||
GetWindowLongW(Parent, GWL_STYLE), wi.rcWindow, ParentRect))
|
GetWindowLongW(Parent, GWL_STYLE), wi.rcWindow, ParentRect))
|
||||||
|
@ -996,7 +997,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
|
TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
|
||||||
if (PtInRect(&TempRect, Point))
|
if (PtInRect(&TempRect, Point))
|
||||||
return HTVSCROLL;
|
return HTVSCROLL;
|
||||||
}
|
}
|
||||||
else if (wi.dwStyle & WS_HSCROLL)
|
else if (wi.dwStyle & WS_HSCROLL)
|
||||||
{
|
{
|
||||||
RECT TempRect = WindowRect;
|
RECT TempRect = WindowRect;
|
||||||
|
@ -1010,7 +1011,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
|
||||||
return HTNOWHERE;
|
return HTNOWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
|
ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
|
||||||
{
|
{
|
||||||
switch(Msg)
|
switch(Msg)
|
||||||
|
@ -1063,8 +1064,8 @@ ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndPr
|
||||||
}
|
}
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
{
|
{
|
||||||
if((wParam & 0xfff0) == SC_VSCROLL ||
|
if ((wParam & 0xfff0) == SC_VSCROLL ||
|
||||||
(wParam & 0xfff0) == SC_HSCROLL)
|
(wParam & 0xfff0) == SC_HSCROLL)
|
||||||
{
|
{
|
||||||
POINT Pt;
|
POINT Pt;
|
||||||
Pt.x = (short)LOWORD(lParam);
|
Pt.x = (short)LOWORD(lParam);
|
||||||
|
@ -1132,7 +1133,6 @@ DrawWindowForNCPreview(
|
||||||
OffsetRect(&rcWindowNew, offsetX, offsetY);
|
OffsetRect(&rcWindowNew, offsetX, offsetY);
|
||||||
ThemeCalculateCaptionButtonsPosEx(&pcontext->wi, pcontext->hWnd, pcontext->theme, pcontext->CaptionHeight - pcontext->wi.cyWindowBorders);
|
ThemeCalculateCaptionButtonsPosEx(&pcontext->wi, pcontext->hWnd, pcontext->theme, pcontext->CaptionHeight - pcontext->wi.cyWindowBorders);
|
||||||
|
|
||||||
|
|
||||||
INT leftBorderInset = pcontext->wi.cxWindowBorders;
|
INT leftBorderInset = pcontext->wi.cxWindowBorders;
|
||||||
INT titleBarInset = pcontext->CaptionHeight; // + pcontext->wi.cyWindowBorders;
|
INT titleBarInset = pcontext->CaptionHeight; // + pcontext->wi.cyWindowBorders;
|
||||||
INT rightBorderInset = pcontext->wi.cxWindowBorders;
|
INT rightBorderInset = pcontext->wi.cxWindowBorders;
|
||||||
|
@ -1171,7 +1171,7 @@ DrawWindowForNCPreview(
|
||||||
pcontext->wi.rcClient = rcClientNew;
|
pcontext->wi.rcClient = rcClientNew;
|
||||||
|
|
||||||
OffsetRect(&rcClientNew, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top);
|
OffsetRect(&rcClientNew, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top);
|
||||||
|
|
||||||
if (drawClientAreaColor)
|
if (drawClientAreaColor)
|
||||||
{
|
{
|
||||||
HBRUSH hbrWindow = GetThemeSysColorBrush(pcontext->theme, COLOR_WINDOW);
|
HBRUSH hbrWindow = GetThemeSysColorBrush(pcontext->theme, COLOR_WINDOW);
|
||||||
|
@ -1193,10 +1193,10 @@ DrawWindowForNCPreview(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DrawNCPreview(HDC hDC,
|
HRESULT WINAPI DrawNCPreview(HDC hDC,
|
||||||
DWORD DNCP_Flag,
|
DWORD DNCP_Flag,
|
||||||
LPRECT prcPreview,
|
LPRECT prcPreview,
|
||||||
LPCWSTR pszThemeFileName,
|
LPCWSTR pszThemeFileName,
|
||||||
LPCWSTR pszColorName,
|
LPCWSTR pszColorName,
|
||||||
LPCWSTR pszSizeName,
|
LPCWSTR pszSizeName,
|
||||||
PNONCLIENTMETRICSW pncMetrics,
|
PNONCLIENTMETRICSW pncMetrics,
|
||||||
|
@ -1265,7 +1265,6 @@ HRESULT WINAPI DrawNCPreview(HDC hDC,
|
||||||
if (textFont)
|
if (textFont)
|
||||||
SelectFont(hDC, textFont);
|
SelectFont(hDC, textFont);
|
||||||
|
|
||||||
|
|
||||||
SetTextColor(hDC, GetThemeSysColor(context.theme, TMT_WINDOWTEXT));
|
SetTextColor(hDC, GetThemeSysColor(context.theme, TMT_WINDOWTEXT));
|
||||||
DrawThemeText(context.theme, hDC, WP_DIALOG, 0, L"Window Text", -1, DT_LEFT | DT_TOP | textDrawFlags, 0, &rcWindowClient);
|
DrawThemeText(context.theme, hDC, WP_DIALOG, 0, L"Window Text", -1, DT_LEFT | DT_TOP | textDrawFlags, 0, &rcWindowClient);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue