当前位置: 首页>>代码示例>>C++>>正文


C++ ClipCursor函数代码示例

本文整理汇总了C++中ClipCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ ClipCursor函数的具体用法?C++ ClipCursor怎么用?C++ ClipCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ClipCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetWindowRect

void OverlayControl::MouseDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	if (!ActiveOverlay)
		return;

	//	Left or right button clicked -- select the element under cursor.
	RECT clipRect, clientRect;
	GetWindowRect(hwnd, &clipRect);
	GetClientRect(hwnd, &clientRect);

	//	Save original mouse position.
	GetCursorPosition(hwnd, &clickAnchor);

	//	Element could be activated only if no element active AND user doesn't click 
	//	within the active element.
	if (!ActiveOverlay->ActiveElement || 
		!ActiveOverlay->HitTestElement(ActiveOverlay->ActiveElement, &clientRect, &clickAnchor, &hitTestAnchor))
	{
		//	Find overlay element under cursor.
		OverlayElement *element = ActiveOverlay->FindElementFromPoint(&clientRect, &clickAnchor, &hitTestAnchor);
		ActivateElement(hwnd, element);
	}

	if (!ActiveOverlay->ActiveElement)
	{
		ResetCursor();
	}

	if (0 != (wParam & MK_LBUTTON))
	{
		if (ActiveOverlay->ActiveElement)
		{
			ActiveOverlay->ActiveElement->GetRect(&clientRect, &elementRectAnchor);

			//	Show that we're about to drag the object.
			UpdateCursor(hitTestAnchor);

			//	Capture the mouse.
			SetCapture(hwnd);
			ClipCursor(&clipRect);
		}

		return;
	}

	if (0 != (wParam & MK_RBUTTON))
	{
		//	Show popup menu.
		POINT pt;
		GetCursorPos(&pt);

		__raise RightMouseButtonClicked(ActiveOverlay->ActiveElement, &pt);

		return;
	}
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:56,代码来源:OverlayControl.cpp

示例2: rcTrack

