mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 11:40:29 +02:00
LCL: improved TControl.GetDockEdge
git-svn-id: trunk@25794 -
This commit is contained in:
parent
9094e47382
commit
08af96e2f0
@ -509,7 +509,7 @@ type
|
||||
procedure InsertControl(Control: TControl; InsertAt: TAlign;
|
||||
DropCtl: TControl); virtual; abstract; overload;
|
||||
procedure LoadFromStream(Stream: TStream); virtual; abstract;
|
||||
procedure PaintSite(DC: HDC); virtual; abstract;
|
||||
procedure PaintSite(DC: HDC); virtual;
|
||||
procedure MessageHandler(Sender: TControl; var Message: TLMessage); virtual;
|
||||
procedure PositionDockRect(ADockObject: TDragDockObject); virtual; overload;
|
||||
procedure PositionDockRect(Client, DropCtl: TControl; DropAlign: TAlign;
|
||||
@ -3792,6 +3792,11 @@ begin
|
||||
ADockObject.DropOnControl);
|
||||
end;
|
||||
|
||||
procedure TDockManager.PaintSite(DC: HDC);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TDockManager.MessageHandler(Sender: TControl; var Message: TLMessage
|
||||
);
|
||||
begin
|
||||
|
@ -167,29 +167,19 @@ var
|
||||
|
||||
procedure FindMinDistance(CurAlign: TAlign; CurDistance: integer);
|
||||
begin
|
||||
if CurDistance<0 then
|
||||
CurDistance:=-CurDistance;
|
||||
if CurDistance>=BestDistance then exit;
|
||||
Result:=CurAlign;
|
||||
BestDistance:=CurDistance;
|
||||
end;
|
||||
|
||||
begin
|
||||
// check if MousePos outside the control
|
||||
if MousePos.X<=0 then
|
||||
Result:=alLeft
|
||||
else if MousePos.Y<=0 then
|
||||
Result:=alTop
|
||||
else if MousePos.X>=Width then
|
||||
Result:=alRight
|
||||
else if MousePos.Y>=Height then
|
||||
Result:=alBottom
|
||||
else begin
|
||||
// MousePos is inside the control -> find nearest edge
|
||||
BestDistance:=MousePos.X;
|
||||
Result:=alLeft;
|
||||
FindMinDistance(alRight,Width-MousePos.X);
|
||||
FindMinDistance(alTop,MousePos.Y);
|
||||
FindMinDistance(alBottom,Height-MousePos.Y);
|
||||
end;
|
||||
BestDistance:=High(Integer);
|
||||
FindMinDistance(alLeft,MousePos.X);
|
||||
FindMinDistance(alRight,Width-MousePos.X);
|
||||
FindMinDistance(alTop,MousePos.Y);
|
||||
FindMinDistance(alBottom,Height-MousePos.Y);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user