Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Containers

A container manages a collection of components that are used for a more complex view than a single widget offers. This view is made up of a combination of widgets, decorators, and child containers.

Widgets in a container can also be containers. A container keeps track of the layout of the widgets through their position and relative order and the currently focused widget. 

Widgets in a container are drawn from the bottom up, meaning that the bottom-most widget in the container is drawn first and the top-most widget is drawn last.  Though by default a newly inserted widget is inserted is added to the top of the stack, it is possible to insert a widget at any position in the container's stack.

A widget can be located:

  • Completely inside the container
  • Partially inside the container (the widget is clipped)
  • Completely outside of the container (the widget is not drawn)

Using containers

To get the widget form of a container, query the container form of the interface for an IWidget by calling IxxxContainer_QueryInterface(), passing the IWidget interface ID. For example:

IPropContainer_QueryInterface(myContainer, AEEIID_IWidget, 
            (void**)&myContainerWidget);

To use containers in an application:

  • Create an instance of a particular container by calling ISHELL_CreateInstance() with a ClassID of the container type (such as AEECLSID_CConstraintContainer, AEECLSID_CXYContainer, or AEECLSID_CCardContainer).
  • Query a widget interface from the container. This will allow the application to use the IWidget functions to set and get extent, border properties, background color, etc.
  • Insert the container's widget into a container that, up the hierarchy, leads to a root container to make sure that the container is displayed on the screen. To insert widgets in a container, the application should call IxxxContainer_Insert().
  • The IContainer functions can be used for manipulating the container, such as inserting a widget, invalidating, getting/removing a widget, etc.