wxImageComboBox API

Jaakko Salli jaakko.salli at pp.inet.fi
Sun Sep 3 08:09:46 PDT 2006


Hi all,

For the most part, I have now finished the control and
the widgets sample page. Here's the API briefly,
incase you want to have some changes done before I
write the documentation.

Constructors: Same as wxComboBox, so you can only set
  strings in them.

Item adding: Append and Insert, similar to
  wxControlWithItems except there is const wxBitmap&
  bitmap argument after string.

GetBitmap, SetBitmap: Are names fine? GetImage,
  SetImage are of course be alternatives, but might
  imply that the value is wxImage.

SetAutoResizeStyle(style): Controls how the combo box
  can grow in height, based on images used. I added
  this after noticing how MSW combo-with-images
  resizes the control to match height of images used.

  Supported styles:
    wxIMAGECOMBOBOX_RESIZE_NOT_ALLOWED
      Do not allow automatic resize. Added images may
      then be resized to fit the control, if
      necessary. This is the default value.
    wxIMAGECOMBOBOX_RESIZE_ALLOWED
      Allow automatic resize. Images added are not
      resized, so the height of control may grow
      (altough not growing is preferred).
    wxIMAGECOMBOBOX_RESIZE_ALWAYS
      Always resize the control to the height of
      largest image used.

SetMaxImageSize: Sets maximum size of images in
  list. Images larger than this are scaled down.
  Default maximum size is 64x64.

static GetMaxSupportedImageHeight: Returns maximum
  supported bitmap height. Generic version returns
  INT_MAX.

static CanDisplayImageInControl(style): Returns true
  if image can be shown in the control itself,
  depending on the style of control used (usually only
  wxCB_READONLY is relevant). Generic version
  obviously always returns true.

I have looked at and tested the MSW choice-with-images
patch that is currently in tracker, and I think that
the code it uses could be adapted to conform this API,
if necessary.

The MSW choice has indentation support however, which
wxOwnerDrawnComboBox doesn't have. Do you think it
would be a worthwhile addition?

In addition, MSW combo box seems to support a separate
selected image. Should generic version have this as
well?

Thanks,
  Jaakko






More information about the wx-dev mailing list