API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
IInterfaceModel is inherited from the IModel interface and is used as a shim for objects that wish to model data stored in an interface that lacks a formal query interface. Use of the IInterfaceModel also ensures strict data type enforcement on the data stored in the model interface (where the IValueModel interface would not). This is particularly important for standard BREW data types. For example, the bitmap and image widgets rely on their native BREW interfaces (IBitmap and IImage, respectively) for storing data. However, neither of these interfaces support a query interface. Thus, changes to the data stored in these objects may be funneled through IInterfaceModel.
IInterfaceModel provides object reference counting mechanisms that allow objects to manage their own memory instances. In addition, the interface provides APIs for registering a listener with a value model, as well as interfaces for manipulating the interface reference information stored in the model.

InterfaceModels are used as a wrapper around objects that do not support a query interface. One possible use for this would be to insert a bitmap into an image widget. This example details the retrieval of a bitmap (pib) that has already been inserted into the widget (piw).
   IInterfaceModel *piim = NULL;
   // Get the current bitmap from the widget.  It is stored via an interface model.
   nErr = IWidget_GetModel(me->piw, AEEIID_InterfaceModel, (IModel**)&piim);
   if (nErr != AEE_SUCCESS) {
      // Perform cleanup
   nErr = IInterfaceModel_GetIPtr(piim, AEECLSID_Bitmap, (void**)&pib);
   if (nErr != AEE_SUCCESS) {
      // Perform cleanup
   // Do wonderful and magical things with the bitmap you got out of the Widget
   // through the interface model.