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


C++ Control::OnMouseEnter方法代码示例

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


在下文中一共展示了Control::OnMouseEnter方法的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;
}
开发者ID:3da,项目名称:BSGUI,代码行数:72,代码来源:bsgui.cpp


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