Developer

API Reference

IWidget_SetHandler()

Brew Release
Brew MP 1.0.2
See Also
HandlerDesc IWidget IWidget_HandleEvent IHandler_SetHandler PFNHANDLER PFNFREEHANDLER
Description
This function is inherited from IHandler_SetHandler().
This function allows a widget to hook its own event handler into the normal widget event handling mechanism. For example, a widget that derives from one of the standard widget interfaces could insert its own event handler that will be called by the base widget object each time an event is processed.
The event handler is stored in a HandlerDesc data structure as a PFNHANDLER, along with a pointer to a block of memory allocate and owned by the widget. This pointer will be passed into the widget's event handler with each event to be processed. The HandlerDesc data structure also contains a PFNFREEHANDLER that will be called when the widget is released so that the widget may free the private memory allocated and passed to the event handler.
IWidget_SetHandler() associates a given HandlerDesc data structure with a particular widget.
Parameters
  • pif
    []:
    [in] A pointer to an IWidget object.
  • pDesc
    []:
    [in] Pointer to the data structure that contains the event handler, private memory pointer, and the callback used to free the private memory.
Interface
Prototype
   void IWidget_SetHandler(IWidget *pif, HandlerDesc *pDesc);
Return
None
Side Effect
None
Comment
Passing NULL for the HandlerDesc will reset the widget's event handler to use the base widget's default event handler -- without private memory or the need to free privately allocated storage.
The handler installed by a widget to process events should itself remember to call HANDLERDESC_Call() so that widgets that themselves derive from this widget may also hook into the widget's event handler.
  • Follow