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


C++ CGUI::ProcessKeyboardInput方法代码示例

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


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

示例1: ProcessMessage

bool CLocalGUI::ProcessMessage ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    CGUI* pGUI = CCore::GetSingleton ().GetGUI ();

    // If we have the focus, we handle the message
    if ( InputGoesToGUI () )
    {
        // Pass the message to the GUI manager
		// ACHTUNG: fix the CEGUI ones!
        switch ( uMsg )
        {
			case WM_MOUSEWHEEL:
                if ( GET_WHEEL_DELTA_WPARAM ( wParam ) > 0 )  
				    pGUI->ProcessMouseInput ( CGUI_MI_MOUSEWHEEL, 1, NULL );
                else
                    pGUI->ProcessMouseInput ( CGUI_MI_MOUSEWHEEL, 0, NULL );
				return true;

            case WM_MOUSEMOVE:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEPOS, LOWORD ( lParam ), HIWORD ( lParam ) );
                return true;

            case WM_LBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, LeftButton );
                return true;

            case WM_RBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, RightButton );
                return true;

            case WM_MBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, MiddleButton );
                return true;

            case WM_LBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, LeftButton );
                return true;

            case WM_RBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, RightButton );
                return true;

			case WM_MBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, MiddleButton );
                return true;
#ifdef WM_XBUTTONDOWN
			case WM_XBUTTONDOWN:
				pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, X1Button );
				return true;

			case WM_XBUTTONUP:
				pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, X1Button );
				return true;
#endif
            case WM_KEYDOWN:
            {
                DWORD dwTemp = TranslateScanCodeToGUIKey ( wParam );
                if ( dwTemp > 0 )
                {
                    pGUI->ProcessKeyboardInput ( dwTemp, true );
                    return true;
                }

                return true;
            }

            case WM_KEYUP:
            {
                DWORD dwTemp = TranslateScanCodeToGUIKey ( wParam );
                if ( dwTemp > 0 )
                {
                    pGUI->ProcessKeyboardInput ( dwTemp, false );
                }

                return false;
            }

            case WM_CHAR:
                pGUI->ProcessCharacter ( wParam );
                return true;
        }
    }

    // Test - Use PageUp and PageDown to scroll chat box
    switch ( uMsg )
    {
        case WM_KEYDOWN:
        {
            if ( wParam == VK_PRIOR )
            {
                if ( m_pChat )
                    m_pChat->ScrollUp ();

                if ( m_pDebugView )
                    m_pDebugView->ScrollUp ();
            }
            else
            if ( wParam == VK_NEXT )
            {
                if ( m_pChat )
//.........这里部分代码省略.........
开发者ID:Gamesnert,项目名称:multitheftauto,代码行数:101,代码来源:CGUI.cpp

示例2: ProcessMessage

bool CLocalGUI::ProcessMessage ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    CGUI* pGUI = CCore::GetSingleton ().GetGUI ();

    // If we have the focus, we handle the message
    if ( InputGoesToGUI () )
    {
        // Pass the message to the GUI manager
        // ACHTUNG: fix the CEGUI ones!
        switch ( uMsg )
        {
            case WM_MOUSEWHEEL:
                if ( GET_WHEEL_DELTA_WPARAM ( wParam ) > 0 )  
                    pGUI->ProcessMouseInput ( CGUI_MI_MOUSEWHEEL, 1, NULL );
                else
                    pGUI->ProcessMouseInput ( CGUI_MI_MOUSEWHEEL, 0, NULL );
                return true;

            case WM_MOUSEMOVE:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEPOS, LOWORD ( lParam ), HIWORD ( lParam ) );
                return true;

            case WM_LBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, LeftButton );
                return true;

            case WM_RBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, RightButton );
                return true;

            case WM_MBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, MiddleButton );
                return true;

            case WM_LBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, LeftButton );
                return true;

            case WM_RBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, RightButton );
                return true;

            case WM_MBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, MiddleButton );
                return true;
#ifdef WM_XBUTTONDOWN
            case WM_XBUTTONDOWN:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEDOWN, 0, 0, X1Button );
                return true;

            case WM_XBUTTONUP:
                pGUI->ProcessMouseInput ( CGUI_MI_MOUSEUP, 0, 0, X1Button );
                return true;
#endif
            case WM_KEYDOWN:
            {
                DWORD dwTemp = TranslateScanCodeToGUIKey ( wParam );
                if ( dwTemp > 0 )
                {
                    pGUI->ProcessKeyboardInput ( dwTemp, true );
                    return true;
                }

                return true;
            }

            case WM_KEYUP:
            {
                DWORD dwTemp = TranslateScanCodeToGUIKey ( wParam );
                if ( dwTemp > 0 )
                {
                    pGUI->ProcessKeyboardInput ( dwTemp, false );
                }

                return false;
            }

            case WM_IME_COMPOSITION:
            {
                if ( lParam & GCS_RESULTSTR )
                {
                    HIMC himc = ImmGetContext ( hwnd );

                    // Get composition result
                    ushort buffer[256];
                    LONG numBytes = ImmGetCompositionStringW ( himc, GCS_RESULTSTR, buffer, sizeof ( buffer ) - 2 );
                    int iNumCharacters = numBytes / sizeof ( ushort );

                    // Erase output from previous composition state
                    for ( int i = 0 ; i < m_uiActiveCompositionSize ; i++ )
                    {
                        pGUI->ProcessCharacter ( '\x08' );
                        pGUI->ProcessKeyboardInput ( 14, true );
                    }

                    // Output composition result
                    for ( int i = 0 ; i < iNumCharacters ; i++ )
                        if ( buffer[i] )
                            pGUI->ProcessCharacter ( buffer[i] );

//.........这里部分代码省略.........
开发者ID:stymR,项目名称:mtasa-blue,代码行数:101,代码来源:CGUI.cpp


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