API Reference


Brew Release
Brew MP 1.0.2
This function allows objects such as widgets and UI controls to attach a listener to the given text model. The listener includes a callback function that BREW will call whenever the model has changed state, thereby notifying the owner of the listener that data has changed. This is especially convenient for text widgets, as a means of receiving notifications from BREW when the text entered into the control's edit region has been changed. To illustrate, consider a text entry widget into which the user enters the names of actors and actresses (again, using the "Six Degrees of Kevin Bacon" as an example). The widget itself is responsible for tracking key events and for displaying characters as they are entered, while the storage and subsequent notification of changes to the text would be managed by a text model. The text model would receive updates from the widget's controller, update the text stored in the text model, then send notifications out to any registered object -- in this case, the "name entry widget", which had previously registered as a listener for the text model by calling ITextModel_AddListener().
  • pif
    Pointer to the ITextModel interface object.
  • pl
    Pointer to the ModelListener that will be attached to the object. The ModelListener will contain the PFNLISTENER callback function BREW will call to notify the registering object of changes to the value model.
   int ITextModel_AddListener(ITextModel *pif, ModelListener *pl)
   AEE_SUCCESS          - Listener successfully added
   AEE_EBADPARM         - Invalid argument
   AEE_ENOMEMORY        - Insufficient memory
Side Effect
  • Follow