Creating a Compound Component
Using the compound component system is highly application specific, so there are no hard and fast rules to creating a compound component. However, there are some general rules to consider.
The parent component is responsible for the positioning of sub-components within its designated rectangular area. The normal way to do this is to override SRGCompoundComponent::PassOneSetup() to position all the sub-components and perform a pass one draw to update all of the sizes but output no graphics. PassOneCleanup() then interrogates the sub-components and adjusts the final size and position of all sub-elements so that the final graphics can be produced. PassTwoSetup() repositions all the components for final drawing. Then the draw pass that actually generates the graphics takes place. PassTwoCleanup() performs housekeeping and deletes temporary storage.
Consider the depth to which compound components may be nested. Remember that they all have the potential to perform two-pass drawing unless programmed not to do so. This means that each nested compound component may be drawn many times for just one draw of the top-level parent. This can cause multiple overlaid graphics and a sharp decrease in speed. In the code, notice how the SRGCompoundDisplay uses the TopLevel setting, and how it and SRGAxisManager set up the passes of its sub-components.