lcl: apply patch of Hans-Peter Diettrich (issue #0013034) - Missing dock manager notifications (with small my changes)

git-svn-id: trunk@18573 -
This commit is contained in:
paul 2009-02-05 02:06:26 +00:00
parent d0ff603108
commit 702dc11c4c
2 changed files with 28 additions and 17 deletions

View File

@ -1680,6 +1680,7 @@ type
procedure ReloadDockedControl(const AControlName: string;
var AControl: TControl); dynamic;
function CreateDockManager: TDockManager; dynamic;
procedure SetDockManager(AMgr: TDockManager);
procedure DoFloatMsg(ADockSource: TDragDockObject); override;//CM_FLOAT
procedure DoGetDockCaption(AControl: TControl; var ACaption: String); virtual;
protected
@ -1760,7 +1761,7 @@ type
property DefWndProc: Pointer read FDefWndProc write FDefWndPRoc;
property DockClientCount: Integer read GetDockClientCount;
property DockClients[Index: Integer]: TControl read GetDockClients;
property DockManager: TDockManager read FDockManager write FDockManager;
property DockManager: TDockManager read FDockManager write SetDockManager;
property DockSite: Boolean read FDockSite write SetDockSite default False;
property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered;
property Handle: HWND read GetHandle write SetHandle;

View File

@ -4288,8 +4288,8 @@ begin
end;
// paint controls
//DebugLn('[TWinControl.PaintHandler] ',DbgSName(Self),' PaintControls ...');
if FDockSite and FUseDockManager and Assigned(FDockManager) then
FDockManager.PaintSite(DC);
if FDockSite and FUseDockManager and Assigned(DockManager) then
DockManager.PaintSite(DC);
PaintControls(DC, nil);
finally
if TheMessage.DC = 0 then
@ -4753,8 +4753,8 @@ begin
Exit
else
begin
if FDockSite and FUseDockManager and Assigned(FDockManager) then
FDockManager.MouseMessage(Message);
if FDockSite and FUseDockManager and Assigned(DockManager) then
DockManager.MouseMessage(Message);
end;
{$IFDEF VerboseMouseBugfix}
DebugLn('TWinControl.WndPRoc B ',Name,':',ClassName);
@ -4772,8 +4772,8 @@ begin
CM_MOUSEENTER,
CM_MOUSELEAVE:
begin
if FDockSite and FUseDockManager and Assigned(FDockManager) then
FDockManager.MouseMessage(Message);
if FDockSite and FUseDockManager and Assigned(DockManager) then
DockManager.MouseMessage(Message);
end;
end;
@ -4905,11 +4905,20 @@ end;
------------------------------------------------------------------------------}
function TWinControl.CreateDockManager: TDockManager;
begin
if (FDockManager = nil) and DockSite and UseDockManager then
if (DockManager = nil) and DockSite and UseDockManager then
// this control can dock other controls, so it needs a TDockManager
Result := DefaultDockTreeClass.Create(Self)
else
Result := FDockManager;
Result := DockManager;
end;
procedure TWinControl.SetDockManager(AMgr: TDockManager);
begin
//use FDockManager only here!
if Assigned(DockManager) and (DockManager <> AMgr) then
if FDockManager.AutoFreeByControl then
FDockManager.Free;
FDockManager := AMgr; //can be nil
end;
{------------------------------------------------------------------------------
@ -4920,7 +4929,7 @@ begin
if FUseDockManager=AValue then exit;
FUseDockManager:=AValue;
if FUseDockManager and ([csDesigning,csDestroying]*ComponentState=[]) then
FDockManager := CreateDockManager;
DockManager := CreateDockManager;
end;
procedure TWinControl.DoFloatMsg(ADockSource: TDragDockObject);
@ -7008,11 +7017,11 @@ begin
if not NewDockSite then begin
FreeAndNil(FDockClients);
FDockClients := nil;
FDockManager := nil;
DockManager := nil;
end
else begin
if FDockClients = nil then FDockClients := TFPList.Create;
FDockManager := CreateDockManager;
DockManager := CreateDockManager;
end;
end;
end;
@ -7028,8 +7037,8 @@ begin
DisableAlign;
try
DragDockObject.Control.Dock(Self, DestRect);
if FUseDockManager and (FDockManager <> nil) then
FDockManager.InsertControl(DragDockObject.Control,
if FUseDockManager and (DockManager <> nil) then
DockManager.InsertControl(DragDockObject.Control,
DragDockObject.DropAlign, DragDockObject.DropOnControl);
finally
EnableAlign;
@ -7044,8 +7053,8 @@ function TWinControl.DoUnDockClientMsg(NewTarget, Client: TControl): boolean;
begin
Result := true;
DebugLn(['TWinControl.DoUnDockClientMsg ',DbgSName(Self),' ',DbgSName(Client),' ',DbgSName(Client.Parent)]);
if FUseDockManager and (FDockManager <> nil) then
FDockManager.RemoveControl(Client);
if FUseDockManager and (DockManager <> nil) then
DockManager.RemoveControl(Client);
end;
{------------------------------------------------------------------------------
@ -7107,7 +7116,8 @@ begin
' -> New=',Dbgs(Bounds(ALeft,ATop,AWidth,AHeight))]);
{$ENDIF}
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
//NewBounds:=Bounds(Left, Top, Width, Height);
if FUseDockManager and (DockManager <> nil) then
DockManager.ResetBounds(False);
finally
UnlockRealizeBounds;
end;