ultimatepp/rainbow/Skeleton/Wnd.cpp
cxl 025f2a40c4 .rainbow Skeleton fixed to compile
git-svn-id: svn://ultimatepp.org/upp/trunk@11215 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2017-07-04 16:41:25 +00:00

367 lines
6 KiB
C++

#include <CtrlCore/CtrlCore.h>
#ifdef GUI_SKELETON
NAMESPACE_UPP
#define LLOG(x) // LOG(x)
#define LOGTIMING 0
#ifdef _DEBUG
#define LOGMESSAGES 0
#endif
#define ELOGW(x) // RLOG(GetSysTime() << ": " << x) // Only activate in MT!
#define ELOG(x) // RLOG(GetSysTime() << ": " << x)
bool Ctrl::IsAlphaSupported()
{
return false;
}
bool Ctrl::IsCompositedGui()
{
return false;
}
Vector<Ctrl *> Ctrl::GetTopCtrls()
{
Vector<Ctrl *> h;
return h;
}
void Ctrl::SetMouseCursor(const Image& image)
{
GuiLock __;
}
Ctrl *Ctrl::GetOwner()
{
GuiLock __;
return NULL;
}
Ctrl *Ctrl::GetActiveCtrl()
{
GuiLock __;
return NULL;
}
// Vector<Callback> Ctrl::hotkey;
int Ctrl::RegisterSystemHotKey(dword key, Function<void ()> cb)
{
/* ASSERT(key >= K_DELTA);
int q = hotkey.GetCount();
for(int i = 0; i < hotkey.GetCount(); i++)
if(!hotkey[i]) {
q = i;
break;
}
hotkey.At(q) = cb;
dword mod = 0;
if(key & K_ALT)
mod |= MOD_ALT;
if(key & K_SHIFT)
mod |= MOD_SHIFT;
if(key & K_CTRL)
mod |= MOD_CONTROL;
return RegisterHotKey(NULL, q, mod, key & 0xffff) ? q : -1;*/
return -1;
}
void Ctrl::UnregisterSystemHotKey(int id)
{
/* if(id >= 0 && id < hotkey.GetCount()) {
UnregisterHotKey(NULL, id);
hotkey[id].Clear();
}*/
}
bool Ctrl::IsWaitingEvent()
{
return false;
}
bool Ctrl::ProcessEvent(bool *quit)
{
ASSERT(IsMainThread());
return false;
}
void SweepMkImageCache();
bool Ctrl::ProcessEvents(bool *quit)
{
/* if(ProcessEvent(quit)) {
while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop())); // LoopCtrl-MF 071008
TimerProc(GetTickCount());
SweepMkImageCache();
return true;
}
SweepMkImageCache();
TimerProc(GetTickCount());*/
return false;
}
void Ctrl::EventLoop(Ctrl *ctrl)
{
GuiLock __;
/* ASSERT(IsMainThread());
ASSERT(LoopLevel == 0 || ctrl);
LoopLevel++;
LLOG("Entering event loop at level " << LoopLevel << BeginIndent);
Ptr<Ctrl> ploop;
if(ctrl) {
ploop = LoopCtrl;
LoopCtrl = ctrl;
ctrl->inloop = true;
}
bool quit = false;
ProcessEvents(&quit);
while(!EndSession() && !quit && ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount())
{
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
SyncCaret();
GuiSleep(1000);
if(EndSession()) break;
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents");
ProcessEvents(&quit);
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents");
}
if(ctrl)
LoopCtrl = ploop;
LoopLevel--;
LLOG(EndIndent << "Leaving event loop ");*/
}
void Ctrl::GuiSleep(int ms)
{
GuiLock __;
/* ASSERT(IsMainThread());
ELOG("GuiSleep");
if(EndSession())
return;
ELOG("GuiSleep 2");
int level = LeaveGMutexAll();
#if !defined(flagDLL) && !defined(PLATFORM_WINCE)
if(!OverwatchThread) {
DWORD dummy;
OverwatchThread = CreateThread(NULL, 0x100000, Win32OverwatchThread, NULL, 0, &dummy);
ELOG("ExitLoopEventWait 1");
ExitLoopEvent.Wait();
}
HANDLE h[1];
*h = ExitLoopEvent.GetHandle();
ELOG("ExitLoopEventWait 2 " << (void *)*h);
MsgWaitForMultipleObjects(1, h, FALSE, ms, QS_ALLINPUT);
#else
MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT);
#endif
EnterGMutex(level);*/
}
Rect Ctrl::GetWndScreenRect() const
{
GuiLock __;
Rect r;
return r;
}
void Ctrl::WndShow(bool b)
{
GuiLock __;
}
void Ctrl::WndUpdate()
{
GuiLock __;
}
bool Ctrl::IsWndOpen() const {
GuiLock __;
return false;
}
void Ctrl::SetAlpha(byte alpha)
{
GuiLock __;
}
Rect Ctrl::GetWorkArea() const
{
GuiLock __;
return Rect();
}
void Ctrl::GetWorkArea(Array<Rect>& rc)
{
GuiLock __;
}
Rect Ctrl::GetVirtualWorkArea()
{
Rect out = GetPrimaryWorkArea();
Array<Rect> rc;
GetWorkArea(rc);
for(int i = 0; i < rc.GetCount(); i++)
out |= rc[i];
return out;
}
Rect Ctrl::GetVirtualScreenArea()
{
GuiLock __;
return Rect();
}
Rect Ctrl::GetPrimaryWorkArea()
{
Rect r;
return r;
}
Rect Ctrl::GetPrimaryScreenArea()
{
return Size();
}
int Ctrl::GetKbdDelay()
{
GuiLock __;
return 500;
}
int Ctrl::GetKbdSpeed()
{
GuiLock __;
return 1000 / 32;
}
void Ctrl::WndDestroy()
{
}
void Ctrl::SetWndForeground()
{
GuiLock __;
}
bool Ctrl::IsWndForeground() const
{
GuiLock __;
return true;
}
void Ctrl::WndEnable(bool)
{
GuiLock __;
}
bool Ctrl::SetWndFocus()
{
GuiLock __;
return true;
}
bool Ctrl::HasWndFocus() const
{
GuiLock __;
return false;
}
bool Ctrl::SetWndCapture()
{
GuiLock __;
ASSERT(IsMainThread());
return false;
}
bool Ctrl::ReleaseWndCapture()
{
GuiLock __;
ASSERT(IsMainThread());
return false;
}
bool Ctrl::HasWndCapture() const
{
GuiLock __;
return false;
}
void Ctrl::WndInvalidateRect(const Rect& r)
{
GuiLock __;
}
void Ctrl::WndSetPos(const Rect& rect)
{
GuiLock __;
}
void Ctrl::WndUpdate(const Rect& r)
{
GuiLock __;
}
void Ctrl::WndScrollView(const Rect& r, int dx, int dy)
{
GuiLock __;
}
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)
{
}
Rect Ctrl::GetDefaultWindowRect() {
return Rect(0, 0, 100, 100);
}
ViewDraw::ViewDraw(Ctrl *ctrl)
{
EnterGuiMutex();
}
ViewDraw::~ViewDraw()
{
LeaveGuiMutex();
}
Vector<WString> SplitCmdLine__(const char *cmd)
{
Vector<WString> out;
while(*cmd)
if((byte)*cmd <= ' ')
cmd++;
else if(*cmd == '\"') {
WString quoted;
while(*++cmd && (*cmd != '\"' || *++cmd == '\"'))
quoted.Cat(FromSystemCharset(String(cmd, 1)).ToWString());
out.Add(quoted);
}
else {
const char *begin = cmd;
while((byte)*cmd > ' ')
cmd++;
out.Add(String(begin, cmd).ToWString());
}
return out;
}
void Ctrl::SysEndLoop()
{
}
void FinishDragRect(Ctrl& q)
{
}
END_UPP_NAMESPACE
#endif