Borders and Edges

Border nodes are layout nodes that embellish the node they contain with some kind of graphic decoration around the area assigned to the contained node. Two kinds of border nodes are provided with SFL’s layout package: edges and grippers. All border nodes implement the specialized interface IBorderLayout.

An edge border is implemented in the CBorderEdge class. The border edge draws a 3-D border line around the node. The node can be configured to draw the line on any combination of the four borders of the contained node area.

Edge decoration

Gripper nodes display a gripper area either at the top (for vertical grippers) or at the left (for horizontal grippers) of the contained node. In addition, in the borders where a gripper is not drawn, blank space can be left to give an appearance of separation between distinct elements.

Gripper decoration

All border nodes implement IBorderLayout. This interface, which derives directly from ILayoutNode, publishes methods for setting or getting the size of the borders or the border orientation, and for showing or hiding the border decoration. The default implementation of this interface is provided in the CBorderLayoutBase template class.

Edges and grippers derive from a more specialized class, CBorderGraphic. CBorderGraphic derives from CBorderLayoutBase, but it is designed to use the class CDCLayoutBase as its base class. This allows the CBorderGraphic derivatives, like CBorderEdge and CGripperWrapper, to paint directly in the device context of the window associated with the root node of the layout tree.

To add a border wrapper to some interface element of your application (such as a window or image), you have to instantiate the appropriate border layout class and add the layout node associated with your interface element as the border node child. Adding a border wrapper to an interface element shows how to do this.

Adding a border wrapper to an interface element

pWrapper = CreateLayoutNode(__uuidof(CGripperWrapper), pWrapper);

pWrapper->Init(*this);

ILayoutNode* pListNode =

CreateLayoutNode(__uuidof(CWindowLayoutNode));

pListNode->Init(*this, m_wndList);

pWrapper->AddLayoutNode(pListNode);