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


API Reference


Brew Release
Brew MP 1.0.2
See Also
Error Codes IWidget IModel IWidget_GetModel IModel_AddListener
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.
[in] Pointer to the IWidget object.
[in] Pointer to the model interface that the widget should use as the basis for accessing its data.
  •    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.
Side Effect
  • A EVT_MDL_SETMODEL event is sent through the ViewModel of the widget to indicate the change of model