mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-31 07:12:39 -06:00
CtrlCore: ViewDraw with Rect parameter in X11 and Gtk3 backends
git-svn-id: svn://ultimatepp.org/upp/trunk@14316 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3ae4a64e1a
commit
5760700aee
9 changed files with 46 additions and 18 deletions
|
|
@ -1081,4 +1081,16 @@ int Ctrl::GetExitCode() const
|
|||
return exitcode;
|
||||
}
|
||||
|
||||
#ifdef HAS_TopFrameDraw
|
||||
|
||||
ViewDraw::ViewDraw(Ctrl *ctrl, const Rect& r)
|
||||
: TopFrameDraw(ctrl, (ctrl->GetScreenView() & (r + ctrl->GetScreenView().TopLeft()))
|
||||
- ctrl->GetTopCtrl()->GetScreenRect().TopLeft())
|
||||
{
|
||||
Point p = r.TopLeft();
|
||||
Offset(min(p.x, 0), min(p.y, 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1665,6 +1665,16 @@ T *Ctrl::GetAscendant() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAS_TopFrameDraw
|
||||
|
||||
struct ViewDraw : public TopFrameDraw {
|
||||
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)) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
friend class ImageDraw;
|
||||
friend class BackDraw;
|
||||
friend class ViewDraw;
|
||||
friend class TopFrameDraw;
|
||||
|
||||
Rect GetClip() const;
|
||||
void FlushText();
|
||||
|
|
@ -210,3 +210,5 @@ int rmsecs();
|
|||
}
|
||||
|
||||
#define GUIPLATFORM_INCLUDE_AFTER <CtrlCore/GtkAfter.h>
|
||||
|
||||
#define HAS_TopFrameDraw
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
class ViewDraw : public SystemDraw {
|
||||
class TopFrameDraw : public SystemDraw {
|
||||
#if GTK_CHECK_VERSION(3, 22, 0)
|
||||
GdkDrawingContext *ctx;
|
||||
#endif
|
||||
public:
|
||||
ViewDraw(Ctrl *ctrl);
|
||||
~ViewDraw();
|
||||
TopFrameDraw(Ctrl *ctrl, const Rect& r);
|
||||
~TopFrameDraw();
|
||||
};
|
||||
|
||||
void DrawDragRect(Ctrl& q, const DrawDragRectInfo& f);
|
||||
|
|
|
|||
|
|
@ -516,15 +516,17 @@ Rect Ctrl::GetDefaultWindowRect()
|
|||
return RectC(r.left + pos + 20, r.top + pos + 20, cx, cy);
|
||||
}
|
||||
|
||||
ViewDraw::ViewDraw(Ctrl *ctrl)
|
||||
TopFrameDraw::TopFrameDraw(Ctrl *ctrl, const Rect& r)
|
||||
{
|
||||
EnterGuiMutex();
|
||||
Ctrl *top = ctrl->GetTopCtrl();
|
||||
#if GTK_CHECK_VERSION(3, 22, 0)
|
||||
cairo_rectangle_int_t r;
|
||||
r.x = r.y = 0;
|
||||
r.width = r.height = 100000;
|
||||
cairo_region_t *rg = cairo_region_create_rectangle(&r);
|
||||
cairo_rectangle_int_t rr;
|
||||
rr.x = Ctrl::LSC(r.left);
|
||||
rr.y = Ctrl::LSC(r.top);
|
||||
rr.width = Ctrl::LSC(r.GetWidth());
|
||||
rr.height = Ctrl::LSC(r.GetHeight());
|
||||
cairo_region_t *rg = cairo_region_create_rectangle(&rr);
|
||||
ctx = gdk_window_begin_draw_frame(top->gdk(), rg);
|
||||
cairo_region_destroy(rg);
|
||||
cr = gdk_drawing_context_get_cairo_context(ctx);
|
||||
|
|
@ -532,10 +534,10 @@ ViewDraw::ViewDraw(Ctrl *ctrl)
|
|||
cr = gdk_cairo_create(top->gdk());
|
||||
#endif
|
||||
cairo_scale(cr, Ctrl::LSC(1), Ctrl::LSC(1));
|
||||
Clipoff(ctrl->GetScreenView() - top->GetScreenRect().TopLeft());
|
||||
Clipoff(r);
|
||||
}
|
||||
|
||||
ViewDraw::~ViewDraw()
|
||||
TopFrameDraw::~TopFrameDraw()
|
||||
{
|
||||
FlushText();
|
||||
#if GTK_CHECK_VERSION(3, 22, 0)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ private:
|
|||
friend class ImageDraw;
|
||||
friend class FontInfo;
|
||||
friend class Font;
|
||||
friend class ViewDraw;
|
||||
friend class TopFrameDraw;
|
||||
|
||||
friend void StaticExitDraw_();
|
||||
friend Font StdFont();
|
||||
|
|
@ -259,4 +259,6 @@ Index<Atom>& _NET_Supported();
|
|||
|
||||
#define GUIPLATFORM_INCLUDE_AFTER "X11GuiA.h"
|
||||
|
||||
#define HAS_TopFrameDraw
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class ViewDraw : public SystemDraw {
|
||||
class TopFrameDraw : public SystemDraw {
|
||||
public:
|
||||
ViewDraw(Ctrl *ctrl);
|
||||
~ViewDraw();
|
||||
TopFrameDraw(Ctrl *ctrl, const Rect& r);
|
||||
~TopFrameDraw();
|
||||
|
||||
protected:
|
||||
bool caret;
|
||||
|
|
|
|||
|
|
@ -1115,11 +1115,10 @@ void Ctrl::SyncNativeWindows(void)
|
|||
|
||||
// 01/12/2007 - END
|
||||
|
||||
ViewDraw::ViewDraw(Ctrl *ctrl)
|
||||
TopFrameDraw::TopFrameDraw(Ctrl *ctrl, const Rect& r)
|
||||
{
|
||||
EnterGuiMutex();
|
||||
Ctrl *top = ctrl->GetTopCtrl();
|
||||
Rect r = ctrl->GetScreenView() - top->GetScreenRect().TopLeft();
|
||||
Vector<Rect> clip;
|
||||
clip.Add(r);
|
||||
dw = top->GetWindow();
|
||||
|
|
@ -1129,7 +1128,7 @@ ViewDraw::ViewDraw(Ctrl *ctrl)
|
|||
Init(clip, r.TopLeft());
|
||||
}
|
||||
|
||||
ViewDraw::~ViewDraw()
|
||||
TopFrameDraw::~TopFrameDraw()
|
||||
{
|
||||
XFreeGC(Xdisplay, gc);
|
||||
LeaveGuiMutex();
|
||||
|
|
|
|||
|
|
@ -382,6 +382,7 @@ class DrawPainter : public ImagePainter {
|
|||
|
||||
public:
|
||||
DrawPainter(Draw& w, Size sz, int mode = MODE_ANTIALIASED);
|
||||
DrawPainter(Draw& w, int cx, int cy, int mode = MODE_ANTIALIASED) : DrawPainter(w, Size(cx, cy), mode) {}
|
||||
~DrawPainter();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue