2002-06-13 20:36:40 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2002-09-01 20:39:56 +00:00
|
|
|
/* $Id: rect.c,v 1.6 2002/09/01 20:39:55 dwelch Exp $
|
2002-06-13 20:36:40 +00:00
|
|
|
*
|
|
|
|
* PROJECT: ReactOS user32.dll
|
|
|
|
* FILE: lib/user32/windows/input.c
|
|
|
|
* PURPOSE: Input
|
|
|
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 09-05-2001 CSH Created
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <user32.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2002-09-01 20:39:56 +00:00
|
|
|
WINBOOL STDCALL
|
|
|
|
CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
*lprcDst = *lprcSrc;
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
2002-06-13 20:36:40 +00:00
|
|
|
WINBOOL
|
|
|
|
STDCALL
|
|
|
|
EqualRect(
|
|
|
|
CONST RECT *lprc1,
|
|
|
|
CONST RECT *lprc2)
|
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
UNIMPLEMENTED;
|
2002-06-13 20:36:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
InflateRect(LPRECT rect, int dx, int dy)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
rect->left -= dx;
|
|
|
|
rect->top -= dy;
|
|
|
|
rect->right -= dx;
|
|
|
|
rect->bottom -= dy;
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WINBOOL
|
|
|
|
STDCALL
|
|
|
|
IntersectRect(
|
|
|
|
LPRECT lprcDst,
|
|
|
|
CONST RECT *lprcSrc1,
|
|
|
|
CONST RECT *lprcSrc2)
|
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
UNIMPLEMENTED;
|
2002-06-13 20:36:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
IsRectEmpty(CONST RECT *lprc)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
return((lprc->left >= lprc->right) || (lprc->top >= lprc->bottom));
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
OffsetRect(LPRECT rect, int dx, int dy)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
rect->left += dx;
|
|
|
|
rect->top += dy;
|
|
|
|
rect->right += dx;
|
|
|
|
rect->bottom += dy;
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
PtInRect(CONST RECT *lprc, POINT pt)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
return((pt.x >= lprc->left) && (pt.x < lprc->right) &&
|
|
|
|
(pt.y >= lprc->top) && (pt.y < lprc->bottom));
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
lprc->left = xLeft;
|
|
|
|
lprc->top = yTop;
|
|
|
|
lprc->right = xRight;
|
|
|
|
lprc->bottom = yBottom;
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
|
|
|
|
2002-09-01 20:39:56 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
SetRectEmpty(LPRECT lprc)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
SubtractRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
UNIMPLEMENTED;
|
2002-06-13 20:36:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-09-01 20:39:56 +00:00
|
|
|
|
|
|
|
WINBOOL STDCALL
|
|
|
|
UnionRect(LPRECT lprcDst, CONST RECT *lprcSrc1, CONST RECT *lprcSrc2)
|
2002-06-13 20:36:40 +00:00
|
|
|
{
|
2002-09-01 20:39:56 +00:00
|
|
|
if (IsRectEmpty(lprcSrc1))
|
|
|
|
{
|
|
|
|
if (IsRectEmpty(lprcSrc2))
|
|
|
|
{
|
|
|
|
SetRectEmpty(lprcDst);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*lprcDst = *lprcSrc2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (IsRectEmpty(lprcSrc2))
|
|
|
|
{
|
|
|
|
*lprcDst = *lprcSrc1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lprcDst->left = min(lprcSrc1->left, lprcSrc2->left);
|
|
|
|
lprcDst->top = min(lprcSrc1->top, lprcSrc2->top);
|
|
|
|
lprcDst->right = max(lprcSrc1->right, lprcSrc2->right);
|
|
|
|
lprcDst->bottom = max(lprcSrc1->bottom, lprcSrc2->bottom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(TRUE);
|
2002-06-13 20:36:40 +00:00
|
|
|
}
|