void CRemoteWnd::TrackScaler()
{
	MSG* pMsg = &AfxGetThreadState()->m_msgCur;
	CRect rcTrack( &m_rcsScalerTrack );
	CPoint point;

	ClientToScreen( &rcTrack );
	ClipCursor( &rcTrack );
	ScreenToClient( &rcTrack );
	SetCapture();

	rcTrack.DeflateRect( m_rcScalerTab.Width() / 2, 0 );

	while ( GetAsyncKeyState( VK_LBUTTON ) & 0x8000 )
	{
		while ( ::PeekMessage( pMsg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ) );

		if ( ! AfxGetThread()->PumpMessage() )
		{
			AfxPostQuitMessage( 0 );
			break;
		}

		GetCursorPos( &point );
		ScreenToClient( &point );

		int nPosition = (int)( 105.0f * (float)( point.x - rcTrack.left ) / (float)rcTrack.Width() );
		if ( nPosition < 0 ) nPosition = 0;
		else if ( nPosition >= 102 ) nPosition = 101;
		else if ( nPosition >= 100 ) nPosition = 100;

		// ToDo: Settings.Live.BandwidthScaleOut
		if ( nPosition != (int)Settings.Live.BandwidthScaleIn )
		{
			Settings.Live.BandwidthScaleIn = (DWORD)nPosition;
			Invalidate();
		}
	}

	ReleaseCapture();
	ClipCursor( NULL );
	Invalidate();
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:43,代码来源:WndMonitor.cpp

示例3: GetWindowRect

void	Window::LockMouseToWindow(bool lock)	{
	lockMouse = lock;
	if(lock) {
		RECT		windowRect;
		GetWindowRect (window->windowHandle, &windowRect);

		SetCapture(window->windowHandle);
		ClipCursor(&windowRect);

		POINT pt;
		GetCursorPos(&pt);
		ScreenToClient(window->windowHandle, &pt);
		Window::GetMouse()->SetAbsolutePosition(pt.x,pt.y);
	}
	else{
		ReleaseCapture();
		ClipCursor(NULL);
	}
}
开发者ID:JohnEz,项目名称:Dissertation,代码行数:19,代码来源:Window.cpp

示例4: _ClipCursor

BOOL WINAPI _ClipCursor(const RECT *lpRect)
{
  if ( !wmode )
  {
    if ( _ClipCursorOld )
      return _ClipCursorOld(lpRect);
    return ClipCursor(lpRect);
  }
  return TRUE;
}
开发者ID:Maiven,项目名称:bwapi,代码行数:10,代码来源:WMode.cpp

示例5: ClipCursor

void OverlayControl::MouseUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	if (!ActiveOverlay)
		return;

	//	Release mouse.
	ClipCursor(0);
	ReleaseCapture();
	ResetCursor();
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:10,代码来源:OverlayControl.cpp

示例6: MouseSetRect

void MouseSetRect(int x1, int y1, int x2, int y2)
{
	#if 0
	TRect r;
	
	r.x1 = x1, r.y1 = y1, r.x2 = x2, r.y2 = y2;
	ClipCursor(&r); /// FIXME -- SDL cannot clip mouse cursor, do it ourselves!
SDL_WM_GrabInput(SDL_GRAB_ON);
	#endif
}
开发者ID:zarevucky,项目名称:signus,代码行数:10,代码来源:mouse.cpp

示例7: ClipCursor

// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTWnd::OnLButtonUp
//
//	PURPOSE:	This is the actual left button up handler
//
// ----------------------------------------------------------------------- //
BOOL CLTWnd::OnLButtonUp(int xPos, int yPos)
{
	// Stop any draggage
	//if(s_pWndDrag)
	g_mouseMgr.SetClipRect(NULL);
	ClipCursor(g_prcClip);
	//s_pWndDrag = NULL;
	s_pWndCapture = NULL;
	return(this != s_pMainWnd);
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:17,代码来源:LtWnd.cpp

示例8: GetWindowRect

void WindowsMouseController::grab()
{
    RECT clipRegion;
    GetWindowRect( mWindowHandle, &clipRegion );
    clipRegion.left += 10;
    clipRegion.right -= 10;
    clipRegion.top += 33;
    clipRegion.bottom -= 10;
    ClipCursor( &clipRegion );
}
开发者ID:Gohla,项目名称:Diversia,代码行数:10,代码来源:WindowsMouseController.cpp

示例9: GetClientRect

void Window::lockMouse()
{
	RECT clientRect;
	GetClientRect(m_hWnd,&clientRect);
	POINT p1 = {clientRect.left,clientRect.top};
	POINT p2 = {clientRect.right,clientRect.bottom};
	ClientToScreen(m_hWnd,&p1); ClientToScreen(m_hWnd,&p2);
	RECT bounds={p1.x,p1.y,p2.x,p2.y};
	ClipCursor(&bounds);
}
开发者ID:MattiasLiljeson,项目名称:Amalgamation,代码行数:10,代码来源:Window.cpp

示例10: mouse

/*
   Effect:        Handle any actions relating to the user pressing *down*
                  the left mouse button within the widget.

                  In particular, we need to prepare the widget for moving
                  || sizing. To do this, we remove any drag blobs already
                  present on the widget.

                  We also capture the mouse input, so we can track the
                  movement of the mouse. We will release the capture
                  when the user releases the mouse key.

                  Since the window class style of the widget might not
                  accept double clicks, we will need to compute double
                  clicks ourselves.

                  If someone else has control of the mouse (like the
                  session window || another widget), we won't be getting
                  this mouse message.

   See Also:      WidgetLButtonUp, WidgetLMouseMove.

   Called By:     WidgetWndProc, in response to WM_LBUTTONDOWN messages.
                  LayoutWndProc, in response to WM_LBUTTONDOWN messages
                  when the mouse is over a drag blob.
*/
void WidgetLButtonDown(HWND hWnd, int nDragMode, POINT ptScreen)
{
    RECT rcParentScreen;
    HWND hWndParent, hWndPrev;
    HDC hDC;

    CurrentWidgetInfo.ptPrev = ptScreen;

    hWndParent = GetParent(hWnd);
    CurrentWidgetInfo.nDragMode = nDragMode;
    hDC = GetDC(hWndParent);

    /* Erase the drag blobs from the current widget. The blobs will */
    /* be repainted in WidgetButtonUp after the user finishes dragging */
    /* || sizing. */

    GetWindowRect(hWnd, &CurrentWidgetInfo.rcPrevDots);
    GetWindowRect(hWnd, &CurrentWidgetInfo.rcPrev);

    hWndPrev = CurrentWidgetInfo.hWnd;
    CurrentWidgetInfo.bDotsDrawn = FALSE;

    CurrentWidgetInfo.bDotsDrawn = TRUE;

    if (hWnd != CurrentWidgetInfo.hWnd)
    {
        if (KpsSetCurrentWidget(hWnd))
        {
            if (IsWindow(hWndPrev))
            {
                if (KpsIsAWidget(hWndPrev))
                {
                    InvalidateRect(hWndPrev, NULL, TRUE);
                    UpdateWindow(hWndPrev);
                }
            }
        }
        InvalidateRect(hWnd, NULL, TRUE);
        UpdateWindow(hWnd);
    }

    if (!CurrentWidgetInfo.bCapture)
    {
        SetCapture(hWnd);
        GetClientRect(hWndParent, &rcParentScreen);
        KpsClientRectToScreen(hWndParent, &rcParentScreen);
        ClipCursor(&rcParentScreen);
        CurrentWidgetInfo.bCapture = TRUE;
    }

    ReleaseDC(hWndParent, hDC);

    /* Clear out the rectangle, indicating there is nothing to erase! */
    SetRectEmpty(&rcPrev);
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:81,代码来源:WGTWPROC.C

示例11: IN_DeactivateWin32Mouse

/*
================
IN_DeactivateWin32Mouse
================
*/
void IN_DeactivateWin32Mouse(void)
{
	// NERVE - SMF - dont do this in developer mode
	if(!com_developer->integer)
	{
		ClipCursor(NULL);
	}
	ReleaseCapture();
	while(ShowCursor(TRUE) < 0)
		;
}
开发者ID:ethr,项目名称:ETXrealPro,代码行数:16,代码来源:win_input.c

示例12: GetWindowRect

void PixelLightCtrl::SetTrapMouse(bool bTrap)
{
	if (m_hFrontendWnd) {
		// Trap mouse?
		if (bTrap) {
			// Get window rect (in screen coordinates)
			RECT sRect;
			GetWindowRect(&sRect);

			// Trap mouse
			ClipCursor(&sRect); 
		} else {
			// Untrap mouse
			ClipCursor(nullptr);
		}

		// Backup the state
		m_bTrapMouse = bTrap;
	}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:20,代码来源:PixelLightCtrl.cpp

示例13: Win_DeAcquireMouse

// Called when the window loses focus
static void Win_DeAcquireMouse( void ) {
    if( win.mouse.restoreparms )
        SystemParametersInfo( SPI_SETMOUSE, 0, win.mouse.originalparms, 0 );

    SetCursorPos( win.center_x, win.center_y );

    ClipCursor( NULL );
    ReleaseCapture();

    SetWindowText( win.wnd, PRODUCT );
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:12,代码来源:vid_win.c

示例14: WIN_UpdateClipCursor

void
WIN_UpdateClipCursor(SDL_Window *window)
{
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    SDL_Mouse *mouse = SDL_GetMouse();

    /* Don't clip the cursor while we're in the modal resize or move loop */
    if (data->in_title_click || data->in_modal_loop) {
        ClipCursor(NULL);
        return;
    }

    if ((mouse->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
        (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
        if (mouse->relative_mode && !mouse->relative_mode_warp) {
            LONG cx, cy;
            RECT rect;
            GetWindowRect(data->hwnd, &rect);

            cx = (rect.left + rect.right) / 2;
            cy = (rect.top + rect.bottom) / 2;

            /* Make an absurdly small clip rect */
            rect.left = cx - 1;
            rect.right = cx + 1;
            rect.top = cy - 1;
            rect.bottom = cy + 1;

            ClipCursor(&rect);
        } else {
            RECT rect;
            if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) {
                ClientToScreen(data->hwnd, (LPPOINT) & rect);
                ClientToScreen(data->hwnd, (LPPOINT) & rect + 1);
                ClipCursor(&rect);
            }
        }
    } else {
        ClipCursor(NULL);
    }
}
开发者ID:dreamsxin,项目名称:nsg-library,代码行数:41,代码来源:SDL_windowswindow.c

示例15: hideCursor

// Hide the mouse cursor
//
static void hideCursor(_GLFWwindow* window)
{
    POINT pos;

    ClipCursor(NULL);

    if (GetCursorPos(&pos))
    {
        if (WindowFromPoint(pos) == window->win32.handle)
            SetCursor(NULL);
    }
}
开发者ID:RubenMagallanes,项目名称:comp308sheepSim,代码行数:14,代码来源:win32_window.c


注:本文中的ClipCursor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。