mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Ctrl::GetMouseWorkArea() #725
git-svn-id: svn://ultimatepp.org/upp/trunk@7112 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
972873408c
commit
92b70f2111
8 changed files with 30 additions and 36 deletions
|
|
@ -1210,6 +1210,7 @@ public:
|
|||
static Rect GetPrimaryScreenArea();
|
||||
static void GetWorkArea(Array<Rect>& rc);
|
||||
static Rect GetWorkArea(Point pt);
|
||||
static Rect GetMouseWorkArea() { return GetWorkArea(GetMousePos()); }
|
||||
static int GetKbdDelay();
|
||||
static int GetKbdSpeed();
|
||||
static bool IsAlphaSupported();
|
||||
|
|
|
|||
|
|
@ -487,4 +487,16 @@ Ctrl& Ctrl::VCenterPosZ(int size, int delta) {
|
|||
return VCenterPos(VertLayoutZoom(size), VertLayoutZoom(delta));
|
||||
}
|
||||
|
||||
Rect Ctrl::GetWorkArea(Point pt)
|
||||
{
|
||||
GuiLock __;
|
||||
static Array<Rect> rc;
|
||||
if (rc.IsEmpty())
|
||||
GetWorkArea(rc);
|
||||
for(int i = 0; i < rc.GetCount(); i++)
|
||||
if(rc[i].Contains(pt))
|
||||
return rc[i];
|
||||
return GetPrimaryWorkArea();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -267,17 +267,6 @@ void Ctrl::GetWorkArea(Array<Rect>& rc)
|
|||
}
|
||||
}
|
||||
|
||||
Rect Ctrl::GetWorkArea(Point pt)
|
||||
{
|
||||
static Array<Rect> rc;
|
||||
if(rc.IsEmpty())
|
||||
GetWorkArea(rc);
|
||||
for(int i = 0; i < rc.GetCount(); i++)
|
||||
if(rc[i].Contains(pt))
|
||||
return rc[i];
|
||||
return GetPrimaryWorkArea();
|
||||
}
|
||||
|
||||
Rect Ctrl::GetVirtualWorkArea()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
|
|||
|
|
@ -1000,16 +1000,6 @@ Rect Ctrl::GetVirtualWorkArea()
|
|||
return out;
|
||||
}
|
||||
|
||||
Rect Ctrl::GetWorkArea(Point pt)
|
||||
{
|
||||
Array<Rect> rc;
|
||||
GetWorkArea(rc);
|
||||
for(int i = 0; i < rc.GetCount(); i++)
|
||||
if(rc[i].Contains(pt))
|
||||
return rc[i];
|
||||
return GetPrimaryWorkArea();
|
||||
}
|
||||
|
||||
Rect Ctrl::GetVirtualScreenArea()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
|
|||
|
|
@ -549,17 +549,6 @@ Rect Ctrl::GetWorkArea() const
|
|||
return GetPrimaryWorkArea();
|
||||
}
|
||||
|
||||
Rect Ctrl::GetWorkArea(Point pt)
|
||||
{
|
||||
static Array<Rect> rc;
|
||||
if (rc.IsEmpty())
|
||||
GetWorkArea(rc);
|
||||
for(int i = 0; i < rc.GetCount(); i++)
|
||||
if(rc[i].Contains(pt))
|
||||
return rc[i];
|
||||
return GetPrimaryWorkArea();
|
||||
}
|
||||
|
||||
Rect Ctrl::GetVirtualWorkArea()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
|
|||
|
|
@ -2567,6 +2567,19 @@ ryScreenArea]()&]
|
|||
in Windows is the display with start menu.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:GetWorkArea`(Point`):%- [@(0.0.255) static] [_^Rect^ Rect]_[* GetWorkArea]([_^Point^ P
|
||||
oint]_[*@3 pt])&]
|
||||
[s2; Returns the recangle of work area which contains [%-*@3 pt]. If
|
||||
[%-*@3 pt] does not belong to any area, returns the primary work
|
||||
area.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:GetMouseWorkArea`(`):%- [@(0.0.255) static] [_^Rect^ Rect]_[* GetMouseWorkArea
|
||||
]()&]
|
||||
[s2; Returns the work are which contains mouse cursor. Same as GetWorkArea(GetMousePo
|
||||
s()).&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:GetKbdDelay`(`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetKbdDelay]()&]
|
||||
[s2;b17;a17; Returns delay of keyboard before autorepeat starts when
|
||||
key is pressed.&]
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ void DisplayPopup::Sync()
|
|||
r.Inflate(1, 1);
|
||||
r.Offset(ctrl->GetScreenView().TopLeft());
|
||||
|
||||
Rect wa = GetWorkArea();
|
||||
Rect wa = GetWorkArea(r.BottomLeft());
|
||||
Size sz = r.GetSize();
|
||||
if(r.left < wa.left) {
|
||||
r.left = wa.left;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void ToolTip::Paint(Draw& w)
|
|||
void ToolTip::PopUp(Ctrl *owner, Point p, bool effect)
|
||||
{
|
||||
LLOG("ToolTip::PopUp" << Desc(owner) << " @ " << p);
|
||||
Rect r = owner->GetWorkArea();
|
||||
Rect r = GetMouseWorkArea();
|
||||
Size sz = GetMinSize();
|
||||
p.x = max(p.x + sz.cx > r.right ? r.right - sz.cx : p.x, r.left);
|
||||
p.y = max(p.y + sz.cy > r.bottom ? r.bottom - sz.cy : p.y, r.top);
|
||||
|
|
@ -73,7 +73,7 @@ void ShowToolTip()
|
|||
ToolTip& q = AppToolTip();
|
||||
q.Set(text);
|
||||
Size sz = q.GetMinSize();
|
||||
Rect r = top->GetWorkArea();
|
||||
Rect r = Ctrl::GetMouseWorkArea();
|
||||
Point p = GetMousePos() + Size(0, 22);
|
||||
if(p.y + sz.cy > r.bottom)
|
||||
p = GetMousePos() - Size(0, 22);
|
||||
|
|
@ -184,7 +184,7 @@ void QTFPopUp::PopUp(Ctrl *parent) {
|
|||
Rect r = Rect(0, 0, width, maxheight);
|
||||
GetFrame().FrameLayout(r);
|
||||
int cy = min(maxheight, GetHeight(r.Width()) + maxheight - r.Height());
|
||||
Rect area = GetWorkArea();
|
||||
Rect area = GetMouseWorkArea();
|
||||
Point p = GetMousePos();
|
||||
r.top = max(area.top, p.y + 16);
|
||||
r.bottom = r.top + cy;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue