mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 14:32:38 +02:00
LCL: Improved docking of coolbar/controlbar (more patches by Andrey Zubarev), Issue #32027
git-svn-id: trunk@55426 -
This commit is contained in:
parent
f2bb18cf26
commit
f06f1ef334
@ -543,6 +543,8 @@ type
|
||||
procedure DragMove(APosition: TPoint); virtual;abstract;
|
||||
procedure DragStop(ADrop: Boolean); virtual;abstract;
|
||||
|
||||
function IsCanBeStartDragging(Site: TWinControl; AThreshold: Integer; X,Y:Integer): boolean; virtual;abstract;
|
||||
|
||||
property DragImmediate: Boolean read FDragImmediate write FDragImmediate default True;
|
||||
property DragThreshold: Integer read FDragThreshold write FDragThreshold default 5;
|
||||
end;
|
||||
|
@ -508,9 +508,6 @@ procedure TCustomControlBar.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||
var aBand: TCtrlBand;
|
||||
aCursor: TCursorDesign;
|
||||
bDragging, bGrabber: Boolean;
|
||||
aRect: TRect;
|
||||
const
|
||||
cUserDragArea = 64;
|
||||
begin
|
||||
inherited MouseMove(Shift, X, Y);
|
||||
if FBandMove <> bmMoving then begin
|
||||
@ -528,9 +525,7 @@ begin
|
||||
FHoveredBand := nil;
|
||||
end;
|
||||
end else begin
|
||||
aRect := ClientRect;
|
||||
InflateRect(aRect, cUserDragArea, cUserDragArea);
|
||||
if PtInRect(aRect, Point(X, Y)) then begin
|
||||
if not DragManager.IsCanBeStartDragging(self,-1,X,Y) then begin
|
||||
MoveBand(FHoveredBand, X, Y, True);
|
||||
end else begin
|
||||
bDragging := False;
|
||||
|
@ -900,9 +900,6 @@ end;
|
||||
procedure TCustomCoolBar.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||
var aBand: Integer;
|
||||
aGrabber: Boolean;
|
||||
aRect: TRect;
|
||||
const
|
||||
cUserDragArea = 64;
|
||||
begin
|
||||
inherited MouseMove(Shift, X, Y);
|
||||
if length(FVisiBands) > 0 then begin
|
||||
@ -933,9 +930,7 @@ begin
|
||||
dbMove: begin
|
||||
if FDraggedBandIndex>-1 then begin
|
||||
Cursor := crDrag;
|
||||
aRect := ClientRect;
|
||||
InflateRect(aRect, cUserDragArea, cUserDragArea);
|
||||
if not PtInRect(aRect, Point(X, Y)) then
|
||||
if DragManager.IsCanBeStartDragging(self,-1,X,Y) then
|
||||
DragManager.DragStart(FVisiBands[FDraggedBandIndex].Control, True, -1, True);
|
||||
end;
|
||||
end;
|
||||
|
@ -99,6 +99,8 @@ type
|
||||
procedure DragMove(APosition: TPoint); override;
|
||||
procedure DragStop(ADropped: Boolean); override;
|
||||
|
||||
function IsCanBeStartDragging(Site: TWinControl; AThreshold: Integer; X,Y:Integer): boolean; override;
|
||||
|
||||
property StartPosition: TPoint read FStartPosition;
|
||||
end;
|
||||
|
||||
@ -829,5 +831,21 @@ begin
|
||||
DragStop(AIsDragging);
|
||||
end;
|
||||
|
||||
function TDragManagerDefault.IsCanBeStartDragging(Site: TWinControl; AThreshold: Integer; X,Y:Integer): boolean;
|
||||
var
|
||||
Threshold:integer;
|
||||
aRect:TRect;
|
||||
begin
|
||||
if AThreshold<=0 then
|
||||
Threshold:=DragThreshold
|
||||
else
|
||||
Threshold:=AThreshold;
|
||||
aRect := Site.ClientRect;
|
||||
InflateRect(aRect, Threshold, Threshold);
|
||||
if not PtInRect(aRect, Point(X, Y)) then
|
||||
Result:=true
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
//included by controls.pp
|
||||
|
@ -244,6 +244,10 @@ end;
|
||||
|
||||
function TToolBar.IsVertical: Boolean;
|
||||
begin
|
||||
if Assigned(Parent) then begin
|
||||
if (Parent is TCoolBar) then
|
||||
exit((Parent as TCoolBar).Vertical);
|
||||
end;
|
||||
if Align in [alNone, alClient, alCustom] then
|
||||
Result := Height > Width
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user