mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-01 17:19:36 +01:00
dockmanager example: made invisible controls dockable, they will become visible afterwards.
git-svn-id: trunk@24833 -
This commit is contained in:
parent
c720ac78ac
commit
39b5335283
@ -393,6 +393,7 @@ end;
|
|||||||
procedure NoteBookAdd(ABook: TCustomDockSite; AItem: TControl);
|
procedure NoteBookAdd(ABook: TCustomDockSite; AItem: TControl);
|
||||||
begin
|
begin
|
||||||
AItem.ManualDock(ABook);
|
AItem.ManualDock(ABook);
|
||||||
|
AItem.Visible := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TryRename(AComp: TComponent; const NewName: string): boolean;
|
function TryRename(AComp: TComponent; const NewName: string): boolean;
|
||||||
@ -635,7 +636,9 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
//some checks
|
//some checks
|
||||||
if (Control = nil) or (not Control.Visible) or (DropCtl = Control) then begin
|
if (Control = nil)
|
||||||
|
//or (not Control.Visible)
|
||||||
|
or (DropCtl = Control) then begin
|
||||||
//bug? The dock site is changed when a control is dropped onto itself!?
|
//bug? The dock site is changed when a control is dropped onto itself!?
|
||||||
DebugLn('Redock-----');
|
DebugLn('Redock-----');
|
||||||
exit; //nothing changed
|
exit; //nothing changed
|
||||||
@ -704,8 +707,8 @@ begin
|
|||||||
NewZone := TEasyZone.Create(self);
|
NewZone := TEasyZone.Create(self);
|
||||||
NewZone.ChildControl := Control as TControl;
|
NewZone.ChildControl := Control as TControl;
|
||||||
Control.Align := alNone;
|
Control.Align := alNone;
|
||||||
if Control is TCustomForm then
|
//is this still required?
|
||||||
TCustomForm(Control).BorderStyle := bsNone;
|
//if Control is TCustomForm then TCustomForm(Control).BorderStyle := bsNone;
|
||||||
|
|
||||||
//special case: in root zone (empty dock site)
|
//special case: in root zone (empty dock site)
|
||||||
|
|
||||||
@ -798,6 +801,7 @@ begin
|
|||||||
OldZone.Free;
|
OldZone.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Control.Visible := True;
|
||||||
ResetBounds(True); //splitters may have to be inserted
|
ResetBounds(True); //splitters may have to be inserted
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -944,6 +948,8 @@ begin
|
|||||||
DockSite.Invalidate;
|
DockSite.Invalidate;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Control.ManualDock(nil, nil, alNone); //do float
|
Control.ManualDock(nil, nil, alNone); //do float
|
||||||
|
{ TODO -cLCL : OnEndDock not called by ManualDock? }
|
||||||
|
TWinControlAccess(Control).DoEndDock(nil, Control.Left, Control.Top);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -10,5 +10,4 @@ object FloatingSite: TFloatingSite
|
|||||||
OnUnDock = FormUnDock
|
OnUnDock = FormUnDock
|
||||||
UseDockManager = True
|
UseDockManager = True
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
Visible = True
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,5 +4,5 @@ LazarusResources.Add('TFloatingSite','FORMDATA',[
|
|||||||
'TPF0'#13'TFloatingSite'#12'FloatingSite'#4'Left'#3#175#1#6'Height'#3#9#1#3'T'
|
'TPF0'#13'TFloatingSite'#12'FloatingSite'#4'Left'#3#175#1#6'Height'#3#9#1#3'T'
|
||||||
+'op'#3#242#1#5'Width'#3'y'#1#7'Caption'#6#12'FloatingSite'#8'DockSite'#9#7'O'
|
+'op'#3#242#1#5'Width'#3'y'#1#7'Caption'#6#12'FloatingSite'#8'DockSite'#9#7'O'
|
||||||
+'nClose'#7#9'FormClose'#10'OnDockDrop'#7#12'FormDockDrop'#8'OnUnDock'#7#10'F'
|
+'nClose'#7#9'FormClose'#10'OnDockDrop'#7#12'FormDockDrop'#8'OnUnDock'#7#10'F'
|
||||||
+'ormUnDock'#14'UseDockManager'#9#10'LCLVersion'#6#6'0.9.29'#7'Visible'#9#0#0
|
+'ormUnDock'#14'UseDockManager'#9#10'LCLVersion'#6#6'0.9.29'#0#0
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -243,7 +243,6 @@ var
|
|||||||
Res: TWinControlAccess absolute AForm;
|
Res: TWinControlAccess absolute AForm;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
AForm.Visible := True;
|
|
||||||
//check already dockable
|
//check already dockable
|
||||||
{ TODO -cdocking : problems with IDE windows:
|
{ TODO -cdocking : problems with IDE windows:
|
||||||
wrapping results in exceptions - conflicts with OnEndDock? }
|
wrapping results in exceptions - conflicts with OnEndDock? }
|
||||||
@ -258,7 +257,7 @@ begin
|
|||||||
Site := WrapDockable(AForm);
|
Site := WrapDockable(AForm);
|
||||||
AForm.EnableAlign;
|
AForm.EnableAlign;
|
||||||
end;
|
end;
|
||||||
//make visible, so that it can be docked without problems
|
//IDE?
|
||||||
if ForIDE and fWrap and assigned(Site) and assigned(Site.DockManager) then begin
|
if ForIDE and fWrap and assigned(Site) and assigned(Site.DockManager) then begin
|
||||||
Site.Invalidate;
|
Site.Invalidate;
|
||||||
end;
|
end;
|
||||||
@ -280,8 +279,9 @@ begin
|
|||||||
if AName <> '' then begin
|
if AName <> '' then begin
|
||||||
Result := Screen.FindForm(AName);
|
Result := Screen.FindForm(AName);
|
||||||
if Result <> nil then begin
|
if Result <> nil then begin
|
||||||
//if DisableUpdate then Result.DisableAutoSizing;
|
{$IFDEF ForceVisible}
|
||||||
Result.Visible := True; //empty edit book?
|
Result.Visible := True; //empty edit book?
|
||||||
|
{$ENDIF}
|
||||||
exit; //found it
|
exit; //found it
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -648,6 +648,8 @@ begin
|
|||||||
The name is split into basename and instance number.
|
The name is split into basename and instance number.
|
||||||
A component of T<basename> is created (and named AName - automatic!).
|
A component of T<basename> is created (and named AName - automatic!).
|
||||||
|
|
||||||
|
The form is not made visible by default.
|
||||||
|
|
||||||
Result type? (a TWinControl is sufficient as a DockSite)
|
Result type? (a TWinControl is sufficient as a DockSite)
|
||||||
*)
|
*)
|
||||||
//search existing forms
|
//search existing forms
|
||||||
@ -655,7 +657,9 @@ begin
|
|||||||
Result := Screen.FindForm(AName);
|
Result := Screen.FindForm(AName);
|
||||||
if Result <> nil then begin
|
if Result <> nil then begin
|
||||||
//if DisableUpdate then Result.DisableAlign;
|
//if DisableUpdate then Result.DisableAlign;
|
||||||
|
{$IFDEF ForceVisible}
|
||||||
Result.Visible := True; //empty edit book?
|
Result.Visible := True; //empty edit book?
|
||||||
|
{$ENDIF}
|
||||||
exit; //found it
|
exit; //found it
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -699,7 +703,7 @@ begin
|
|||||||
TryRename(Result, AName);
|
TryRename(Result, AName);
|
||||||
end;
|
end;
|
||||||
//if not DisableUpdate then Result.EnableAlign;
|
//if not DisableUpdate then Result.EnableAlign;
|
||||||
Result.Visible := True; //required for docking
|
//Result.Visible := True; //required for docking
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDockMaster.WrapDockable(Client: TControl): TFloatingSite;
|
function TDockMaster.WrapDockable(Client: TControl): TFloatingSite;
|
||||||
@ -716,7 +720,7 @@ begin
|
|||||||
*)
|
*)
|
||||||
if (csDestroying in Client.ComponentState)
|
if (csDestroying in Client.ComponentState)
|
||||||
or assigned(Client.HostDockSite) //already wrapped
|
or assigned(Client.HostDockSite) //already wrapped
|
||||||
or not Client.Visible //or force visible (below)?
|
//or not Client.Visible //or force visible (below)?
|
||||||
then
|
then
|
||||||
exit(nil); //do nothing with client under destruction!
|
exit(nil); //do nothing with client under destruction!
|
||||||
|
|
||||||
@ -729,9 +733,13 @@ begin
|
|||||||
r.Bottom := r.Top + Client.UndockHeight;
|
r.Bottom := r.Top + Client.UndockHeight;
|
||||||
Site.BoundsRect := r;
|
Site.BoundsRect := r;
|
||||||
//DebugLn('Before Wrap: ', DbgS(Site.BoundsRect));
|
//DebugLn('Before Wrap: ', DbgS(Site.BoundsRect));
|
||||||
//Site.Visible := True;
|
|
||||||
Client.Align := alNone;
|
Client.Align := alNone;
|
||||||
//Client.Visible := True; //otherwise docking may be rejected - see above
|
//retry make client auto-dockable
|
||||||
|
ctl.DragKind := dkDock;
|
||||||
|
ctl.DragMode := dmAutomatic;
|
||||||
|
{$IFDEF ForceVisible}
|
||||||
|
Client.Visible := True;
|
||||||
|
{$ENDIF}
|
||||||
Client.ManualDock(Site);
|
Client.ManualDock(Site);
|
||||||
//DebugLn('After Wrap: ', DbgS(Site.BoundsRect));
|
//DebugLn('After Wrap: ', DbgS(Site.BoundsRect));
|
||||||
|
|
||||||
@ -748,9 +756,10 @@ begin
|
|||||||
Site.Release;
|
Site.Release;
|
||||||
raise;
|
raise;
|
||||||
end;
|
end;
|
||||||
//retry make client auto-dockable
|
{//retry make client auto-dockable
|
||||||
ctl.DragKind := dkDock;
|
ctl.DragKind := dkDock;
|
||||||
ctl.DragMode := dmAutomatic;
|
ctl.DragMode := dmAutomatic;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDockMaster.DumpSites;
|
procedure TDockMaster.DumpSites;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user