Recent

Author Topic: Docking basics  (Read 5408 times)

dodi

  • New Member
  • *
  • Posts: 25
Docking basics
« on: January 03, 2009, 04:32:29 pm »
Currently a dock site is organized in dock zones, which can contain a docked control, or other zones. Docked controls occupy only part of their zone, the zone's "client" area. The remainder of the zone can contain an header (grabber) part, splitter, frame etc.

When a zone is resized, both the zone and the contained control(s) should be resized at the same time. This means that a zone has to know how to adjust all of it's parts. The current implementation relies on protected members of the docking manager, related helper classes, global constants and variables and much more, what makes it hard to fix the remaining bugs in all these classes. Not to mention the implementation of other docking managers, which cannot access essential elements, because these are encapsulated in the Controls unit.

These requirements suggest to me that a TDockZone should be a component itself, which can contain other components of any type. Then it doesn't matter whether a zone contains other zones, a control, a form or a notebook - all these components know how to deal with a changed size. They also contain already the essential values, like their undocked size, visibility, orientation etc., which are required by the current implementation of the docking manager and dock zones. A docking manager then only reflects the containing dock site control, so that it can become a dedicated component itself, derived from a TPanel - or from a TForm, that can be used as a floating dock site immediately.

Else we have to answer the following questions about the current implementation:

What should happen on TDockZone.SetHeight/Width etc.? Should it resize an contained component, and how? Should it propagate the change to child zones? To parent zones? What if multiple coordinates change at the same time, because e.g. the entire dock site is resized?

How to store and retrieve the coordinates of a zone? When it contains a control, how to calculate the zone position and extent from the control's values? When it contains other zones, what should be stored (and when?), so that the proper Top/Left/Width/Height values can be known?

How to manage invisible docked controls, or when the visibility of a docked control changes? Do we have to rebuild the entire tree, because the zones cannot reflect such changes themselves? (I'd simply disallow for invisible controls in an tree, so that a zone is removed immediately, when its child control becomes invisible)

What shall happen on insertion or removal of a docked component? Is it really desireable to evenly resize all affected controls and zones? (Delphi only changes the origin and extent of the affected zone)


More questions will arise, depending on the answers and their influence on the other items...

DoDi

 

TinyPortal © 2005-2018