本文整理汇总了C++中Control::OnMouseMoved方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::OnMouseMoved方法的具体用法?C++ Control::OnMouseMoved怎么用?C++ Control::OnMouseMoved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control::OnMouseMoved方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleSDLEvent
bool HandleSDLEvent(SDL_Event *ev)
{
Control *child;
if (!Screen::screen)
return false;
switch (ev->type)
{
case SDL_MOUSEBUTTONDOWN:
if (Control::trackControl)
{
Control::trackControl->OnMouseDown(ev->button.x, ev->button.y, ev->button.button);
return true;
}
if (Screen::screen->exclusiveChild)
{
int x1, y1, x2, y2;
Screen::screen->exclusiveChild->GetBounds(x1, y1, x2, y2);
if (!(ev->button.x >= x1 && ev->button.x <= x2 && ev->button.y >= y1 && ev->button.y <= y2))
return false;
child = Screen::screen->exclusiveChild->ChildAt(ev->button.x, ev->button.y);
}
else
child = Screen::screen->ChildAt(ev->button.x, ev->button.y);
if (child->visible)
return child->OnMouseDown(ev->button.x, ev->button.y, ev->button.button);
return false;
case SDL_MOUSEBUTTONUP:
if (Control::trackControl)
{
Control::trackControl->OnMouseUp(ev->button.x, ev->button.y, ev->button.button);
return true;
}
if (Screen::screen->exclusiveChild)
child = Screen::screen->exclusiveChild->ChildAt(ev->button.x, ev->button.y);
else
child = Screen::screen->ChildAt(ev->button.x, ev->button.y);
if (child->visible)
return child->OnMouseUp(ev->button.x, ev->button.y, ev->button.button);
return false;
case SDL_MOUSEMOTION:
if (Control::trackControl)
{
Control::trackControl->OnMouseMoved(ev->button.x, ev->button.y);
return true;
}
if (Screen::screen->exclusiveChild)
child = Screen::screen->exclusiveChild->ChildAt(ev->motion.x, ev->motion.y);
else
child = Screen::screen->ChildAt(ev->motion.x, ev->motion.y);
if (Control::lastChildUnderMouse != child)
{
if (Control::lastChildUnderMouse)
Control::lastChildUnderMouse->OnMouseExit();
Control::lastChildUnderMouse = child;
child->OnMouseEnter();
}
if (child->visible)
return child->OnMouseMoved(ev->motion.x, ev->motion.y);
return false;
case SDL_KEYDOWN:
if (!(Control::keyboardFocusControl && Control::keyboardFocusControl->Focused()))
return false;
return Control::keyboardFocusControl->OnKeyDown(ev->key.keysym.sym, ev->key.keysym.unicode);
case SDL_KEYUP:
if (!(Control::keyboardFocusControl && Control::keyboardFocusControl->Focused()))
return false;
return Control::keyboardFocusControl->OnKeyUp(ev->key.keysym.sym, ev->key.keysym.unicode);
}
return false;
}