Developer

API Reference

PFNDRAWHANDLER

Brew Release
Brew MP 1.0.2
See Also
- ICanvas Interface
- DrawHandlerDesc
- IDrawDecorator_SetDraw()
- DrawHandlerDesc_Call()
Description
This type definition specifies the prototype for the function pointer an application may register as the draw handler for a draw decorator widget. The draw handler allows an allocation to hook a custom drawing routine into the default draw operation normally invoked for a decorator. For example, an application could choose to enhance the display of a decorator by drawing a translucent winking eyeball in the background (ooooo! ahhhh!). This custom draw handler will be called by the draw decorator whenever the decorator is asked to draw itself. The handler is NOT intended to override and replace an object's normal draw handler. Rather, it is intended to perform additional drawing and should itself call DrawHandlerDesc_Call() to continue the chain of drawing operations.
The widgets framework will call the PFNDRAWHANDLER with the same parameters normally passed to IDecorator_Draw(), and additionally passes an additional parameter that identifies a pointer to private data owned and managed by the application, which the application provides to the draw decorator at the time the draw handler is registered.
Members
  • pCxt:      A pointer to private data allocated and managed by the caller that
                  has registered the draw handler with the draw decorator.  This data
                  pointer is passed into the draw handler, providing the callback with
                  access to this private storage.
  • piCanvas:  Pointer to the ICanvas interface that will provide drawing services
                  to the decorator.
  • x:         Horizontal position of the left side of the decorator, offset from
                  the left side of the ICanvas object.
  • y:         Vertical position of the top of the decorator, offset from the left
                  side of the ICanvas object
    
Definition
    typedef void (*PFNDRAWHANDLER)(void *pCxt, ICanvas *piCanvas, int x, int y);
Comment
The draw handler is registered with a draw decorator widget by initializing the 'pfn' field of a DrawHandlerDesc data structure and calling IDrawDecorator_SetDraw() to hook the draw handler into the decorator's normal drawing process. Upon registering the draw handler, IDrawDecorator_SetDraw() will return a pointer to a DrawHandlerDesc data structure that contains a pointer to the draw handler that would have been called had the new handler not been registered. The PFNDRAWHANDLER function should pass this DrawHandlerDesc pointer to the old draw handler when calling DrawHandlerDesc_Call() in order to ensure that normal decorator drawing still takes place.
  • Follow