### IListBoxDrawItemHandler

  The IListBoxDrawItemHandler class processes list box draw-item events.
  Note: You must create the list box with the IListBox::drawItem style (see IListBox Styles for information about the drawItem style), or later call the function IBaseListBox::enableDrawItem.

  Create a handler derived from IListBoxDrawItemHandler and attach it to a list box or its owner window. You can do this by calling IListBoxDrawItemHandler::handleEventsFor.

  When the list box draw-item handler receives a list box draw-item event, it creates an IListBoxDrawItemEvent or IListBoxSizeItemEvent object and routes that object to the appropriate IListBoxDrawItemHandler virtual function. Override these virtual functions to supply your own specialized processing of a list box draw-item event. See IListBoxDrawItemEvent and IListBoxSizeItemEvent for information about these classes.

  The return value from the virtual functions specifies whether the list box draw-item event should be passed on for additional processing, as follows:

  true
    The list box draw-item event requires no additional processing. Do not pass it to another handler. The windowing system will not draw the item, although it can highlight or unhighlight the item based on the value returned by IListBoxDrawItemEvent::setSelectionStateDrawn.
  false
    The list box draw-item event requires additional processing. Pass the list box draw-item event to the next handler, as follows:
    - If there is another handler for the list box, pass the list box draw-item event to the next handler.
    - If this is the last handler for the list box, call the IWindow::dispatch function to dispatch the list box draw-item event to the list box's owner window. See dispatch for information about that function.
    - If this is the last handler for the owner window, call the IWindow::defaultProcedure function to process the list box draw-item event. See defaultProcedure for information about that function.

### IListBoxDrawItemHandler - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class.

~IListBoxDrawItemHandler

      public:
      virtual ~IListBoxDrawItemHandler()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

IListBoxDrawItemHandler

      public:
      IListBoxDrawItemHandler()

  The only way to construct an object of this class is to use the default constructor, which does not accept any arguments.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Event Dispatching

Use these members in the dispatching of events by the handler. These members evaluate events for potential processing or are used to attach the handler to a list box or its owner window.

handleEventsFor

  Attaches the handler to process item-drawing events for the specified window. You can attach the handler to a list box or to its owner window.

  Overload 1

      public:
      virtual IListBoxDrawItemHandler&
        handleEventsFor( IWindow* listBoxOwner )

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      virtual IListBoxDrawItemHandler&
        handleEventsFor( IListBox* listBox )

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

dispatchHandlerEvent

      protected:
      virtual bool dispatchHandlerEvent(IEvent& event)

  Calls the appropriate virtual function if a list box draw-item event is found.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Event Processing

Use these members to process specific requests in support of drawing a list box item. You can override these virtual members in a derived class.

deselectItem

      protected:
      virtual bool deselectItem(IListBoxDrawItemEvent& event)

  Called when a list box item is deselected. Override this function if you want to remove the highlight to indicate a list item has been deselected. Do this only if the system default method is unacceptable. To prevent the system default method from altering the item, call IListBoxDrawItemEvent::setSelectionStateDrawn, and return true.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

drawItem

      protected:
      virtual bool drawItem(IListBoxDrawItemEvent& event)

  Called when a list box item needs to be drawn or refreshed. Override this function to draw the list item. By default, the system applies selected-state emphasis (inverts the bits used to display the item) to indicate list-item selection. Unless the system default method is unacceptable, you do not have to draw the list item.

  If you draw the list item yourself, return true from this function. You can additionally control whether the windowing system draws any highlighting to indicate whether the item is selected. To prevent the system default method from altering the highlighting of the item, call IListBoxDrawItemEvent::setSelectionStateDrawn before returning true.

  The IListBoxDrawItemEvent class provides isSelected to query whether the list item is selected.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

selectItem

      protected:
      virtual bool selectItem(IListBoxDrawItemEvent& event)

  Called when a list box item is selected. Override this function if you want to draw the highlighting that indicates the list item has been selected. Do this only if the system default of inverting the bits for a selected item is unacceptable. To prevent the system default method from altering the item, call IListBoxDrawItemEvent::setSelectionStateDrawn and return true.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

setItemSize

      protected:
      virtual bool setItemSize(IListBoxSizeItemEvent& event)

  Called if any of the following occurs:

  - The list box is first created.
  - This handler is attached to a list box.
  - You call IBaseListBox::enableDrawItem.
  - Items are added or removed from the list box.
  Override this function to set the size needed to draw a list box item. All items in a list box have the same height. The width you specify is only used if the list box has a horizontal scroll bar.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### IListBoxDrawItemHandler - Inherited Member Functions and Data

#### Inherited Public Functions

  IHandler

  -     virtual ~IHandler()

  -     virtual IString asDebugInfo() const

  -     virtual IString asString() const

  -     virtual IHandler& disable()

  -     virtual IHandler& enable(bool enable = true)

  -     virtual IHandler& handleEventsFor(IWindow* window)

  -     IHandler()

  -     bool isEnabled() const

  -     virtual IHandler& stopHandlingEventsFor(IWindow* window)

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IHandler

  -     virtual IEventResult defaultProcedure(IEvent& event)

  -     virtual bool dispatchHandlerEvent(IEvent& event) = 0

#### Inherited Protected Data

  - None