本文整理匯總了C++中EqualRect函數的典型用法代碼示例。如果您正苦於以下問題:C++ EqualRect函數的具體用法?C++ EqualRect怎麽用?C++ EqualRect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EqualRect函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: test_redraw
/*
* Tests if a progress bar repaints itself immediately when it receives
* some specific messages.
*/
static void test_redraw(void)
{
RECT client_rect;
LRESULT ret;
SendMessageA(hProgressWnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
SendMessageA(hProgressWnd, PBM_SETSTEP, 20, 0);
update_window(hProgressWnd);
/* PBM_SETPOS */
ok(SendMessageA(hProgressWnd, PBM_SETPOS, 50, 0) == 10, "PBM_SETPOS must return the previous position\n");
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
/* PBM_DELTAPOS */
ok(SendMessageA(hProgressWnd, PBM_DELTAPOS, 15, 0) == 50, "PBM_DELTAPOS must return the previous position\n");
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_DELTAPOS: The progress bar should be redrawn immediately\n");
/* PBM_SETPOS */
ok(SendMessageA(hProgressWnd, PBM_SETPOS, 80, 0) == 65, "PBM_SETPOS must return the previous position\n");
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
/* PBM_STEPIT */
ok(SendMessageA(hProgressWnd, PBM_STEPIT, 0, 0) == 80, "PBM_STEPIT must return the previous position\n");
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_STEPIT: The progress bar should be redrawn immediately\n");
ret = SendMessageA(hProgressWnd, PBM_GETPOS, 0, 0);
if (ret == 0)
win_skip("PBM_GETPOS needs comctl32 > 4.70\n");
else
ok(ret == 100, "PBM_GETPOS returned a wrong position : %d\n", (UINT)ret);
/* PBM_SETRANGE and PBM_SETRANGE32:
Usually the progress bar doesn't repaint itself immediately. If the
position is not in the new range, it does.
Don't test this, it may change in future Windows versions. */
SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
update_window(hProgressWnd);
/* increase to 10 - no background erase required */
erased = FALSE;
SetRectEmpty(&last_paint_rect);
SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
GetClientRect(hProgressWnd, &client_rect);
ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));
update_window(hProgressWnd);
ok(!erased, "Progress bar shouldn't have erased the background\n");
/* decrease to 0 - background erase will be required */
erased = FALSE;
SetRectEmpty(&last_paint_rect);
SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
GetClientRect(hProgressWnd, &client_rect);
ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));
update_window(hProgressWnd);
ok(erased, "Progress bar should have erased the background\n");
}
示例2: verify_region
static void verify_region(HRGN hrgn, const RECT *rc)
{
union
{
RGNDATA data;
char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)];
} rgn;
const RECT *rect;
DWORD ret;
ret = GetRegionData(hrgn, 0, NULL);
if (IsRectEmpty(rc))
ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
else
ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
if (!ret) return;
ret = GetRegionData(hrgn, sizeof(rgn), &rgn.data);
if (IsRectEmpty(rc))
ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
else
ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
rgn.data.rdh.dwSize, rgn.data.rdh.iType,
rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
if (rgn.data.rdh.nCount != 0)
{
rect = (const RECT *)rgn.data.Buffer;
trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
ok(EqualRect(rect, rc), "rects don't match\n");
}
ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
ok(rgn.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn.data.rdh.iType);
if (IsRectEmpty(rc))
{
ok(rgn.data.rdh.nCount == 0, "expected 0, got %u\n", rgn.data.rdh.nCount);
ok(rgn.data.rdh.nRgnSize == 0 ||
broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
"expected 0, got %u\n", rgn.data.rdh.nRgnSize);
}
else
{
ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
ok(rgn.data.rdh.nRgnSize == sizeof(RECT) ||
broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
"expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
}
ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
}
示例3: SetScnRect
STDMETHODIMP CGfxFB::SetScnRect(const RECT *pRect)
{
RECT rZero = {0,0,0,0};
if(pRect==0)
{
m_bScnClip = FALSE;
return S_OK;
}
if((EqualRect(pRect,&rZero))||(EqualRect(pRect,&m_rectScn) && m_bScnClip))
return S_OK;
m_rectScn = *pRect;
m_bScnClip = TRUE;
DP("[GFXFB]SetScnRect (%d,%d,%d,%d) \n", m_rectScn.left, m_rectScn.top, m_rectScn.right, m_rectScn.bottom);
return Update();
}
示例4: PollTimer
void CALLBACK
PollTimer(HWND hwnd, UINT uMsg, UINT_PTR idTimer, DWORD dwTime)
{
HDC hdc = GetDC(hwnd);
if (hdc) {
RECT rcClip, rcClient;
LPCTSTR pszMsg;
switch (GetClipBox(hdc, &rcClip)) {
case NULLREGION:
pszMsg = TEXT("completely covered");
break;
case SIMPLEREGION:
GetClientRect(hwnd, &rcClient);
if (EqualRect(&rcClient, &rcClip)) {
pszMsg = TEXT("completely uncovered");
} else {
pszMsg = TEXT("partially covered");
}
break;
case COMPLEXREGION:
pszMsg = TEXT("partially covered");
break;
default:
pszMsg = TEXT("Error");
break;
}
// If we want to, we can also use RectVisible
// or PtVisible - or go totally overboard by
// using GetClipRgn
ReleaseDC(hwnd, hdc);
SetWindowText(hwnd, pszMsg);
}
}
示例5: SubtractRect
BOOL WINAPI
SubtractRect( LPRECT dest, const RECT *src1, const RECT *src2 )
{
RECT tmp;
if (IsRectEmpty( src1 ))
{
SetRectEmpty( dest );
return FALSE;
}
*dest = *src1;
if (IntersectRect( &tmp, src1, src2 ))
{
if (EqualRect( &tmp, dest ))
{
SetRectEmpty( dest );
return FALSE;
}
if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
{
if (tmp.left == dest->left) dest->left = tmp.right;
else if (tmp.right == dest->right) dest->right = tmp.left;
}
else if ((tmp.left == dest->left) && (tmp.right == dest->right))
{
if (tmp.top == dest->top) dest->top = tmp.bottom;
else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top;
}
}
return TRUE;
}
示例6: OnDragOver
void CEdit::OnDragOver( LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect )
{
CEditView *pView;
int nBuffCol, nRow;
*pdwEffect = GetDropEffect( pIDataSource, grfKeyState, pt, pView, nBuffCol, nRow );
if ( *pdwEffect != DROPEFFECT_NONE )
{
RECT rcDragCaret;
m_Selection.GetCaretRect( pView, nBuffCol, nRow, rcDragCaret );
if ( !EqualRect( &rcDragCaret, &m_rcDragCaret ) )
{
// erase old caret
DrawDragCaret( FALSE );
m_rcDragCaret = rcDragCaret;
// draw new caret
DrawDragCaret( FALSE );
}
}
else
{
// erase old caret
DrawDragCaret( TRUE );
}
}
示例7: GetForegroundWindow
bool FSWinWatcher::IsCurrentFS ()
{
#if !__GNUC__
// Not defined in my MinGW headers even on Vista
// Maybe it will work later with MinGW
QUERY_USER_NOTIFICATION_STATE state;
if (SHQueryUserNotificationState (&state) != S_OK)
return false;
return state != QUNS_ACCEPTS_NOTIFICATIONS;
#else
HWND hWnd = GetForegroundWindow ();
if (!hWnd)
return false;
HMONITOR monitor = MonitorFromWindow (hWnd, MONITOR_DEFAULTTONULL);
if (!monitor)
return false;
MONITORINFO lpmi;
lpmi.cbSize = sizeof (lpmi);
if (!GetMonitorInfo (monitor, &lpmi))
return false;
RECT monitorRect = lpmi.rcMonitor;
RECT windowRect;
GetWindowRect (hWnd, &windowRect);
return EqualRect (&windowRect, &monitorRect) &&
Proxy_->GetRootWindowsManager ()->GetPreferredWindow ()->effectiveWinId () != hWnd;
#endif
}
示例8: warp_check
static void warp_check( SysMouseImpl* This, BOOL force )
{
DWORD now = GetCurrentTime();
const DWORD interval = This->clipped ? 500 : 10;
if (force || (This->need_warp && (now - This->last_warped > interval)))
{
RECT rect, new_rect;
POINT mapped_center;
This->last_warped = now;
This->need_warp = FALSE;
if (!GetClientRect(This->base.win, &rect)) return;
MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 );
if (!This->clipped)
{
mapped_center.x = (rect.left + rect.right) / 2;
mapped_center.y = (rect.top + rect.bottom) / 2;
TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y);
SetCursorPos( mapped_center.x, mapped_center.y );
}
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
{
/* make sure we clip even if the window covers the whole screen */
rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 );
rect.top = max( rect.top, GetSystemMetrics( SM_YVIRTUALSCREEN ) + 1 );
rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 );
rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 );
TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect ));
ClipCursor( &rect );
This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect );
}
}
}
示例9: OWndLPtoDP
void Protocol::Move
(
OpWndItemD* wi,
LPRECT lprc
)
{
// make sure the borders are on pixel boundaries
OWndLPtoDP(m_oiWnd, (LPPOINT)lprc, 2);
OWndDPtoLP(m_oiWnd, (LPPOINT)lprc, 2);
if(m_fFrames)
{
RECT rcOld;
CopyRect(&rcOld, &wi->m_rcItem);
InvalidateGrabHandles(wi, TRUE);
wi->Move(lprc);
InvalidateGrabHandles(wi, FALSE);
if(OWndIsHwndItem(wi) && !EqualRect(&rcOld, &wi->m_rcItem))
{
OWndInvalidateLogicalRect(m_oiWnd, &rcOld, TRUE);
OWndInvalidateLogicalRect(m_oiWnd, &wi->m_rcItem, TRUE);
}
}
else
{
wi->InvalidateGrabHandles(TRUE);
wi->Move(lprc);
wi->InvalidateGrabHandles(FALSE);
}
}
示例10: SetSrcRect
STDMETHODIMP CGfxRMI::SetSrcRect(const RECT *pRect)
{
if(EqualRect(pRect,&m_rectSrc))
return S_OK;
m_rectSrc = *pRect;
return Update();
}
示例11: SetSrcRect
STDMETHODIMP CGfxRenesasHW::SetSrcRect(const RECT *pRect)
{
if(EqualRect(pRect,&m_rectSrc))
return S_OK;
m_rectSrc = *pRect;
return S_OK;
}
示例12: SetSrcRect
STDMETHODIMP CGfxFB::SetSrcRect(const RECT *pRect)
{
if(EqualRect(pRect,&m_rectSrc))
return S_OK;
m_rectSrc = *pRect;
DP("[GFXFB]Set SourceRect (%d,%d, %d, %d) \n", m_rectSrc.left, m_rectSrc.top, m_rectSrc.right, m_rectSrc.bottom);
return Update();
}
示例13: EqualRect
bool operator == ( const wxBrushRefData& brush ) const
{
return m_style == brush.m_style &&
m_stipple.IsSameAs(brush.m_stipple) &&
m_colour == brush.m_colour &&
m_macBrushKind == brush.m_macBrushKind &&
m_macThemeBrush == brush.m_macThemeBrush &&
m_macThemeBackground == brush.m_macThemeBackground &&
EqualRect(&m_macThemeBackgroundExtent, &brush.m_macThemeBackgroundExtent);
}
示例14: DrawInsert
/***********************************************************************
* DrawInsert (COMCTL32.15)
*
* Draws insert arrow by the side of the ListBox item in the parent window.
*
* RETURNS
* Nothing.
*/
VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
{
RECT rcItem, rcListBox, rcDragIcon;
HDC hdc;
DRAGLISTDATA * data;
TRACE("(%p %p %d)\n", hwndParent, hwndLB, nItem);
if (!hDragArrow)
hDragArrow = LoadIconW(COMCTL32_hModule, (LPCWSTR)IDI_DRAGARROW);
if (LB_ERR == SendMessageW(hwndLB, LB_GETITEMRECT, nItem, (LPARAM)&rcItem))
return;
if (!GetWindowRect(hwndLB, &rcListBox))
return;
/* convert item rect to parent co-ordinates */
if (!MapWindowPoints(hwndLB, hwndParent, (LPPOINT)&rcItem, 2))
return;
/* convert list box rect to parent co-ordinates */
if (!MapWindowPoints(HWND_DESKTOP, hwndParent, (LPPOINT)&rcListBox, 2))
return;
rcDragIcon.left = rcListBox.left - DRAGICON_HOTSPOT_X;
rcDragIcon.top = rcItem.top - DRAGICON_HOTSPOT_Y;
rcDragIcon.right = rcListBox.left;
rcDragIcon.bottom = rcDragIcon.top + DRAGICON_HEIGHT;
if (!GetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR*)&data))
return;
if (nItem < 0)
SetRectEmpty(&rcDragIcon);
/* prevent flicker by only redrawing when necessary */
if (!EqualRect(&rcDragIcon, &data->last_drag_icon_rect))
{
/* get rid of any previous inserts drawn */
RedrawWindow(hwndParent, &data->last_drag_icon_rect, NULL,
RDW_INTERNALPAINT | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
CopyRect(&data->last_drag_icon_rect, &rcDragIcon);
if (nItem >= 0)
{
hdc = GetDC(hwndParent);
DrawIcon(hdc, rcDragIcon.left, rcDragIcon.top, hDragArrow);
ReleaseDC(hwndParent, hdc);
}
}
}
示例15: setdisplaymode
static void setdisplaymode(int i)
{
HRESULT rc;
rc = IDirectDraw_SetCooperativeLevel(lpDD,
hwnd, DDSCL_ALLOWMODEX | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(rc==DD_OK,"SetCooperativeLevel returned: %x\n",rc);
if (modes[i].dwFlags & DDSD_PIXELFORMAT)
{
if (modes[i].ddpfPixelFormat.dwFlags & DDPF_RGB)
{
rc = IDirectDraw_SetDisplayMode(lpDD,
modes[i].dwWidth, modes[i].dwHeight,
U1(modes[i].ddpfPixelFormat).dwRGBBitCount);
ok(DD_OK==rc || DDERR_UNSUPPORTED==rc,"SetDisplayMode returned: %x\n",rc);
if (rc == DD_OK)
{
RECT r, scrn, virt;
SetRect(&virt, 0, 0, GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN));
OffsetRect(&virt, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN));
SetRect(&scrn, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
trace("Mode (%dx%d) [%dx%d] (%d %d)x(%d %d)\n", modes[i].dwWidth, modes[i].dwHeight,
scrn.right, scrn.bottom, virt.left, virt.top, virt.right, virt.bottom);
ok(GetClipCursor(&r), "GetClipCursor() failed\n");
/* ddraw sets clip rect here to the screen size, even for
multiple monitors */
ok(EqualRect(&r, &scrn), "Invalid clip rect: (%d %d) x (%d %d)\n",
r.left, r.top, r.right, r.bottom);
ok(ClipCursor(NULL), "ClipCursor() failed\n");
ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &virt), "Invalid clip rect: (%d %d) x (%d %d)\n",
r.left, r.top, r.right, r.bottom);
rc = IDirectDraw_RestoreDisplayMode(lpDD);
ok(DD_OK==rc,"RestoreDisplayMode returned: %x\n",rc);
}
}
}
}