CtrlCore: MacOS theoretical TopFrameDraw implementation (does not work because of MacOS issue)

git-svn-id: svn://ultimatepp.org/upp/trunk@14318 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-04-15 20:32:48 +00:00
parent 341da483c6
commit 045143e982
4 changed files with 14 additions and 10 deletions

View file

@ -66,7 +66,7 @@ private:
friend class ImageDraw;
friend class BackDraw;
friend class ViewDraw;
friend class TopFrameDraw;
friend struct BackDraw__;
public:
@ -174,3 +174,5 @@ friend struct MMImp;
};
#define GUIPLATFORM_INCLUDE_AFTER <CtrlCore/CocoAfter.h>
#define HAS_TopFrameDraw

View file

@ -1,7 +1,7 @@
class ViewDraw : public SystemDraw {
class TopFrameDraw : public SystemDraw {
public:
ViewDraw(Ctrl *ctrl);
~ViewDraw();
TopFrameDraw(Ctrl *ctrl, const Rect& r);
~TopFrameDraw();
};
Vector<WString>& coreCmdLine__();

View file

@ -396,22 +396,22 @@ void MMCtrl::SyncRect(CocoView *view)
view->ctrl->SetWndRect(MakeScreenRect([win screen], [win contentRectForFrameRect: [win frame]]));
}
ViewDraw::ViewDraw(Ctrl *ctrl)
TopFrameDraw::TopFrameDraw(Ctrl *ctrl, const Rect& r)
{
EnterGuiMutex();
ctrl = ctrl->GetTopCtrl();
ASSERT(ctrl->top->coco);
Rect tr = ctrl->GetTopCtrl()->GetScreenRect();
Rect r = ctrl->GetScreenView();
Rect tr = ctrl->GetScreenRect();
NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithWindow:ctrl->top->coco->window];
Init([gc CGContext], NULL);
CGContextTranslateCTM(cgHandle, 0, tr.GetHeight());
CGContextScaleCTM(cgHandle, 1, -1);
Clipoff(Rect(r.TopLeft() - tr.TopLeft(), r.GetSize()));
Clipoff(r);
}
ViewDraw::~ViewDraw()
TopFrameDraw::~TopFrameDraw()
{
End();
CGContextFlush(cgHandle);

View file

@ -675,6 +675,7 @@ private:
friend dword GetKeyStateSafe(dword what);
friend void CtrlSetDefaultSkin(void (*_skin)());
friend class DHCtrl;
friend class TopFrameDraw;
friend class ViewDraw;
friend class TopWindow;
friend class TrayIcon;
@ -1667,7 +1668,8 @@ T *Ctrl::GetAscendant() const
#ifdef HAS_TopFrameDraw
struct ViewDraw : public TopFrameDraw {
class ViewDraw : public TopFrameDraw {
public:
ViewDraw(Ctrl *ctrl, const Rect& r);
ViewDraw(Ctrl *ctrl) : ViewDraw(ctrl, ctrl->GetSize()) {}
ViewDraw(Ctrl *ctrl, int x, int y, int cx, int cy) : ViewDraw(ctrl, RectC(x, y, cx, cy)) {}