mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-29 05:02:46 +02:00
LCL: FindDockSiteAtPosition: prefer child before parent and prefer Screen higher Z order
git-svn-id: trunk@25783 -
This commit is contained in:
parent
ac6c79148a
commit
fb64f40660
@ -1020,7 +1020,7 @@ type
|
|||||||
property CustomForms[Index: Integer]: TCustomForm read GetCustomForms;
|
property CustomForms[Index: Integer]: TCustomForm read GetCustomForms;
|
||||||
property CustomFormZOrderCount: Integer read GetCustomFormZOrderCount;
|
property CustomFormZOrderCount: Integer read GetCustomFormZOrderCount;
|
||||||
property CustomFormsZOrdered[Index: Integer]: TCustomForm
|
property CustomFormsZOrdered[Index: Integer]: TCustomForm
|
||||||
read GetCustomFormsZOrdered;
|
read GetCustomFormsZOrdered; // lower index means on top
|
||||||
property DesktopHeight: Integer read GetDesktopHeight;
|
property DesktopHeight: Integer read GetDesktopHeight;
|
||||||
property DesktopWidth: Integer read GetDesktopWidth;
|
property DesktopWidth: Integer read GetDesktopWidth;
|
||||||
property FocusedForm: TCustomForm read FFocusedForm;
|
property FocusedForm: TCustomForm read FFocusedForm;
|
||||||
|
@ -352,15 +352,15 @@ procedure TDockPerformer.DragMove(APosition: TPoint);
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FindDockSiteAtPosition: TWinControl;
|
function FindDockSiteAtPosition: TWinControl;
|
||||||
//Replace with lookup in Application.Zorder(?)
|
//Replace with lookup in Screen.Zorder(?)
|
||||||
var
|
var
|
||||||
AControl: TWinControl;
|
AControl: TWinControl;
|
||||||
CanDock: Boolean;
|
CanDock: Boolean;
|
||||||
QualifyingSites: TList;
|
QualifyingSites: TList;
|
||||||
ARect: TRect;
|
ARect: TRect;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
j: Integer;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
|
||||||
@ -390,9 +390,30 @@ procedure TDockPerformer.DragMove(APosition: TPoint);
|
|||||||
|
|
||||||
if QualifyingSites.Count > 0 then
|
if QualifyingSites.Count > 0 then
|
||||||
begin
|
begin
|
||||||
Result := TWinControl(QualifyingSites[0]); //.GetTopSite; TODO!!!
|
// if a parent and a child has qualified remove the parent
|
||||||
//if not ValidDockTarget(Result) TODO!!!
|
for i:=QualifyingSites.Count-1 downto 0 do
|
||||||
//then Result := nil; TODO!!!
|
for j:=i+1 to QualifyingSites.Count-1 do
|
||||||
|
if TWinControl(QualifyingSites[i]).IsParentOf(TWinControl(QualifyingSites[j]))
|
||||||
|
then begin
|
||||||
|
QualifyingSites.Delete(i);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
i:=0;
|
||||||
|
if QualifyingSites.Count>1 then
|
||||||
|
begin
|
||||||
|
// there are multiple candidates => use the top level
|
||||||
|
for j:=0 to Screen.CustomFormZOrderCount-1 do begin
|
||||||
|
i:=QualifyingSites.Count-1;
|
||||||
|
while (i>=0)
|
||||||
|
and (GetParentForm(TWinControl(QualifyingSites[i]))<>Screen.CustomFormsZOrdered[j])
|
||||||
|
do
|
||||||
|
dec(i);
|
||||||
|
if i>=0 then break;
|
||||||
|
end;
|
||||||
|
if i<0 then i:=0;
|
||||||
|
end;
|
||||||
|
Result := TWinControl(QualifyingSites[i]);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
QualifyingSites.Free;
|
QualifyingSites.Free;
|
||||||
|
Loading…
Reference in New Issue
Block a user