wxownerdrawncomboboxwxownerdrawncombobox is a combobox with owner-drawn list items. in essence, it is a wxcomboctrl with wxvlistbox popup and wxcontrolwithitems interface. implementing item drawing and measuring is similar to wxvlistbox. application needs to subclass wxownerdrawncombobox and implement ondrawitem(), onmeasureitem() and onmeasureitemwidth(). derived from
wxcomboctrl include files <odcombo.h> window styles
see also wxcomboctrl window styles and base window styles overview. event handling
see also events emitted by wxcomboctrl. see also wxcomboctrl, wxcombobox, wxvlistbox, wxcommandevent members
wxownerdrawncombobox::wxownerdrawncombobox
wxownerdrawncombobox::wxownerdrawncomboboxwxownerdrawncombobox() default constructor. wxownerdrawncombobox(wxwindow* parent, wxwindowid id, const wxstring& value = "", const wxpoint& pos = wxdefaultposition, const wxsize& size = wxdefaultsize, int n = 0, const wxstring choices[] = null, long style = 0, const wxvalidator& validator = wxdefaultvalidator, const wxstring& name = "combobox") wxownerdrawncombobox(wxwindow* parent, wxwindowid id, const wxstring& value, const wxpoint& pos, const wxsize& size, const wxarraystring& choices, long style = 0, const wxvalidator& validator = wxdefaultvalidator, const wxstring& name = "combobox") constructor, creating and showing a owner-drawn combobox. parameters parent
id
value
pos
size
n
choices
style
validator
name
see also wxownerdrawncombobox::create, wxvalidator
wxownerdrawncombobox::~wxownerdrawncombobox~wxownerdrawncombobox() destructor, destroying the owner-drawn combobox.
wxownerdrawncombobox::createbool create(wxwindow* parent, wxwindowid id, const wxstring& value = "", const wxpoint& pos = wxdefaultposition, const wxsize& size = wxdefaultsize, int n, const wxstring choices[], long style = 0, const wxvalidator& validator = wxdefaultvalidator, const wxstring& name = "combobox") bool create(wxwindow* parent, wxwindowid id, const wxstring& value, const wxpoint& pos, const wxsize& size, const wxarraystring& choices, long style = 0, const wxvalidator& validator = wxdefaultvalidator, const wxstring& name = "combobox") creates the combobox for two-step construction. derived classes should call or replace this function. see wxownerdrawncombobox::wxownerdrawncombobox for further details.
wxownerdrawncombobox::getwidestitemint getwidestitem() const returns index to the widest item in the list.
wxownerdrawncombobox::getwidestitemwidthint getwidestitemwidth() const returns width of the widest item in the list.
wxownerdrawncombobox::ondrawbackgroundvoid ondrawbackground(wxdc& dc, const wxrect& rect, int item, int flags) const 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. remarks flags has the same meaning as with ondrawitem.
wxownerdrawncombobox::ondrawitemvoid ondrawitem(wxdc& dc, const wxrect& rect, int item, int flags) const the derived class may implement this function to actually draw the item with the given index on the provided dc. if function is not implemented, the item text is simply drawn, as if the control was a normal combobox. parameters dc
rect
item
flags
wxownerdrawncombobox::onmeasureitemwxcoord onmeasureitem(size_t item) const 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.
wxownerdrawncombobox::onmeasureitemwidthwxcoord onmeasureitemwidth(size_t item) const 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.
|