LCL: Improved docking of coolbar/controlbar (patches by Andrey Zubarev), Issue #0032027

git-svn-id: trunk@55423 -
This commit is contained in:
wp 2017-07-02 08:27:15 +00:00
parent f76b44a7c6
commit 39d4577487
5 changed files with 20 additions and 6 deletions

View File

@ -539,7 +539,7 @@ type
function Dragging(AControl: TControl): boolean; virtual;abstract;
procedure RegisterDockSite(Site: TWinControl; DoRegister: Boolean); virtual;abstract;
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer);virtual;abstract;
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer; StartFromCurrentMouse:Boolean=False);virtual;abstract;
procedure DragMove(APosition: TPoint); virtual;abstract;
procedure DragStop(ADrop: Boolean); virtual;abstract;

View File

@ -278,7 +278,7 @@ begin
if assigned(AControl) and assigned(FOnBandDrag) then
FOnBandDrag(self, AControl, Result);
if Result then
DragManager.DragStart(AControl, True, -1);
DragManager.DragStart(AControl, True, -1, True);
end;
procedure TCustomControlBar.DragOver(Source: TObject; X, Y: Integer; State: TDragState;

View File

@ -936,7 +936,7 @@ begin
aRect := ClientRect;
InflateRect(aRect, cUserDragArea, cUserDragArea);
if not PtInRect(aRect, Point(X, Y)) then
DragManager.DragStart(FVisiBands[FDraggedBandIndex].Control, True, -1);
DragManager.DragStart(FVisiBands[FDraggedBandIndex].Control, True, -1, True);
end;
end;
end;

View File

@ -15,9 +15,18 @@
{ TCustomDockForm }
procedure TCustomDockForm.DoAddDockClient(Client: TControl; const ARect: TRect);
procedure FixClientPlacing(Client: TControl);
begin
Client.BorderSpacing.Left:=0;
Client.BorderSpacing.Right:=0;
Client.BorderSpacing.Top:=0;
Client.BorderSpacing.Bottom:=0;
Client.BorderSpacing.Around:=0;
end;
begin
inherited DoAddDockClient(Client, ARect);
Client.Align := alClient;
FixClientPlacing(Client);
if ([csLoading,csDestroying]*ComponentState=[]) then
Visible := True;
end;

View File

@ -95,7 +95,7 @@ type
procedure RegisterDockSite(Site: TWinControl; DoRegister: Boolean);override;
//The Drag and Drop routines
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer); override;
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer; StartFromCurrentMouse:Boolean=False); override;
procedure DragMove(APosition: TPoint); override;
procedure DragStop(ADropped: Boolean); override;
@ -595,6 +595,8 @@ begin
end
else
DragMsg := dmDragDrop;
ADockObjectCopy.Control.Top:=0;
ADockObjectCopy.Control.Left:=0;
SendDragMessage(ADockObjectCopy.DragTarget, DragMsg, ADockObjectCopy,
ADockObjectCopy.DragTarget, ADockObjectCopy.DragPos);
end;
@ -639,7 +641,7 @@ begin
Result := FPerformer.Dragging(AControl)
end;
procedure TDragManagerDefault.DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer);
procedure TDragManagerDefault.DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer; StartFromCurrentMouse:Boolean=False);
//Start a drag operation
begin
if FPerformer = nil then
@ -649,7 +651,10 @@ begin
else
FThresholdValue := DragThreshold;
FWaitForTreshold := not AImmediate;
GetCursorPos(FStartPosition);
if StartFromCurrentMouse then
FStartPosition:=AControl.ClientToScreen(point(0,0))
else
GetCursorPos(FStartPosition);
AControl.BeforeDragStart;