Objective Toolkit : Chapter 22 Docking Views : Docking Views Containment Model
Docking Views Containment Model
When a view is floating as an MDI child, the view is contained in an SECMDIChildWnd; in the same way that views in typical MDI applications are contained by CMDIChildWnd frames.
Figure 153 – Example Containment of a View as a MDI Child
However, when the view is docked, this containment relationship changes significantly. The view is actually re-parented to a new frame window called an SECDockableFrame. The SECDockableFrame acts as a godparent. It fulfills the MFC requirement that stipulates that only frames may contain CView classes. The SECDockableFrame is in turn parented by an SECFrameBar that is SECControlBar derived. In turn SECControlBar resides in one of the dock bars belonging to the main frame. During a docking operation, only the CView survives.
Figure 154 – Example Containment for a Docked View
When a view is floated outside the main frame, the containment relationship is similar to that of a docked view state.
Figure 155 – Example Containment for a Floating View
When a docked view becomes floated, a new SECFrameBar instance is created. In other words, this instance is not the same instance as when the frame was docked to the main frame. However, the SECDockableFrame instance does survive the transition from the docked state and remains the parent of the view. When the view is floated again as an MDI child, the SECFrameBar is undocked from the SECDockBar, both the SECDockableFrame and the SECFrameBar are destroyed, and the CView is re-parented to a newly instantiated SECMDIChildWnd. Again, note that during this transition from docked or floating to an MDI child state only the CView survives.