This unit defines TLazDockTree, the default TDockTree used in the LCL.

ldocktree.pas contains TLazDockTree, the default TDockTree used in the LCL.

This file is part of the Lazarus Component Library (LCL).

TLazDockZone - a zone for docking in a Lazarus form. Destructor for the class instance. Destroy is the overridden destructor for TLazDockZone, It calls FreeSubComponents to free resources allocated to Page, Pages, and Splitter. It calls the inherited destructor prior to exiting from the method. FreeSubComponents - frees and nils the local splitter and page/pages components, ready for destroying the control. GetCaption - if there is a child control, returns the caption for that control; else returns the Index of the control as a string value. GetParentControl - returns the identity of the Parent control if there is one; otherwise returns the Root zone if this is, in fact, the Root, or the Child control. The Splitter to be use to control the docking of this Zone. The Pages (as in a Notebook) included in the dock zone. A Page in the Notebook included in the Dock Zone. Record type used to track mouse position and button state in a dock header.

Used in the implementation of TLazDockTree and TLazDockForm.

Enumerated type with values representing the images used in a dock header. Image for the restore button in a dock header. Image for the close button in a dock header. Array type used to store bitmap images used in a dock header.

Elements in TDockHeaderImages can be accessed using the enumeration values in TDockHeaderImageKind. Used in the implementation of TLazDockTree and TLazDockForm.

TLazDockTree - a tree of TLazDockZones found in a docked window. AnchorDockLayout - sets up anchors between all docked controls and helper controls. CreateDockLayoutHelperControls - creates any splitters and pages needed for the dock layout, including recursive creation for child controls. ResetSizes - splits available size of Zone between children. BreakAnchors - detach the anchors of all child controls. PaintDockFrame - finds the cursor position and paints the dock frame of the specified size on the nominated canvas. UndockControlForDocking - frees anchors from parent and sibling controls. DefaultDockGrabberSize - returns the default size for the dock grabber. Create - constructor for TLazDockTree: creates a docking form if required, sets up a dock manager then calls inherited Create. Destroy - destructor for TLazDockTree: frees the dock site, annuls the Docksite manager, destroys any images then calls inherited Destroy. AdjustDockRect - offset one of the borders of control rect in order to get space for frame. InsertControl - undocks AControl and docks it into the tree.

InsertControl - undocks AControl and docks it into the tree.

It creates a new TDockZone for AControl and inserts it as a new leaf. It automatically changes the tree, so that the parent of the new TDockZone will have the Orientation for InsertAt.

Example 1:

A newly created TLazDockTree has only a DockSite (TLazDockForm) and a single TDockZone - the RootZone, which has as ChildControl the DockSite.

Visual:

+-DockSite--+ | | +-----------+

Tree of TDockZone:

RootZone (DockSite,doNoOrient)

Inserting the first control:

InsertControl(Form1,alLeft,nil);

Visual:

+-DockSite---+ |+--Form1---+| || || |+----------+| +------------+

Tree of TDockZone:

RootZone (DockSite,doHorizontal) +-Zone2 (Form1,doNoOrient)

Dock Form2 right of Form1:

InsertControl(Form2,alLeft,Form1);

Visual:

+-DockSite----------+ |+-Form1-+|+-Form2-+| || || || |+-------+|+-------+| +-------------------+

Tree of TDockZone:

RootZone (DockSite,doHorizontal) +-Zone2 (Form1,doNoOrient) +-Zone3 (Form2,doNoOrient)
RemoveControl - destroy child zone and all parents if they does not contain anything else, then removes the dock control. BuildDockLayout - breaks the current anchors, forms the appropriate helper controls then re-establishes the anchors. FindBorderControls - makes splitters for all bordering controls along the specified Side. Gets the control with the specified dock zone and anchor side.

Returns the DockSite if no controls are found using the specified zone and anchor side.

GetAnchorControl - find a control to anchor the Zone's Side. PaintSite - paint bounds for each control and close button (using the supplied handle). MessageHandler - checks the state of the mouse and takes the appropriate action. Checks whether redraw is needed because of mouse move or change in mouse button status, text needs to be added, etc. DumpLayout - writes layout of Zone to a file, for debugging purposes etc. AutoFreeDockSite - determines whether the dock site is free. Enumerated type representing the parts in a dock header. Total header rectangle. Header caption. Header restore button. Header close button. TLazDockForm - the default DockSite for a TLazDockTree and for TCustomAnchoredDockManager.

TLazDockForm - the default DockSite for a TLazDockTree and for TCustomAnchoredDockManager

Note: There are two docking managers: TLazDockTree uses TLazDockZone to allow docking in rows and columns. TCustomAnchoredDockManager does not use TLazDockZone and allows arbitrary layouts.

Notification - if the required operation is removal, sets MainControl to nil, then calls inherited Notification. TCustomForm.Notification UpdateMainControl - sets MainControl to a new value. MouseUp - calls inherited MouseUp then finds position and appropriate header. TControl.MouseUp MouseDown - performs inherited MouseDown, then finds position and appropriate header. TControl.MouseDown MouseMove - performs inherited MouseMove, then finds position and appropriate header. TControl.MouseMove MouseLeave - performs inherited MouseLeave, and sets the local store of position to indicate absence of the mouse. TControl.MouseLeave PaintWindow - calls inherited PaintWindow, then creates new canvas and handle at cursor position, inserts header caption, title and images. TCustomControl.PaintWindow TrackMouse - finds position of the mouse, which part of the control it occupies (whether header or main part of control), and state of buttons. Create - constructor for TLazDocForm: calls inherited Create, then fills in the header. TCustomForm.Create Owner of the object instance. Destroy - destructor for TLazDockForm: removes header then calls inherited Destroy. TCustomForm.Destroy CloseQuery - calls inherited method, then asks all top level forms if form can close. TCustomForm.CloseQuery UpdateCaption - brings caption up-to-date if there have been changes. UpdateMainControlInParents - make sure all parents recognize the presence of MainControl. FindMainControlCandidate - finds forms and controls in the docktree hierarchy that could act as the MainControl. FindHeader - identifies the part of the dock form that is the header, and returns a TControl. InsertControl - calls inherited method then updates the main control. TWinControl.InsertControl IsDockedControl - checks if control is a child, not a TLazDockSplitter and properly anchor docked; returns True if OK. ControlHasTitle - returns True if nominated control is visible, is a docked control and has a border spacing greater than zero. GetTitleRect - returns the coordinates of the title rectangle for the nominated control. GetTitleOrientation - returns the orientation (horizontal or vertical) of the title in the nominated control. The identity of the MainControl in the docked form (used for the default caption). TLazDockPage - an entity similar to a TLazDockForm, but forming a page in a notebook of TLazDockPages. InsertControl - calls inherited method, then ensures that all parents recognize the MainControl. TWinControl.InsertControl The DockZone in which this page is located. The PageControl or notebook in which this page is located (its parent). TLazDockPages a notebook in which each page is a TLazDockPage. GetFloatingDockSiteClass - returns a default class of TLazDockForm, overriding the inherited value. TControl.GetFloatingDockSiteClass Gets the TLazDockPage class type used as the page class for the tabbed control. TLazDockPage class type used for the page class. Change - calls inherited method, then ensures that all parents recognize MainControl. TCustomTabControl.Change Page - an individual TLazDockPage in the notebook, referred by its Index. TLazDockSplitter - a splitter used with Lazarus docking components. Create - constructor for TLazDockSplitter: calls inherited Create and initializes minimum size. TCustomSplitter.Create