.Developing rainbow

git-svn-id: svn://ultimatepp.org/upp/trunk@3707 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-07-24 17:18:53 +00:00
parent 0fc3c5291e
commit 52f68cc6b4
11 changed files with 92 additions and 15 deletions

View file

@ -82,7 +82,6 @@ void DnDLoop::DnD(bool paste)
void DnDLoop::Sync()
{
GuiLock __;
Ptr<Ctrl> t = FindMouseTopCtrl();
if(t != target)
if(target)

View file

@ -1,5 +1,7 @@
#include "Fb.h"
#ifdef GUI_FB
NAMESPACE_UPP
#define LLOG(x) //DLOG(x)
@ -183,3 +185,5 @@ void Ctrl::SetMouseCursor(const Image& image)
}
END_UPP_NAMESPACE
#endif

View file

@ -11,8 +11,11 @@ public:
virtual void Paint(Draw& w);
virtual Image CursorImage(Point p, dword keyflags);
virtual void LeftDown(Point p, dword keyflags);
virtual void LeftHold(Point p, dword keyflags);
virtual void LeftDouble(Point p, dword keyflags);
virtual void MouseMove(Point p, dword keyflags);
virtual void CancelMode();
virtual void LeftUp(Point p, dword keyflags);
private:
Point dir;
@ -22,11 +25,15 @@ private:
bool maximized;
Rect overlapped;
bool holding;
TimeCallback hold;
Point GetDragMode(Point p);
Image GetDragImage(Point dragmode);
void StartDrag();
Rect Margins() const;
Rect ComputeClient(Rect r);
void Hold();
typedef TopWindowFrame CLASSNAME;

View file

@ -18,6 +18,7 @@ TopWindowFrame::TopWindowFrame()
maximize <<= THISBACK(ToggleMaximize);
maximized = false;
sizeable = false;
holding = false;
}
void TopWindowFrame::SyncRect()
@ -169,6 +170,41 @@ void TopWindowFrame::GripResize()
void TopWindowFrame::LeftDown(Point p, dword keyflags)
{
dir = GetDragMode(p);
if(dir.x || dir.y || FullWindowDrag)
StartDrag();
else {
SetCapture();
holding = true;
hold.Set(GetKbdDelay() / 3, THISBACK(Hold));
}
}
void TopWindowFrame::CancelMode()
{
holding = false;
}
void TopWindowFrame::LeftUp(Point p, dword keyflags)
{
holding = false;
}
void TopWindowFrame::Hold()
{
if(HasCapture()) {
if(HasMouse() && GetMouseLeft() && holding)
StartDrag();
ReleaseCapture();
holding = false;
}
}
void TopWindowFrame::LeftHold(Point p, dword keyflags)
{
if(HasCapture() || FullWindowDrag)
return;
dir = GetDragMode(p);
if(!dir.x && !dir.y)
StartDrag();
}
@ -182,7 +218,7 @@ void TopWindowFrame::MouseMove(Point, dword)
{
LDUMP(HasWndCapture());
LDUMP(HasCapture());
if(!HasCapture())
if(!HasCapture() || holding)
return;
Size msz = ComputeClient(minsize).GetSize();
Point p = GetMousePos() - startpos;

View file

@ -24,8 +24,6 @@ Image Ctrl::fbCaretBak;
int Ctrl::fbCaretTm;
int Ctrl::renderingMode = MODE_ANTIALIASED;
bool Ctrl::fbEndSession;
int64 Ctrl::fbEventLoop;
int64 Ctrl::fbEndSessionLoop;
bool Ctrl::FullWindowDrag;
int Ctrl::PaintLock;
@ -65,8 +63,7 @@ void Ctrl::EndSession()
GuiLock __;
LLOG("Ctrl::EndSession");
fbEndSession = true;
fbEndSessionLoop = fbEventLoop;
LDUMP(fbEndSessionLoop);
EndSessionLoopNo = EventLoopNo;
}
void Ctrl::ExitFB()
@ -428,11 +425,9 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
}
bool quit = false;
int64 loopno = ++EventLoopNo;
ProcessEvents(&quit);
int64 loopno = ++fbEventLoop;
LDUMP(loopno);
LDUMP(fbEndSessionLoop);
while(loopno > fbEndSessionLoop && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()))
while(loopno > EndSessionLoopNo && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()))
{
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
SyncCaret();
@ -556,6 +551,8 @@ void Ctrl::WndDestroy0()
TopWindow *win = dynamic_cast<TopWindow *>(this);
if(win)
win->DestroyFrame();
if(topctrl.GetCount())
topctrl.Top()->SetWndForeground0();
}
void Ctrl::PutForeground()
@ -581,9 +578,10 @@ void Ctrl::SetWndForeground0()
ASSERT(IsOpen());
if(IsWndForeground())
return;
if(top && top->owner_window)
top->owner_window->PutForeground();
PutForeground();
Ctrl *to = this;
while(to->top && to->top->owner_window)
to = to->top->owner_window;
to->PutForeground();
if(this != focusCtrl)
ActivateWnd();
}

View file

@ -0,0 +1,11 @@
uses
CtrlLib,
WinFb;
file
main.cpp;
mainconfig
"" = "GUI SSE2 WINFB",
"" = "GUI SSE2";

5
rainbow/SysShutdown/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _SysShutdown_icpp_init_stub
#define _SysShutdown_icpp_init_stub
#include "CtrlLib/init"
#include "WinFb/init"
#endif

View file

@ -0,0 +1,10 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
int q = PromptYesNo("Just a test");
DDUMP(q);
PromptOK(AsString(q));
}

View file

@ -261,7 +261,6 @@ void UWord::SerializeApp(Stream& s)
GUI_APP_MAIN
{
SetLanguage(LNG_ENGLISH);
SetDefaultCharset(CHARSET_UTF8);

View file

@ -1,5 +1,7 @@
#include "WinFb.h"
#ifdef flagWINFB
NAMESPACE_UPP
#define LLOG(x) //DLOG(x)
@ -176,3 +178,5 @@ LRESULT CALLBACK fbWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
}
END_UPP_NAMESPACE
#endif

View file

@ -1,5 +1,7 @@
#include "WinFb.h"
#ifdef flagWINFB
NAMESPACE_UPP
#define LLOG(x) //DLOG(x)
@ -114,3 +116,5 @@ void FBFlush()
}
END_UPP_NAMESPACE
#endif