本文整理汇总了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);
}
示例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;
}
//.........这里部分代码省略.........