[UXTHEME] nonclient.c: Formatting only

This commit is contained in:
Stanislav Motylkov 2024-02-15 14:22:02 +03:00
parent 118869f69c
commit fa29a61271

View file

@ -35,7 +35,8 @@ BOOL
IsScrollBarVisible(HWND hWnd, INT hBar)
{
SCROLLBARINFO sbi = {sizeof(SCROLLBARINFO)};
if(!GetScrollBarInfo(hWnd, hBar, &sbi))
if (!GetScrollBarInfo(hWnd, hBar, &sbi))
return FALSE;
return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
@ -115,10 +116,10 @@ HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT* pRect, int iPa
InternalGetWindowText(pcontext->hWnd, pszText, len);
hr = GetThemeSysFont(pcontext->theme, TMT_CAPTIONFONT, &logfont);
if(SUCCEEDED(hr))
if (SUCCEEDED(hr))
hFont = CreateFontIndirectW(&logfont);
if(hFont)
if (hFont)
oldFont = SelectObject(pcontext->hDC, hFont);
textColor = GetThemeSysColor(pcontext->theme, pcontext->Active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT);
@ -168,7 +169,7 @@ ThemeInitDrawContext(PDRAW_CONTEXT pcontext,
pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
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);
}
@ -182,7 +183,7 @@ ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
{
ReleaseDC(pcontext->hWnd ,pcontext->hDC);
if(pcontext->hRgn != NULL)
if (pcontext->hRgn != NULL)
{
DeleteObject(pcontext->hRgn);
}
@ -221,7 +222,7 @@ static void ThemeCalculateCaptionButtonsPosEx(WINDOWINFO* wi, HWND hWnd, HTHEME
/* First of all check if we have something to do here */
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;
/* Get theme data for this window */
@ -270,7 +271,8 @@ void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme)
{
INT btnHeight;
WINDOWINFO wi = {sizeof(wi)};
if(!GetWindowInfo(hWnd, &wi))
if (!GetWindowInfo(hWnd, &wi))
return;
btnHeight = GetSystemMetrics(wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMSIZE : SM_CYSIZE);
@ -566,10 +568,10 @@ static void ThemeDrawScrollBarsGrip(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
static void
ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBuffering)
{
if(!(pcontext->wi.dwStyle & WS_VISIBLE))
if (!(pcontext->wi.dwStyle & WS_VISIBLE))
return;
if((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION)
if ((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION)
{
if (bDoDoubleBuffering)
ThemeStartBufferedPaint(pcontext, prcCurrent->right, pcontext->CaptionHeight);
@ -583,24 +585,24 @@ ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBufferi
DrawClassicFrame(pcontext, prcCurrent);
}
if(pcontext->wi.dwStyle & WS_MINIMIZE)
if (pcontext->wi.dwStyle & WS_MINIMIZE)
return;
if(HAS_MENU(pcontext->hWnd, pcontext->wi.dwStyle))
if (HAS_MENU(pcontext->hWnd, pcontext->wi.dwStyle))
ThemeDrawMenuBar(pcontext, prcCurrent);
if (pcontext->wi.dwExStyle & WS_EX_CLIENTEDGE)
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);
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);
if((pcontext->wi.dwStyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL) &&
IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL) &&
IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
if ((pcontext->wi.dwStyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL) &&
IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL) &&
IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
{
ThemeDrawScrollBarsGrip(pcontext, prcCurrent);
}
@ -637,7 +639,7 @@ ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT* pt)
/* First of all check if we have something to do here */
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;
/* Get theme data for this window */
@ -691,7 +693,7 @@ ThemeHandleNcMouseLeave(HWND hWnd)
/* First of all check if we have something to do here */
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;
/* Get theme data for this window */
@ -794,7 +796,6 @@ ThemeHandleButton(HWND hWnd, WPARAM wParam)
SendMessageW(hWnd, WM_SYSCOMMAND, SCMsg, 0);
}
static LRESULT
DefWndNCHitTest(HWND hWnd, POINT Point)
{
@ -825,9 +826,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
ThickFrame = (wi.dwStyle & WS_THICKFRAME);
if (Point.y < WindowRect.top)
{
if(wi.dwStyle & WS_MINIMIZE)
if (wi.dwStyle & WS_MINIMIZE)
return HTCAPTION;
if(!ThickFrame)
if (!ThickFrame)
return HTBORDER;
if (Point.x < (WindowRect.left + XSize))
return HTTOPLEFT;
@ -837,9 +838,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
}
if (Point.y >= WindowRect.bottom)
{
if(wi.dwStyle & WS_MINIMIZE)
if (wi.dwStyle & WS_MINIMIZE)
return HTCAPTION;
if(!ThickFrame)
if (!ThickFrame)
return HTBORDER;
if (Point.x < (WindowRect.left + XSize))
return HTBOTTOMLEFT;
@ -849,9 +850,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
}
if (Point.x < WindowRect.left)
{
if(wi.dwStyle & WS_MINIMIZE)
if (wi.dwStyle & WS_MINIMIZE)
return HTCAPTION;
if(!ThickFrame)
if (!ThickFrame)
return HTBORDER;
if (Point.y < (WindowRect.top + YSize))
return HTTOPLEFT;
@ -861,9 +862,9 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
}
if (Point.x >= WindowRect.right)
{
if(wi.dwStyle & WS_MINIMIZE)
if (wi.dwStyle & WS_MINIMIZE)
return HTCAPTION;
if(!ThickFrame)
if (!ThickFrame)
return HTBORDER;
if (Point.y < (WindowRect.top + YSize))
return HTTOPRIGHT;
@ -897,7 +898,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
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
// an icon for the system window, and if so, do the
// rect.left increase.
@ -924,7 +925,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
}
}
if(!(wi.dwStyle & WS_MINIMIZE))
if (!(wi.dwStyle & WS_MINIMIZE))
{
HMENU menu;
@ -973,7 +974,7 @@ DefWndNCHitTest(HWND hWnd, POINT Point)
TempRect.top = TempRect2.top;
TempRect.bottom = TempRect2.bottom;
if(Parent)
if (Parent)
GetClientRect(Parent, &ParentRect);
if (PtInRect(&TempRect, Point) && HASSIZEGRIP(wi.dwStyle, wi.dwExStyle,
GetWindowLongW(Parent, GWL_STYLE), wi.rcWindow, ParentRect))
@ -1063,8 +1064,8 @@ ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndPr
}
case WM_SYSCOMMAND:
{
if((wParam & 0xfff0) == SC_VSCROLL ||
(wParam & 0xfff0) == SC_HSCROLL)
if ((wParam & 0xfff0) == SC_VSCROLL ||
(wParam & 0xfff0) == SC_HSCROLL)
{
POINT Pt;
Pt.x = (short)LOWORD(lParam);
@ -1132,7 +1133,6 @@ DrawWindowForNCPreview(
OffsetRect(&rcWindowNew, offsetX, offsetY);
ThemeCalculateCaptionButtonsPosEx(&pcontext->wi, pcontext->hWnd, pcontext->theme, pcontext->CaptionHeight - pcontext->wi.cyWindowBorders);
INT leftBorderInset = pcontext->wi.cxWindowBorders;
INT titleBarInset = pcontext->CaptionHeight; // + pcontext->wi.cyWindowBorders;
INT rightBorderInset = pcontext->wi.cxWindowBorders;
@ -1265,7 +1265,6 @@ HRESULT WINAPI DrawNCPreview(HDC hDC,
if (textFont)
SelectFont(hDC, textFont);
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);