CLayoutManagerRootBase::InitLayout

void CLayoutManagerRootBase::InitLayout(ILayoutNode* pRootNode)

Called as part of the layout logic initialization process. Overriding this method, a descendent class can set up a layout tree following its layout preferences.

Defined in: LayoutManager.h

Parameters

pRootNode

Pointer to the root node in the layout tree. If null, a root has not been set, so the override can go ahead and create one assigning it to the pRootNode parameter and calling the base class version of the method.

Comments

InitLayout() is called at the moment the layout manager gets initialized. That is as a response to the WM_CREATE message for normal windows or WM_INITDIALOG for dialog boxes.
A derived class should override InitLayout creating all the layout nodes for the layout algorithms the visible elements that should apply, and arranging them in a composite tree according to the layout logic.
The pRootNode parameter is the root node of the tree. If it is null, a root node has not been declared, so it should be the first step before any other node can be added to the tree.
Derived classes should always call the base class version of the routine, so the call can be routed all the way up to the CLayoutManagerRootBase version to finish up the initialization process.

Example

The following example shows a valid override of the InitLayoutFunction

virtual void CMyDerivedLayoutManager::InitLayout(ILayoutNode* pRootNode)
{
	pRootNode = CreateLayoutNode(__uuidof(foundation::CScaleLayout));
	pRootNode->ModifyNodeStyleEx(0, foundation::OptimizeRedraw, true);
	_LayoutManager::InitLayout(pRootNode); // Always delegate to the base class
}