Developer

API Reference

IDecorator_SetHandler()

Brew Release
Brew MP 1.0.2
Description
This function allows a decorator implementation to hook its own event handler into the normal event handling mechanism for decorators. For example, an object that derives from the base IDecorator Interface could insert its own event handler that will be called 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 decorator implementation. This pointer will be passed into the decorator's event handler with each event to be processed. The HandlerDesc data structure also contains a PFNFREEHANDLER that will be called when the decorator is released so that the decorator may free the private memory allocated and passed to the event handler.
IDecorator_SetHandler() associates a given HandlerDesc data structure with a particular decorator.
Parameters
  • p
    []:
    [in] A pointer to an IDecorator object.
  • pd
    []:
    [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 IDecorator_SetHandler(IDecorator *p, HandlerDesc *pd);
Return
None
Side Effect
None
Comment
Passing NULL for the HandlerDesc will reset the decorator'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 decorator to process events should itself remember to call HANDLERDESC_Call() so that the implementations that themselves derive from this decorator may also to hook into the decorator's event handler.
  • Follow