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


C++ Input::ShiftState方法代码示例

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


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

示例1: DoKey

void Compositor::DoKey(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    if (m_focussed_win) {
        if (input.Type() == INPUT_TYPE_KEY_PRESS) {
            event.type = ACE_EVTYPE_KEY_PRESS;
        }
        else {
            event.type = ACE_EVTYPE_KEY_RELEASE;
        }
        event.key.keycode     = input.Key();
        event.key.shift_state = input.ShiftState();
        //anvil_syslog(0, "Key to window (%02x)\n", key);
        m_focussed_win->AddEvent(event);
    }

}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例2: DoReleaseLeft

void Compositor::DoReleaseLeft(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    //anvil_syslog(0, "Left up\n");

    /* Left mouse up */
    if (m_mouse_mode != MOUSE_MODE_NONE) {
        m_mouse_mode = MOUSE_MODE_NONE;
    }
    else {
        int win_pos_x, win_pos_y;
        if (mouse_win) {
            //anvil_syslog(0, "Mouse 1 up at %d %d\n", m_cursor_x, m_cursor_y);
            mouse_win->GetPos(win_pos_x, win_pos_y);
            event.type = ACE_EVTYPE_MOUSE_UP;
            event.mouse.shift_state = input.ShiftState();
            event.mouse.button = 0;
            event.mouse.x = m_cursor_x - win_pos_x;
            event.mouse.y = m_cursor_y - win_pos_y;
            mouse_win->AddEvent(event);
        }
    }
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例3: DoPressLeft

void Compositor::DoPressLeft(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    //anvil_syslog(0, "Left down\n");

    /* Left mouse down */
    int win_pos_x, win_pos_y;
    //anvil_syslog(0, "Mouse 1 down at %d %d\n", m_cursor_x, m_cursor_y);

    // This is ONLY where we set the focussed window.
    if (m_focussed_win != mouse_win) {
        //anvil_syslog(0, "Activate %016lx\n", mouse_win);

        /* Send an out of focus event to the old window */
        if (m_focussed_win) {
            event.type = ACE_EVTYPE_FOCUS;
            event.focus.state = false;
            m_focussed_win->AddEvent(event);
        }
        m_focussed_win = mouse_win;

        /* Send a focus event to the new window */
        if (m_focussed_win) {
            event.type = ACE_EVTYPE_FOCUS;
            event.focus.state = true;
            m_focussed_win->AddEvent(event);
        }
    }

    switch (m_cursor_type) {
        case -1: // outside
            m_mouse_mode = MOUSE_MODE_NONE;
            break;
        case 0: // in window - send event to the window
            if (input.ShiftState() & ACE_SHIFTSTATE_ALT) {
                if (mouse_win && mouse_win->isMoveable()) {
                    m_windowlist.Raise(mouse_win);
                    m_mouse_mode = MOUSE_MODE_MOVE;
                }
            }
            else {
                if (mouse_win) {
                    /* Send the mouse down */
                    m_windowlist.Raise(mouse_win);
                    mouse_win->GetPos(win_pos_x, win_pos_y);
                    event.type = ACE_EVTYPE_MOUSE_DOWN;
                    event.mouse.shift_state = input.ShiftState();
                    event.mouse.button = 0;
                    event.mouse.x = m_cursor_x - win_pos_x;
                    event.mouse.y = m_cursor_y - win_pos_y;
                    mouse_win->AddEvent(event);
                }
            }
            break;
        case 1: // left border
            m_mouse_mode = MOUSE_MODE_RESIZE_L;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_L\n");
            break;
        case 2: // right border
            m_mouse_mode = MOUSE_MODE_RESIZE_R;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_R\n");
            break;
        case 4: // top border
            m_mouse_mode = MOUSE_MODE_RESIZE_T;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_T\n");
            break;
        case 8: // bottom border
            m_mouse_mode = MOUSE_MODE_RESIZE_B;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_B\n");
            break;
        case 5: // top left
            m_mouse_mode = MOUSE_MODE_RESIZE_LT;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_LT\n");
            break;
        case 6: // top right
            m_mouse_mode = MOUSE_MODE_RESIZE_RT;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_RT\n");
            break;
        case 9: // bottom left
            m_mouse_mode = MOUSE_MODE_RESIZE_LB;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_LB\n");
            break;
        case 10: // bottom right
            m_mouse_mode = MOUSE_MODE_RESIZE_RB;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_RB\n");
            break;
    }

}
开发者ID:,项目名称:,代码行数:90,代码来源:


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