Brew MP 1.0.2
This function allows a widget to associate itself with a specific model
interface. For example, a widget that wishes to mimic the behavior of an
FM radio tuner might wish to utilize source data from a model that provides
the frequency of the currently tuned station, so that it can display the
frequency and call letters ("...91.3 KCPR..."). The widget would first
retrieve an IModel
pointer for the desired interface class ID, then
associate this model with a widget by pass the model pointer and widget
pointer to IWidget_SetModel().
Once the widget has associated itself with a given model interface, it should
register as a listener for that model. As a listener, the widget will receive
notifications each time the model's data changes, thereby providing the
opportunity for the widget to update its display or act in some other meaning-
ful way to reflect the current data.
All provided widgets will send out an EVT_MDL_SETMODEL event
through their ViewModel when this function is called.
int IWidget_SetModel(IWidget *pif, IModel *pm);
AEE_SUCCESS : The function was able to successfully associate the widget
with the specified model interface.
AEE_ECLASSNOTSUPPORT : The model interface passed to the function does not support
a model interface class ID that is known to the widget.
For example, the button widget expects to be used with the
value model, and will verify that the model pointer in 'pm'
supports the value model class ID.
A EVT_MDL_SETMODEL event is sent through the ViewModel of the widget to indicate
the change of model