The ICnrDrawHandler class processes draw item and draw background events in the container.
To receive draw item events, you must do either of the following:
Similarly, to receive draw background events, you must do either of the following:
In addition, whenever you draw a container item or background, call IEvent::setResult(true) to prevent the system from drawing the item or background.
Create a handler derived from ICnrDrawHandler and attach it to the container whose foreground or background is to be drawn or to the container's owner window. You can do this by calling ICnrDrawHandler::handleEventsFor to pass the container or owner window to the container draw handler.
ICnrDrawHandler processes the following events in the container:
When the container draw handler receives one of these container draw events, the handler creates a corresponding event object and routes that object to the appropriate ICnrDrawHandler virtual function. You must override these virtual functions to supply your own specialized processing of a container draw event.
The return value from the virtual functions specifies whether the container draw event should be passed on for additional processing, as follows:
The Motif container does not support owner drawing. This handler is not called in this case.
The native Windows containers (that is, containers constructed without the pmCompatible style) do not support owner drawing. This handler is not called in this case.
You can destroy objects of this class. The only way to construct objects of this class is from a derived class. To enforce this, the only constructor we provide for this class is protected.
![]() |
public:
virtual ~ICnrDrawHandler()
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
protected:
ICnrDrawHandler()
Constructs instances of this class by using the default constructor, which does not accept any arguments.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
The Open Class Library dispatches events that have been sent or posted to a window to each of the handlers attached to that window. It does this by calling the event-dispatching function of each handler object.
![]() |
public:
virtual ICnrDrawHandler& handleEventsFor( IContainerControl* container )
Attaches the handler to the specified container control.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual ICnrDrawHandler& stopHandlingEventsFor( IContainerControl* container )
Detaches the handler from the specified container control.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
protected:
virtual bool dispatchHandlerEvent(IEvent& event)
If a container draw event is found, the appropriate virtual function is called.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
Event-processing members must be supplied by a derived class to provide processing for a draw event.
![]() |
public:
virtual bool drawBackground(ICnrDrawBackgroundEvent& event)
Called when the background of the container needs to be redrawn.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual bool drawDetailsItem(ICnrDrawItemEvent& event)
Called in the details view when the data of an object in a column needs to be redrawn. The emphasis of the data must be drawn during the processing of this event. This is also called when the details view column title needs to be redrawn. In this case, a call to ICnrDrawItemEvent::object() returns 0.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual bool drawIcon(ICnrDrawItemEvent& event)
Called when the icon in the icon or name view needs to be redrawn. The emphasis of the icon must be drawn during the processing of this event.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual bool drawText(ICnrDrawItemEvent& event)
Called when the text in the icon, name, or text view needs to be redrawn. The emphasis of the text must be drawn during the processing of this event.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual bool drawTitle(ICnrDrawItemEvent& event)
Called when the title of the container needs to be redrawn.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual bool drawTreeIcon(ICnrDrawItemEvent& event)
Called in the tree view when the "expand or collapse" icon needs to be redrawn.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
virtual IEventResult defaultProcedure(IEvent& event)
virtual bool dispatchHandlerEvent(IEvent& event) = 0