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


C++ WindowApplication::OnMove方法代码示例

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


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

示例1: if

//----------------------------------------------------------------------------
static pascal OSStatus ProcessWindowBoundsChange (EventHandlerCallRef,
        EventRef evt, void*)
{
	UInt32 attributes;
	GetEventParameter(evt, kEventParamAttributes, typeUInt32, 0,
	                  sizeof(attributes), 0, &attributes);

	Rect rect;
	GetEventParameter(evt, kEventParamCurrentBounds, typeQDRectangle, 0,
	                  sizeof(rect), 0, &rect);

	WindowApplication* theApp =
	    (WindowApplication*)Application::TheApplication;

	if (attributes & kWindowBoundsChangeUserDrag
	        ||  attributes & kWindowBoundsChangeOriginChanged)
	{
		// Bounds are changing due to window moving.
		theApp->OnMove(rect.top, rect.left);
	}
	else if (attributes & kWindowBoundsChangeUserResize
	         ||  attributes & kWindowBoundsChangeSizeChanged)
	{
		// Bounds are changing due to window resizing.
		theApp->OnResize(rect.right - rect.left, rect.bottom - rect.top);
	}

	// Allow standard handler to run.
	return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:31,代码来源:Wm5AglApplication.cpp

示例2: Main


//.........这里部分代码省略.........
                    else if (key == 0x63)
                    {
                        // keypad Insert
                        key = 0x9e;
                    }
                    else if (key == 0xFF)
                    {
                        // keypad Delete
                        key = 0x9f;
                    }
                    else if (key == 0xE1 || key == 0xE2)
                    {
                        // L-shift or R-shift
                        key = KEY_SHIFT;
                        state = (evt.type == KeyPress);
                        SetExtraData(GLXAPP_SHIFTDOWN, sizeof(bool), &state);
                    }
                    else if (key == 0xE3 || key == 0xE4)
                    {
                        // L-ctrl or R-ctrl
                        key = KEY_CONTROL;
                    }
                    else if (key == 0xE9 || key == 0xEA)
                    {
                        // L-alt or R-alt
                        key = KEY_ALT;
                    }
                    else if (key == 0xEB || key == 0xEC)
                    {
                        key = KEY_COMMAND;
                    }
                }

                if ((KEY_HOME <= key &&  key <= KEY_END)
                ||  (KEY_F1 <= key   &&  key <= KEY_F12)
                ||  (KEY_SHIFT <= key && key <= KEY_COMMAND))
                {
                    if (evt.type == KeyPress)
                    {
                        theApp->OnSpecialKeyDown(key, evt.xbutton.x,
                            evt.xbutton.y);
                    }
                    else
                    {
                        theApp->OnSpecialKeyUp(key, evt.xbutton.x,
                            evt.xbutton.y);
                    }
                }
                else
                {
                    // Get key-modifier state.  Adjust for shift state.
                    unsigned char ucKey = (unsigned char)key;
                    GetExtraData(GLXAPP_SHIFTDOWN, sizeof(bool), &state);
                    if (state && 'a' <= ucKey && ucKey <= 'z')
                    {
                        ucKey = (unsigned char)(key - 32);
                    }

                    if (evt.type == KeyPress)
                    {
                        theApp->OnKeyDown(ucKey, evt.xbutton.x,
                            evt.xbutton.y);
                    }
                    else
                    {
                        theApp->OnKeyUp(ucKey, evt.xbutton.x,
                            evt.xbutton.y);
                    }
                }
                continue;
            }

            if (evt.type == Expose)
            {
                theApp->OnDisplay();
                continue;
            }

            if (evt.type == ConfigureNotify)
            {
                theApp->OnMove(evt.xconfigure.x, evt.xconfigure.y);
                theApp->OnResize(evt.xconfigure.width,
                    evt.xconfigure.height);
                continue;
            }

            if (evt.type == ClientMessage
            &&  evt.xclient.data.l[0] == wmDelete)
            {
                XDestroyWindow(display, window);
                applicationRunning = false;
                continue;
            }
        }
    }

    theApp->OnTerminate();
    XCloseDisplay(display);
    return 0;
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:101,代码来源:Wm5GlxApplication.cpp

示例3: MsWindowEventHandler

//----------------------------------------------------------------------------
LRESULT CALLBACK MsWindowEventHandler (HWND handle, UINT message,
    WPARAM wParam, LPARAM lParam)
{
    WindowApplication* theApp =
        (WindowApplication*)Application::TheApplication;

    if (!theApp || !theApp->GetWindowID())
    {
        return DefWindowProc(handle, message, wParam, lParam);
    }

    switch (message) 
    {
        case WM_PAINT:
        {
            PAINTSTRUCT ps;
            BeginPaint(handle, &ps);
            theApp->OnDisplay();
            EndPaint(handle, &ps);
            return 0;
        }
        case WM_ERASEBKGND:
        {
            // This tells Windows not to erase the background (and that the
            // application is doing so).
            return 1;
        }
        case WM_MOVE:
        {
            int xPos = (int)(LOWORD(lParam));
            int yPos = (int)(HIWORD(lParam));
            theApp->OnMove(xPos, yPos);
            return 0;
        }
        case WM_SIZE:
        {
            int width = (int)(LOWORD(lParam));
            int height = (int)(HIWORD(lParam));
            theApp->OnResize(width, height);
            return 0;
        }
        case WM_CHAR:
        {
            unsigned char key = (unsigned char)(char)wParam;

            // Quit the application if the KEY_TERMINATE key is pressed.
            if (key == theApp->KEY_TERMINATE)
            {
                PostQuitMessage(0);
                return 0;
            }

            // Get the cursor position in client coordinates.
            POINT point;
            GetCursorPos(&point);
            ScreenToClient(handle, &point);
            int xPos = (int)point.x;
            int yPos = (int)point.y;

            theApp->OnKeyDown(key, xPos, yPos);
            return 0;
        }
        case WM_KEYDOWN:
        {
            int virtKey = (int)wParam;

            // Get cursor position client coordinates.
            POINT point;
            GetCursorPos(&point);
            ScreenToClient(handle, &point);
            int xPos = (int)point.x;
            int yPos = (int)point.y;

            if ((VK_F1 <= virtKey && virtKey <= VK_F12)
            ||  (VK_PRIOR <= virtKey && virtKey <= VK_DOWN)
            ||  (virtKey == VK_INSERT) || (virtKey == VK_DELETE)
            ||  (virtKey == VK_SHIFT) || (virtKey == VK_CONTROL))
            {
                theApp->OnSpecialKeyDown(virtKey, xPos, yPos);
            }
            return 0;
        }
        case WM_KEYUP:
        {
            int virtKey = (int)wParam;

            // get the cursor position in client coordinates
            POINT point;
            GetCursorPos(&point);
            ScreenToClient(handle, &point);
            int xPos = (int)point.x;
            int yPos = (int)point.y;

            if ((VK_F1 <= virtKey && virtKey <= VK_F12)
            ||  (VK_PRIOR <= virtKey && virtKey <= VK_DOWN)
            ||  (virtKey == VK_INSERT) || (virtKey == VK_DELETE)
            ||  (virtKey == VK_SHIFT) || (virtKey == VK_CONTROL))
            {
                theApp->OnSpecialKeyUp(virtKey, xPos, yPos);
//.........这里部分代码省略.........
开发者ID:rasslingcats,项目名称:calico,代码行数:101,代码来源:Wm5WinApplication.cpp


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