• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ClipCursor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: RestrictMouseMovementTo

void RestrictMouseMovementTo( int left , int top , int right , int bottom ){
	
	RECT r;

	r.left = left;
	r.top = top;
	r.right = right;
	r.bottom = bottom;

	ClipCursor( &r );

}
开发者ID:v1ka5,项目名称:Owl_zwei,代码行数:12,代码来源:mouse.cpp


示例17: ClipCursor

void r3dMouse::SetRange(int x1, int y1, int x2, int y2)
{
	RECT	rc;

	// Clip Cursor
	rc.left   = x1;
	rc.top    = y1;
	rc.right  = x2;
	rc.bottom = y2;
	ClipCursor(&rc);
	SetCursorPos(0, 0);
}
开发者ID:Mateuus,项目名称:srcundead,代码行数:12,代码来源:r3dInput.cpp


示例18: Win_ClipCursor

// Called when the window gains focus or changes in some way
static void Win_ClipCursor( void ) {
    RECT rc;

    get_client_rect( win.wnd, &rc );

    win.center_x = ( rc.right + rc.left ) / 2;
    win.center_y = ( rc.top + rc.bottom ) / 2;

    SetCursorPos( win.center_x, win.center_y );

    ClipCursor( &rc );
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:13,代码来源:vid_win.c


示例19: sizeof

GameWindow::GameWindow(const string name_t,const string title_t,int width,int height):name(name_t),title(title_t),WIDTH(width),HEIGHT(height)
{
	//1.创建窗口类
	WNDCLASSEX wndClass = {};
	wndClass.cbSize = sizeof(WNDCLASSEX);
	wndClass.style = CS_HREDRAW | CS_VREDRAW;
	wndClass.lpfnWndProc = WndProc;
	wndClass.cbClsExtra = 0;
	wndClass.cbWndExtra = 0;
	wndClass.hInstance = GetModuleHandle(NULL);
	wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wndClass.lpszMenuName = NULL;
	wndClass.lpszClassName = name.c_str();

	//2.注册窗口类
	assert(RegisterClassEx(&wndClass));

	//3.创建窗口
	hwnd = CreateWindow(name.c_str(),title.c_str(),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,WIDTH,HEIGHT,NULL,NULL,wndClass.hInstance,NULL);

	//4.调整大小,移动,显示,更新
	RECT window_rect = {0,0,WIDTH,HEIGHT};
	AdjustWindowRectEx(&window_rect, GetWindowStyle(hwnd), GetMenu(hwnd) != NULL, GetWindowExStyle(hwnd));
	MoveWindow(hwnd,300,150,window_rect.right-window_rect.left, window_rect.bottom-window_rect.top,false);
	ShowWindow(hwnd,SW_NORMAL);
	UpdateWindow(hwnd);

	//5.隐藏鼠标,设为屏幕中心
	ShowCursor(false);
	center.x = WIDTH/2;
	center.y = HEIGHT/2;
	ClientToScreen(hwnd,&center);
	SetCursorPos(center.x,center.y);
	//6.限定鼠标在窗口内
	RECT rect;
	GetClientRect(hwnd,&rect);
	POINT left_top;
	left_top.x = rect.left;
	left_top.y = rect.top;
	POINT right_bottom;
	right_bottom.x = rect.right;
	right_bottom.y = rect.bottom;
	ClientToScreen(hwnd,&left_top);
	ClientToScreen(hwnd,&right_bottom);
	rect.left = left_top.x;
	rect.top = left_top.y;
	rect.right = right_bottom.x;
	rect.bottom = right_bottom.y;
	ClipCursor(&rect);
}
开发者ID:zhanghuanzj,项目名称:3DRender,代码行数:52,代码来源:GameWindow.cpp


示例20: unclip

void unclip()
{
int a;

RECT _screen;

_screen.left = 0;
_screen.top = 0;
_screen.right = GetSystemMetrics(SM_CXSCREEN);
_screen.bottom = GetSystemMetrics(SM_CYSCREEN);

ClipCursor(&_screen);
}
开发者ID:jnck,项目名称:winlock,代码行数:13,代码来源:winlock.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ClipSkyPolygon函数代码示例发布时间:2022-05-30
下一篇:
C++ Clip函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap