anchordocking: IsFloating

git-svn-id: trunk@26175 -
This commit is contained in:
mattias 2010-06-18 20:16:13 +00:00
parent c047ffb4a5
commit 2b4356ce41
2 changed files with 20 additions and 3 deletions

View File

@ -437,6 +437,7 @@ type
function IsCustomSite(AControl: TControl): boolean; function IsCustomSite(AControl: TControl): boolean;
function GetSite(AControl: TControl): TAnchorDockHostSite; function GetSite(AControl: TControl): TAnchorDockHostSite;
function GetControl(Site: TControl): TControl; function GetControl(Site: TControl): TControl;
function IsFloating(AControl: TControl): Boolean;
function GetPopupMenu: TPopupMenu; function GetPopupMenu: TPopupMenu;
function AddPopupMenuItem(AName, ACaption: string; function AddPopupMenuItem(AName, ACaption: string;
const OnClickEvent: TNotifyEvent; AParent: TMenuItem = nil): TMenuItem; virtual; const OnClickEvent: TNotifyEvent; AParent: TMenuItem = nil): TMenuItem; virtual;
@ -1655,7 +1656,19 @@ begin
AnchorSite:=TAnchorDockHostSite(Site); AnchorSite:=TAnchorDockHostSite(Site);
if AnchorSite.SiteType=adhstOneControl then if AnchorSite.SiteType=adhstOneControl then
Result:=AnchorSite.GetOneControl; Result:=AnchorSite.GetOneControl;
end; end else if (Site<>nil) and (Site.HostDockSite is TAnchorDockHostSite)
and (TAnchorDockHostSite(Site.HostDockSite).SiteType=adhstOneControl) then
Result:=Site;
end;
function TAnchorDockMaster.IsFloating(AControl: TControl): Boolean;
begin
if AControl is TAnchorDockHostSite then
Result:=TAnchorDockHostSite(AControl).SiteType=adhstOneControl
else if (AControl.HostDockSite is TAnchorDockHostSite) then
Result:=TAnchorDockHostSite(AControl.HostDockSite).SiteType=adhstOneControl
else
Result:=AControl.Parent=nil;
end; end;
function TAnchorDockMaster.GetPopupMenu: TPopupMenu; function TAnchorDockMaster.GetPopupMenu: TPopupMenu;

View File

@ -214,19 +214,23 @@ var
NewDockSite: TAnchorDockHostSite; NewDockSite: TAnchorDockHostSite;
Site: TAnchorDockHostSite; Site: TAnchorDockHostSite;
AControl: TControl; AControl: TControl;
NeedPlacing: Boolean;
begin begin
debugln(['TIDEAnchorDockMaster.ShowForm ',DbgSName(AForm),' BringToFront=',BringToFront,' IsSite=',DockMaster.IsSite(AForm),' IsCustomSite=',DockMaster.IsCustomSite(AForm)]); debugln(['TIDEAnchorDockMaster.ShowForm START ',DbgSName(AForm),' BringToFront=',BringToFront,' IsSite=',DockMaster.IsSite(AForm),' IsCustomSite=',DockMaster.IsCustomSite(AForm)]);
try try
AForm.DisableAlign; AForm.DisableAlign;
NeedPlacing:=not AForm.IsVisible;
if not DockMaster.IsSite(AForm) then begin if not DockMaster.IsSite(AForm) then begin
// this form was not yet docked // this form was not yet docked
// => make it dockable // => make it dockable
DockMaster.MakeDockable(AForm,false); DockMaster.MakeDockable(AForm,false);
NeedPlacing:=true;
end; end;
AControl:=DockMaster.GetControl(AForm); AControl:=DockMaster.GetControl(AForm);
if (AControl<>nil) and (not AForm.IsVisible) and (AForm.Parent=nil) then begin debugln(['TIDEAnchorDockMaster.ShowForm AControl=',DbgSName(AControl),' NeedPlacing=',NeedPlacing,' Floating=',DockMaster.IsFloating(AForm)]);
if (AControl<>nil) and NeedPlacing and DockMaster.IsFloating(AForm) then begin
// this form is not yet on the screen and is not yet docked // this form is not yet on the screen and is not yet docked
debugln(['TIDEAnchorDockMaster.ShowForm placing ',DbgSName(AControl),' ...']); debugln(['TIDEAnchorDockMaster.ShowForm placing ',DbgSName(AControl),' ...']);