lcl: apply few comments related to docking from Hans-Peter Diettrich (issue #0013118)

git-svn-id: trunk@18625 -
This commit is contained in:
paul 2009-02-10 02:01:54 +00:00
parent b9db2f0fa6
commit e14c92e885
3 changed files with 35 additions and 1 deletions

View File

@ -451,6 +451,10 @@ type
{ TDockManager is an abstract class for managing a dock site's docked
controls. See TDockTree below for the more info.
}
{ TODO -cdocking : More (flexible) event handlers are required, for:
- all docking related messages, based on a TDragDockObject parameter
- changed visibility of docked controls (and more?)
}
TDockManager = class(TPersistent)
public
procedure BeginUpdate; virtual; abstract;
@ -3440,6 +3444,8 @@ end;
constructor TDragManager.Create(TheOwner: TComponent);
begin
{ TODO -cdocking : DragImmediate should apply to drag-drop only, while drag-dock never should start immediately
}
inherited Create(TheOwner);
FDragImmediate := True;
FDragThreshold := 5;

View File

@ -59,7 +59,7 @@ end;
Returns: Nothing
Starts the dragging of a control. If the Immediate flag is set, dragging
starts immediately.
starts immediately. A drag-dock should not normally start immediately!
------------------------------------------------------------------------------}
procedure TControl.BeginDrag(Immediate: Boolean; Threshold: Integer);
begin
@ -71,6 +71,11 @@ end;
------------------------------------------------------------------------------}
procedure TControl.BeginAutoDrag;
begin
{ TODO -cdocking : Automatic drag-dock never should start immediately.
A docked control should not try to undock itself, at least not immediately.
A docked control also should stay docked until it is really dropped into a different location,
so that a docking mangager can detect and handle (abort) an drop into the old place.
}
BeginDrag(DragManager.DragImmediate, DragManager.DragThreshold);
end;
@ -1313,6 +1318,8 @@ end;
procedure TControl.VisibleChanged;
begin
{ TODO -cdocking : For docked controls, the docking manager must receive a notification!
}
DoCallNotifyHandler(chtOnVisibleChanged);
end;
@ -3540,6 +3547,8 @@ begin
// undock from old HostSite
// - this only undocks from the DockManager
// - this control still uses the DockSite as parent control
{ TODO -cdocking : Combine with ManualFloat, for consistent handling
}
DebugLn('TControl.ManualDock UNDOCKING ',Name);
Result:=HostDockSite.DoUndock(NewDockSite,Self);
end;

View File

@ -3453,6 +3453,19 @@ function TWinControl.DoDragMsg(ADragMessage: TDragMessage; APosition: TPoint; AD
var
TargetControl: TControl;
begin
{ TODO -cdocking : All docking related messages should be handled here!
The base class (TControl) cannot be involved in docking, lacking an docking manager.
The messages could be sent immediately to the docking manager, if this is a dock site.
}
{ if ADocking and UseDockManger then //...we always have an DockManger!
DockManger.Dock/DragMsg(...)
//or:
case ADragMessage of
...
end
else //drag-drop
}
case ADragMessage of
dmFindTarget:
begin
@ -4856,6 +4869,12 @@ begin
if not Result then
Exit;
end;
{ TODO -cdocking : Also ask docking manager!
In case of a drop into the old location the undock operation should be aborted,
because then the docking manager (DragDockObject) would refer to an invalid (no more
existing) target.
}
if not KeepDockSiteSize then begin
NewBounds:=BoundsRect;
case Client.Align of