lcl: fixed comments about TDockTree and TLazDockTree

This commit is contained in:
mattias 2023-02-17 19:57:09 +01:00
parent c1e41c6f96
commit 3d86c02c68
3 changed files with 82 additions and 77 deletions

View File

@ -2569,8 +2569,8 @@ type
{ TDockTree - a tree of TDockZones - Every docked window has one tree { TDockTree - a tree of TDockZones - Every docked window has one tree
This is an abstract class. This is a simple dockmanager, that allows to dock controls into others
A real implementation can be found for example in ldocktree.pas. using Align=alClient filling the whole client area.
Docking means here: Combining several windows to one. A window can here be Docking means here: Combining several windows to one. A window can here be
a TCustomForm or a floating control (undocked) or a TDockForm. a TCustomForm or a floating control (undocked) or a TDockForm.
@ -2578,78 +2578,10 @@ type
The docking source window will be resized, to fit to the docking target The docking source window will be resized, to fit to the docking target
window. window.
Example1: Docking "A" (source window) left to "B" (target window) A dockmanager supporting multiple controls per docksite aka a layout
can be found for example in ldocktree.pas.
+---+ +----+ A dockmanager supporting multiple controls with more flexible layout,
| A | -> | B | store and restore and more options can be found in package anchordocking.
+---+ | |
+----+
Result: A new docktree will be created. Height of "A" will be resized to
the height of "B".
A splitter will be inserted between "A" and "B".
And all three are children of the newly created TLazDockForm of the
newly created TDockTree.
+------------+
|+---+|+----+|
|| A ||| B ||
|| ||| ||
|+---+|+----+|
+------------+
If "A" or "B" were floating controls, the floating dock sites are freed.
If "A" or "B" were forms, their decorations (title bars and borders) are
replaced by docked decorations.
If "A" had a TDockTree, it is freed and its child dockzones are merged to
the docktree of "B". Analog for docking "C" left to "A":
+------------------+
|+---+|+---+|+----+|
|| C ||| A ||| B ||
|| ||| ||| ||
|+---+|+---+|+----+|
+------------------+
Example2: Docking A into B
+-----+
+---+ | |
| A | ---+-> B |
+---+ | |
+-----+
Result: A new docktree will be created. "A" will be resized to the size
of "B". Both will be put into a TLazDockPages control which is the
child of the newly created TDockTree.
+-------+
|[B][A] |
|+-----+|
|| ||
|| A ||
|| ||
|+-----+|
+-------+
Every DockZone has siblings and children. Siblings can either be
- horizontally (left to right, splitter),
- vertically (top to bottom, splitter)
- or upon each other (as pages, left to right).
InsertControl - undock control and dock it into the manager. For example
dock Form1 left to a Form2:
InsertControl(Form1,alLeft,Form2);
To dock "into", into a TDockPage, use Align=alNone.
PositionDockRect - calculates where a control would be placed, if it would
be docked via InsertControl.
RemoveControl - removes a control from the dock manager.
GetControlBounds - TODO for Delphi compatibility
ResetBounds - TODO for Delphi compatibility
SetReplacingControl - TODO for Delphi compatibility
PaintSite - TODO for Delphi compatibility
} }
TForEachZoneProc = procedure(Zone: TDockZone) of object; TForEachZoneProc = procedure(Zone: TDockZone) of object;

View File

@ -158,7 +158,7 @@ begin
//store result //store result
DockRect := r; DockRect := r;
debugln(['TDockTree.PositionDockRect ',dbgs(DockRect)]); //debugln(['TDockTree.PositionDockRect ',dbgs(DockRect)]);
end; end;
procedure TDockTree.RemoveControl(AControl: TControl); procedure TDockTree.RemoveControl(AControl: TControl);

View File

@ -14,8 +14,81 @@
Author: Mattias Gaertner Author: Mattias Gaertner
Abstract: Abstract:
This unit contains TLazDockTree, the default TDockTree for the LCL. This unit contains TLazDockTree, a more dockmanager supporting simple layouts.
Example1: Docking "A" (source window) left to "B" (target window)
+---+ +----+
| A | -> | B |
+---+ | |
+----+
Result: A new docktree will be created. Height of "A" will be resized to
the height of "B".
A splitter will be inserted between "A" and "B".
And all three are children of the newly created TLazDockForm of the
newly created TDockTree.
+------------+
|+---+|+----+|
|| A ||| B ||
|| ||| ||
|+---+|+----+|
+------------+
If "A" or "B" were floating controls, the floating dock sites are freed.
If "A" or "B" were forms, their decorations (title bars and borders) are
replaced by docked decorations.
If "A" had a TDockTree, it is freed and its child dockzones are merged to
the docktree of "B". Analog for docking "C" left to "A":
+------------------+
|+---+|+---+|+----+|
|| C ||| A ||| B ||
|| ||| ||| ||
|+---+|+---+|+----+|
+------------------+
Example2: Docking A into B
+-----+
+---+ | |
| A | ---+-> B |
+---+ | |
+-----+
Result: A new docktree will be created. "A" will be resized to the size
of "B". Both will be put into a TLazDockPages control which is the
child of the newly created TDockTree.
+-------+
|[B][A] |
|+-----+|
|| ||
|| A ||
|| ||
|+-----+|
+-------+
Every DockZone has siblings and children. Siblings can either be
- horizontally (left to right, splitter),
- vertically (top to bottom, splitter)
- or upon each other (as pages, left to right).
InsertControl - undock control and dock it into the manager. For example
dock Form1 left to a Form2:
InsertControl(Form1,alLeft,Form2);
To dock "into", into a TDockPage, use Align=alNone.
PositionDockRect - calculates where a control would be placed, if it would
be docked via InsertControl.
RemoveControl - removes a control from the dock manager.
GetControlBounds - TODO for Delphi compatibility
ResetBounds - TODO for Delphi compatibility
SetReplacingControl - TODO for Delphi compatibility
PaintSite - TODO for Delphi compatibility
} }
unit LDockTree; unit LDockTree;