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


C++ TPoint::Set方法代码示例

本文整理汇总了C++中TPoint::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TPoint::Set方法的具体用法?C++ TPoint::Set怎么用?C++ TPoint::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPoint的用法示例。


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

示例1: SimulateMouseMoved

void TWindow::SimulateMouseMoved()
{
	TPoint	mouse;
	const TPoint& scroll = GetScroll();

	mouse.Set(fLastMouseMovedLocation.h + scroll.h, fLastMouseMovedLocation.v + scroll.v);
	HandleMouseMoved(mouse, fLastMouseMovedModifiers);
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:8,代码来源:TWindow.cpp

示例2: HandleEvent

void TWindow::HandleEvent(XEvent& event)
{
	TPoint	mouse;
	const TPoint& scroll = GetScroll();
	
	switch (event.type)
	{
		case Expose:
		{
			TRect	r(event.xexpose.x, event.xexpose.y, event.xexpose.x + event.xexpose.width, event.xexpose.y + event.xexpose.height);

			if (fUpdateRegion)
				fUpdateRegion->Union(r);
			else
			{
				fUpdateRegion = new TRegion(r);
				fNextUpdate = sFirstUpdate;
				sFirstUpdate = this;
			}
				
//			if (event.xexpose.count == 0)
//				Update();
		
			break;
		}

		case KeyPress:
		case KeyRelease:
		{			
			TTopLevelWindow* topLevel = GetTopLevelWindow();
			if (topLevel)
				topLevel->DispatchKeyEvent(event);
			break;
		}		
		
		case ButtonPress:
			if (event.xbutton.button >= 1 && event.xbutton.button <= 3)
			{
				fCurrentEventTime = event.xbutton.time;
				mouse.Set(event.xbutton.x + scroll.h, event.xbutton.y + scroll.v);

				// check for multiple clicks
				TTime now = gApplication->GetCurrentTime();
				if (now - fLastClickTime < kDoubleClickTime && 
					abs(fLastClick.h - mouse.h) <= kDoubleClickDelta &&
					abs(fLastClick.v - mouse.v) <= kDoubleClickDelta)
					++fClickCount;
				else
					fClickCount = 1;

				fLastClick = mouse;
				fLastClickTime = now;

				if (IsTargetable() && event.xbutton.button != 2)
					RequestTarget();
				
				HandleMouseDown(mouse, (TMouseButton)event.xbutton.button, event.xbutton.state);
			}
			else if (event.xbutton.button == 4 || event.xbutton.button == 5)
			{
				HandleScrollWheel(event.xbutton.button == 5);
			}
			break;

		case ButtonRelease:
			if (event.xbutton.button >= 1 && event.xbutton.button <= 3)
			{
				fCurrentEventTime = event.xbutton.time;
				mouse.Set(event.xbutton.x + scroll.h, event.xbutton.y + scroll.v);
				HandleMouseUp(mouse, (TMouseButton)event.xbutton.button, event.xbutton.state);
			}
			break;

		case EnterNotify:
			fCurrentEventTime = event.xcrossing.time;
			mouse.Set(event.xcrossing.x + scroll.h, event.xcrossing.y + scroll.v);
			HandleMouseEnter(mouse, event.xcrossing.state);
			break;

		case LeaveNotify:
			fCurrentEventTime = event.xcrossing.time;
			mouse.Set(event.xcrossing.x + scroll.h, event.xcrossing.y + scroll.v);
			HandleMouseLeave(mouse, event.xcrossing.state);
			break;

		case MotionNotify:
		{
			// avoid getting too many MotionNotify events by ignoring them if we have more in the queue
			XEvent testEvent;
			if (XPending(sDisplay) > 0 && XCheckTypedWindowEvent(sDisplay, event.xany.window, MotionNotify, &testEvent))
				break;

			fLastMouseMovedLocation.Set(event.xmotion.x, event.xmotion.y);
			fLastMouseMovedModifiers = event.xmotion.state;
			fCurrentEventTime = event.xmotion.time;
			mouse.Set(event.xmotion.x + scroll.h, event.xmotion.y + scroll.v);
			HandleMouseMoved(mouse, event.xmotion.state);
			break;
		}

//.........这里部分代码省略.........
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:101,代码来源:TWindow.cpp


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