* Copyright (C) 2003 ReactOS Team
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* INCLUDES *******************************************************************/
IntDrawScrollBar(HWND hWnd, HDC hDC, INT nBar);
DWORD
IntScrollHitTest(HWND hWnd, INT nBar, POINT pt, BOOL bDragging);
-HPEN STDCALL
-GetSysColorPen(int nIndex);
-BOOL STDCALL GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
+BOOL WINAPI GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
extern ATOM AtomInternalPos;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon)
- hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
+ hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
if (!hIcon)
- hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
+ hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICON);
return hIcon;
}
WindowRect.right -= WindowRect.left;
WindowRect.bottom -= WindowRect.top;
WindowRect.left = WindowRect.top = 0;
- Style = GetWindowLongW(hWnd, GWL_STYLE);
- ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
+ Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
+ ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
UserGetWindowBorders(Style, ExStyle, &WindowBorder, FALSE);
InflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
UserDrawCaptionButton(&WindowRect, Style, ExStyle, hDC, bDown, Type);
}
+// Note from Wine:
+/* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
+ the call to GetDCEx implying that it is allowed not to use it either.
+ However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
+ will cause clipRgn to be deleted after ReleaseDC().
+ Now, how is the "system" supposed to tell what happened?
+ */
/*
* FIXME:
* - Drawing of WS_BORDER after scrollbars
if (!IsWindowVisible(hWnd))
return 0;
- Style = GetWindowLongW(hWnd, GWL_STYLE);
+ Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
- hDC = GetDCEx(hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | 0x10000);
+ hDC = GetDCEx(hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_USESTYLE | DCX_KEEPCLIPRGN);
if (hDC == 0)
{
return 0;
}
Parent = GetParent(hWnd);
- ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
+ ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
if (Active == -1)
{
if (ExStyle & WS_EX_MDICHILD)
if(!(Style & WS_MINIMIZE))
{
/* Line under caption */
- PreviousPen = SelectObject(hDC, GetSysColorPen(
+ PreviousPen = SelectObject(hDC, GetStockObject(DC_PEN));
+ SetDCPenColor(hDC, GetSysColor(
((ExStyle & (WS_EX_STATICEDGE | WS_EX_CLIENTEDGE |
WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ?
COLOR_WINDOWFRAME : COLOR_3DFACE));
/* FIXME: Correct drawing of size-box with WS_EX_LEFTSCROLLBAR */
if(Parent)
GetClientRect(Parent, &ParentClientRect);
- if (HASSIZEGRIP(Style, ExStyle, GetWindowLongW(Parent, GWL_STYLE), WindowRect, ParentClientRect))
+ if (HASSIZEGRIP(Style, ExStyle, GetWindowLongPtrW(Parent, GWL_STYLE), WindowRect, ParentClientRect))
{
DrawFrameControl(hDC, &TempRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
}
}
ReleaseDC(hWnd, hDC);
+ DeleteObject(hRgn); // We use DCX_KEEPCLIPRGN
return 0;
}
DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
{
LRESULT Result = 0;
- DWORD Style = GetClassLongW(hWnd, GCL_STYLE);
+ DWORD Style = GetClassLongPtrW(hWnd, GCL_STYLE);
DWORD ExStyle;
SIZE WindowBorders;
- RECT OrigRect = *Rect;
+ RECT OrigRect;
+
+ if (Rect == NULL)
+ {
+ return Result;
+ }
+ OrigRect = *Rect;
if (CalcSizeStruct)
{
Result |= WVR_VALIDRECTS;
}
- Style = GetWindowLongW(hWnd, GWL_STYLE);
- ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
+ Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
+ ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
if (!(Style & WS_MINIMIZE))
{
RECT WindowRect, ClientRect, OrigWndRect;
POINT ClientPoint;
SIZE WindowBorders;
- ULONG Style = GetWindowLongW(hWnd, GWL_STYLE);
- ULONG ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
+ ULONG Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
+ ULONG ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
GetWindowRect(hWnd, &WindowRect);
if (!PtInRect(&WindowRect, Point))
if(Parent)
GetClientRect(Parent, &ParentRect);
if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
- GetWindowLongW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
+ GetWindowLongPtrW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
{
if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
return HTBOTTOMLEFT;
WPARAM SCMsg;
ULONG ButtonType, Style;
- Style = GetWindowLongW(hWnd, GWL_STYLE);
+ Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
switch (wParam)
{
case HTCLOSE:
}
case HTSYSMENU:
{
- if (GetWindowLongW(hWnd, GWL_STYLE) & WS_SYSMENU)
+ if (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_SYSMENU)
{
SendMessageW(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
lParam);
{
ULONG Style;
- Style = GetWindowLongW(hWnd, GWL_STYLE);
+ Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
switch(wParam)
{
case HTCAPTION:
/* PUBLIC FUNCTIONS ***********************************************************/
-/*
- * @implemented
- */
-BOOL STDCALL
-AdjustWindowRectEx(LPRECT lpRect,
- DWORD dwStyle,
- BOOL bMenu,
- DWORD dwExStyle)
+BOOL WINAPI
+RealAdjustWindowRectEx(LPRECT lpRect,
+ DWORD dwStyle,
+ BOOL bMenu,
+ DWORD dwExStyle)
{
SIZE BorderSize;
return TRUE;
}
+/*
+ * @implemented
+ */
+BOOL WINAPI
+AdjustWindowRectEx(LPRECT lpRect,
+ DWORD dwStyle,
+ BOOL bMenu,
+ DWORD dwExStyle)
+{
+ BOOL Hook, Ret = FALSE;
+
+ LOADUSERAPIHOOK
+
+ Hook = BeginIfHookedUserApiHook();
+
+ /* Bypass SEH and go direct. */
+ if (!Hook) return RealAdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+
+ _SEH2_TRY
+ {
+ Ret = guah.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ _SEH2_END;
+
+ EndUserApiHook();
+
+ return Ret;
+}
+
/*
* @implemented
*/
-BOOL STDCALL
+BOOL WINAPI
AdjustWindowRect(LPRECT lpRect,
DWORD dwStyle,
BOOL bMenu)
BOOL WINAPI
DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
{
- return NtUserDrawCaption(hWnd, hDC, lprc, uFlags);
+ BOOL Hook, Ret = FALSE;
+
+ LOADUSERAPIHOOK
+
+ Hook = BeginIfHookedUserApiHook();
+
+ /* Bypass SEH and go direct. */
+ if (!Hook) return NtUserDrawCaption(hWnd, hDC, lprc, uFlags);
+
+ _SEH2_TRY
+ {
+ Ret = guah.DrawCaption(hWnd, hDC, lprc, uFlags);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ _SEH2_END;
+
+ EndUserApiHook();
+
+ return Ret;
}
/*
* @implemented
*/
BOOL
-STDCALL
+WINAPI
DrawCaptionTempW(
HWND hWnd,
HDC hDC,
* @implemented
*/
BOOL
-STDCALL
+WINAPI
DrawCaptionTempA(
HWND hwnd,
HDC hdc,
Rect->bottom = Rect->bottom - Rect->top;
Rect->top = 0;
- Style = GetWindowLongW(Wnd, GWL_STYLE);
+ Style = GetWindowLongPtrW(Wnd, GWL_STYLE);
if (0 != (Style & WS_ICONIC))
{
return;
}
/* Remove frame from rectangle */
- ExStyle = GetWindowLongW(Wnd, GWL_EXSTYLE);
+ ExStyle = GetWindowLongPtrW(Wnd, GWL_EXSTYLE);
if (HAS_THICKFRAME(Style, ExStyle))
{
InflateRect(Rect, - GetSystemMetrics(SM_CXFRAME), - GetSystemMetrics(SM_CYFRAME));
NcGetInsideRect(Wnd, Rect);
GetWindowRect(Wnd, &WindowRect);
OffsetRect(Rect, WindowRect.left, WindowRect.top);
- if (0 != (GetWindowLongW(Wnd, GWL_STYLE) & WS_CHILD))
+ if (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE) & WS_CHILD))
{
ClientToScreen(GetParent(Wnd), (POINT *) Rect);
}