Package wx :: Module combo :: Class OwnerDrawnComboBox

[frames | no frames]

## Type OwnerDrawnComboBox

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                   Control --+
                             |
                     ComboCtrl --+
                                 |
                    object --+   |
                             |   |
                 ItemContainer --+
                                 |
                                OwnerDrawnComboBox

Known Subclasses:
  `BitmapComboBox`

wx.combo.OwnerDrawnComboBox is a combobox with owner-drawn list items. In essence, it is a `wx.combo.ComboCtrl` with a `wx.VListBox` popup and a `wx.ControlWithItems` API.

Implementing item drawing and measuring is similar to wx.VListBox. The application needs to subclass wx.combo.OwnerDrawnComboBox and implement the `OnDrawItem`, `OnMeasureItem` and `OnMeasureItemWidth` methods.

Method Summary
OwnerDrawnComboBox | ``__init__`(self, parent, id, value, pos, size, choices, style, validator, name)` Standard constructor.
bool | ``Create`(self, parent, id, value, pos, size, choices, style, validator, name)` Create the UI object, and other initialization.
int | ``GetWidestItem`(self)` Return the index of the widest item (recalculating it if necessary.)
int | ``GetWidestItemWidth`(self)` Return the widest item width (recalculating it if necessary.)
| ``OnDrawBackground`(self, dc, rect, item, flags)` This method is used to draw the items background and, maybe, a border around it.
| ``OnDrawItem`(self, dc, rect, item, flags)` The derived class may implement this function to actually draw the item with the given index on the provided DC.
int | ``OnMeasureItem`(self, item)` The derived class may implement this method to return the height of the specified item (in pixels).
int | ``OnMeasureItemWidth`(self, item)` The derived class may implement this method to return the width of the specified item (in pixels).
| `SetMark(self, from, to)`

Property Summary
| `thisown`: The membership flag

Class Variable Summary

Instance Method Details

### __init__(self, parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, choices=wxPyEmptyStringArray, style=0, validator=DefaultValidator, name=wxPyComboBoxNameStr)
(Constructor)

Standard constructor.

  Parameters:
    `parent`
    (type=Window)

    `id`
    (type=int)

    `value`
    (type=String)

    `pos`
    (type=Point)

    `size`
    (type=Size)

    `choices`
    (type=wxArrayString)

    `style`
    (type=long)

    `validator`
    (type=Validator)

    `name`
    (type=String)

  Returns:
    OwnerDrawnComboBox
  Overrides:
    `wx.combo.ComboCtrl.__init__`

### Create(self, parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, choices=wxPyEmptyStringArray, style=0, validator=DefaultValidator, name=wxPyComboBoxNameStr)

Create the UI object, and other initialization.

  Parameters:
    `parent`
    (type=Window)

    `id`
    (type=int)

    `value`
    (type=String)

    `pos`
    (type=Point)

    `size`
    (type=Size)

    `choices`
    (type=wxArrayString)

    `style`
    (type=long)

    `validator`
    (type=Validator)

    `name`
    (type=String)

  Returns:
    bool
  Overrides:
    `wx.Control.Create`

### GetWidestItem(self)

Return the index of the widest item (recalculating it if necessary.)

  Returns:
    int

### GetWidestItemWidth(self)

Return the widest item width (recalculating it if necessary.)

  Returns:
    int

### OnDrawBackground(self, dc, rect, item, flags)

This method is used to draw the items background and, maybe, a border around it.

The base class version implements a reasonable default behaviour which consists in drawing the selected item with the standard background colour and drawing a border around the item if it is either selected or current. `flags` has the sam meaning as with `OnDrawItem`.

  Parameters:
    `dc`
    (type=DC)

    `rect`
    (type=Rect)

    `item`
    (type=int)

    `flags`
    (type=int)

### OnDrawItem(self, dc, rect, item, flags)

The derived class may implement this function to actually draw the item with the given index on the provided DC. If this method is not overridden, the item text is simply drawn as if the control was a normal combobox.

  Parameters:
    `dc` - The device context to use for drawing.
    (type=DC)

    `rect` - The bounding rectangle for the item being drawn, the DC's clipping region is set to this rectangle before calling this method.
    (type=Rect)

    `item` - The index of the item to be drawn.
    (type=int)

    `flags` - `wx.combo.ODCB_PAINTING_CONTROL` (The Combo control itself is being painted, instead of a list item. The `item` parameter may be `wx.NOT_FOUND` in this case. `wx.combo.ODCB_PAINTING_SELECTED` (An item with selection background is being painted. The DC's text colour should already be correct.
    (type=int)

### OnMeasureItem(self, item)

The derived class may implement this method to return the height of the specified item (in pixels). The default implementation returns text height, as if this control was a normal combobox.

  Parameters:
    `item`
    (type=size_t)

  Returns:
    int

### OnMeasureItemWidth(self, item)

The derived class may implement this method to return the width of the specified item (in pixels). If -1 is returned, then the item text width is used. The default implementation returns -1.

  Parameters:
    `item`
    (type=size_t)

  Returns:
    int

Property Details

### thisown

The membership flag

  Get Method:
    unknown--1217727572(...)
  Set Method:
    unknown--1217727516(...)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:08:41 2007 | http://epydoc.sf.net