本文整理汇总了C++中WindowApplication::OnResize方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowApplication::OnResize方法的具体用法?C++ WindowApplication::OnResize怎么用?C++ WindowApplication::OnResize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowApplication
的用法示例。
在下文中一共展示了WindowApplication::OnResize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: ReshapeCallback
//----------------------------------------------------------------------------
static void ReshapeCallback (int width, int height)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnResize(width, height);
theApp->OnDisplay();
}
}
示例3: ProcessWindowZoomed
//----------------------------------------------------------------------------
static pascal OSStatus ProcessWindowZoomed (EventHandlerCallRef,
EventRef evt, void*)
{
WindowRef window;
GetEventParameter(evt, kEventParamDirectObject, typeWindowRef, 0,
sizeof(window), 0, &window);
Rect rect;
GetWindowBounds(window, kWindowContentRgn, &rect);
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
theApp->OnResize(rect.right - rect.left, rect.bottom - rect.top);
// Allow standard handler to run.
return eventNotHandledErr;
}
示例4: 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;
}
示例5: 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);
//.........这里部分代码省略.........