ultimatepp/rainbow/WinFb/Win.cpp
cxl 76e0cda649 .developing rainbow
git-svn-id: svn://ultimatepp.org/upp/trunk@3572 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-06-27 21:43:40 +00:00

72 lines
1.4 KiB
C++

#include "WinFb.h"
NAMESPACE_UPP
HWND fbHWND;
bool fbEndSession;
bool FBEndSession()
{
return fbEndSession;
}
bool FBIsWaitingEvent()
{
MSG msg;
return PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
}
bool FBProcessEvent(bool *quit)
{
MSG msg;
if(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
if(msg.message == WM_QUIT && quit)
*quit = true;
TranslateMessage(&msg);
DispatchMessageW(&msg);
return true;
}
return false;
}
void FBSleep(int ms)
{
MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT);
}
void FBInit(HINSTANCE hInstance)
{
GuiLock __;
Ctrl::InitFB();
WNDCLASSW wc;
Zero(wc);
wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)fbWindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)NULL;
wc.lpszClassName = L"UPP-FB-CLASS";
RegisterClassW(&wc);
fbHWND = CreateWindowW(L"UPP-FB-CLASS", L"", WS_OVERLAPPED|WS_VISIBLE|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
SetTimer(fbHWND, 1, 10, NULL);
// Csizeinit();
}
void FBUpdate(const Rect& inv)
{
if(fbHWND)
::InvalidateRect(fbHWND, inv, false);
}
void FBSync()
{
if(fbHWND)
::UpdateWindow(fbHWND);
}
END_UPP_NAMESPACE