CtrlCore: Pen support

git-svn-id: svn://ultimatepp.org/upp/trunk@15896 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2021-04-04 21:40:39 +00:00
parent ef2333da1f
commit e83294f0a7
5 changed files with 9 additions and 12 deletions

View file

@ -71,7 +71,7 @@ void Ctrl::MiddleDrag(Point p, dword keyflags) {}
void Ctrl::MiddleHold(Point p, dword keyflags) {}
void Ctrl::MiddleUp(Point p, dword keyflags) {}
bool Ctrl::Pen(Point p, const PenInfo& pen, dword keyflags) { return false; }
void Ctrl::Pen(Point p, const PenInfo& pen, dword keyflags) {}
void Ctrl::Layout() {}
@ -608,7 +608,6 @@ Ctrl::Ctrl() {
popupgrab = false;
fullrefresh = false;
akv = false;
supports_pen = false;
}
void KillTimeCallbacks(void *id, void *idlim);

View file

@ -547,7 +547,6 @@ private:
static PenInfo pen;
static bool is_pen_event;
bool supports_pen;
static Vector<MouseHook>& mousehook();
static Vector<KeyHook>& keyhook();
@ -867,7 +866,7 @@ public:
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
virtual void MouseLeave();
virtual bool Pen(Point p, const PenInfo& pen, dword keyflags);
virtual void Pen(Point p, const PenInfo& pen, dword keyflags);
virtual void DragAndDrop(Point p, PasteClip& d);
virtual void FrameDragAndDrop(Point p, PasteClip& d);
@ -1544,7 +1543,7 @@ public:
virtual void LeftUp(Point, dword);
virtual void RightUp(Point, dword);
virtual void MouseMove(Point p, dword);
virtual bool Pen(Point p, const PenInfo &pn, dword);
virtual void Pen(Point p, const PenInfo &pn, dword);
virtual Image CursorImage(Point, dword);
virtual void Paint(Draw& w);

View file

@ -142,7 +142,6 @@ void Ctrl::ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword ke
Image Ctrl::MouseEvent(int event, Point p, int zdelta, dword keyflags)
{
LLOG("MouseEvent " << UPP::Name(this) << " " << FormatIntHex(event));
if(supports_pen && is_pen_event) return Image::Arrow(); // Avoid duplicated pen events
switch(event) {
case MOUSEENTER:
MouseEnter(p, keyflags);

View file

@ -166,7 +166,7 @@ Rect RectTracker::Round(const Rect& r)
return rounder ? rounder->Round(h) : h;
}
bool RectTracker::Pen(Point p, const PenInfo &pn, dword keyflags){
void RectTracker::Pen(Point p, const PenInfo &pn, dword keyflags){
switch(pn.action){
case 0:
if(!pn.history) MouseMove(p, keyflags);
@ -178,7 +178,6 @@ bool RectTracker::Pen(Point p, const PenInfo &pn, dword keyflags){
LeftUp(p, keyflags);
break;
}
return true;
}
void RectTracker::MouseMove(Point mp, dword){

View file

@ -139,12 +139,13 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
eventCtrl = this;
Ctrl *q = this;
if(captureCtrl){
q=captureCtrl;
p+=GetScreenRect().TopLeft()-captureCtrl->GetScreenRect().TopLeft();
q = captureCtrl;
p += GetScreenRect().TopLeft()-captureCtrl->GetScreenRect().TopLeft();
}
else for(Ctrl *t = q; t; t=q->ChildFromPoint(p)) q = t;
else
for(Ctrl *t = q; t; t=q->ChildFromPoint(p)) q = t;
q->supports_pen = q->Pen(p, pen, GetMouseFlags());
q->Pen(p, pen, GetMouseFlags());
SyncCaret();
Image m = CursorOverride();
if(IsNull(m)) SetMouseCursor(q->CursorImage(p,GetMouseFlags()));