1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxOwnerDrawnComboBox docs
4 %% Author: Jaakko Salli
8 %% Copyright: (c) Jaakko Salli
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxOwnerDrawnComboBox
}}\label{wxownerdrawncombobox
}
14 wxOwnerDrawnComboBox is a combobox with owner-drawn list items.
15 In essence, it is a
\helpref{wxComboCtrl
}{wxcomboctrl
} with
16 \helpref{wxVListBox
}{wxvlistbox
} popup and
\helpref{wxControlWithItems
}{wxcontrolwithitems
}
19 Implementing item drawing and measuring is similar to
\helpref{wxVListBox
}{wxvlistbox
}.
20 Application needs to subclass wxOwnerDrawnComboBox and implement
21 \helpref{OnDrawItem()
}{wxownerdrawncomboboxondrawitem
},
\helpref{OnMeasureItem()
}{wxownerdrawncomboboxonmeasureitem
}
22 and
\helpref{OnMeasureItemWidth()
}{wxownerdrawncomboboxonmeasureitemwidth
}.
25 \wxheading{Derived from
}
27 \helpref{wxComboCtrl
}{wxcomboctrl
}\\
28 \helpref{wxControlWithItems
}{wxcontrolwithitems
}\\
29 \helpref{wxControl
}{wxcontrol
}\\
30 \helpref{wxWindow
}{wxwindow
}\\
31 \helpref{wxEvtHandler
}{wxevthandler
}\\
32 \helpref{wxObject
}{wxobject
}
34 \wxheading{Include files
}
40 \helpref{wxAdv
}{librarieslist
}
42 \wxheading{Window styles
}
44 \begin{twocollist
}\itemsep=
0pt
45 \twocolitem{\windowstyle{wxODCB
\_DCLICK\_CYCLES}}{Double-clicking cycles item
46 if wxCB
\_READONLY is also used. Synonymous with wxCC
\_SPECIAL\_DCLICK.
}
47 \twocolitem{\windowstyle{wxODCB
\_STD\_CONTROL\_PAINT}}{Control itself is not
48 custom painted using OnDrawItem. Even if this style is not used, writable
49 wxOwnerDrawnComboBox is never custom painted unless SetCustomPaintWidth is
53 See also
\helpref{wxComboCtrl window styles
}{wxcomboctrl
} and
54 base
\helpref{window styles overview
}{windowstyles
}.
56 \wxheading{Event handling
}
59 \begin{twocollist
}\itemsep=
0pt
60 \twocolitem{{\bf EVT
\_COMBOBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_COMBOBOX\_SELECTED event,
61 when an item on the list is selected. Note that calling
62 \helpref{GetValue
}{wxcomboctrlgetvalue
} returns the new value of selection.
}
65 See also events emitted by
\helpref{wxComboCtrl
}{wxcomboctrl
}.
69 \helpref{wxComboCtrl
}{wxcomboctrl
},
\helpref{wxComboBox
}{wxcombobox
},
\helpref{wxVListBox
}{wxvlistbox
},
70 \rtfsp\helpref{wxCommandEvent
}{wxcommandevent
}
73 \latexignore{\rtfignore{\wxheading{Members
}}}
76 \membersection{wxOwnerDrawnComboBox::wxOwnerDrawnComboBox
}\label{wxownerdrawncomboboxctor
}
78 \func{}{wxOwnerDrawnComboBox
}{\void}
82 \func{}{wxOwnerDrawnComboBox
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
83 \param{const wxString\&
}{value = ``"
},
\param{const wxPoint\&
}{ pos = wxDefaultPosition
},
\param{const wxSize\&
}{ size = wxDefaultSize
},
\rtfsp
84 \param{int
}{ n =
0},
\param{const wxString
}{choices
[] = NULL
},
\rtfsp
85 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``comboBox"
}}
87 \func{}{wxOwnerDrawnComboBox
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
88 \param{const wxString\&
}{value
},
\param{const wxPoint\&
}{ pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
89 \param{const wxArrayString\&
}{choices
},
\rtfsp
90 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``comboBox"
}}
92 Constructor, creating and showing a owner-drawn combobox.
94 \wxheading{Parameters
}
96 \docparam{parent
}{Parent window. Must not be NULL.
}
98 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
100 \docparam{value
}{Initial selection string. An empty string indicates no selection.
}
102 \docparam{pos
}{Window position.
}
104 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then the window is sized
107 \docparam{n
}{Number of strings with which to initialise the control.
}
109 \docparam{choices
}{An array of strings with which to initialise the control.
}
111 \docparam{style
}{Window style. See
\helpref{wxOwnerDrawnComboBox
}{wxownerdrawncombobox
}.
}
113 \docparam{validator
}{Window validator.
}
115 \docparam{name
}{Window name.
}
119 \helpref{wxOwnerDrawnComboBox::Create
}{wxownerdrawncomboboxcreate
},
\helpref{wxValidator
}{wxvalidator
}
122 \membersection{wxOwnerDrawnComboBox::
\destruct{wxOwnerDrawnComboBox
}}\label{wxownerdrawncomboboxdtor
}
124 \func{}{\destruct{wxOwnerDrawnComboBox
}}{\void}
126 Destructor, destroying the owner-drawn combobox.
129 \membersection{wxOwnerDrawnComboBox::Create
}\label{wxownerdrawncomboboxcreate
}
131 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
132 \param{const wxString\&
}{value = ``"
},
\param{const wxPoint\&
}{ pos = wxDefaultPosition
},
\param{const wxSize\&
}{ size = wxDefaultSize
},
\rtfsp
133 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
134 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``comboBox"
}}
136 \func{bool
}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id
},
\rtfsp
137 \param{const wxString\&
}{value
},
\param{const wxPoint\&
}{ pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
138 \param{const wxArrayString\&
}{choices
},
\rtfsp
139 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``comboBox"
}}
141 Creates the combobox for two-step construction. Derived classes
142 should call or replace this function. See
143 \helpref{wxOwnerDrawnComboBox::wxOwnerDrawnComboBox
}{wxownerdrawncomboboxctor
}\rtfsp
147 \membersection{wxOwnerDrawnComboBox::GetWidestItem
}\label{wxownerdrawncomboboxgetwidestitem
}
149 \constfunc{int
}{GetWidestItem
}{\void}
151 Returns index to the widest item in the list.
154 \membersection{wxOwnerDrawnComboBox::GetWidestItemWidth
}\label{wxownerdrawncomboboxgetwidestitemwidth
}
156 \constfunc{int
}{GetWidestItemWidth
}{\void}
158 Returns width of the widest item in the list.
161 \membersection{wxOwnerDrawnComboBox::OnDrawBackground
}\label{wxownerdrawncomboboxondrawbackground
}
163 \constfunc{void
}{OnDrawBackground
}{\param{wxDC\&
}{dc
},
\param{const wxRect\&
}{rect
},
\param{int
}{item
},
\param{int
}{flags
}}
165 This method is used to draw the items background and, maybe, a border around it.
167 The base class version implements a reasonable default behaviour which consists
168 in drawing the selected item with the standard background colour and drawing a
169 border around the item if it is either selected or current.
173 \arg{flags
} has the same meaning as with
\helpref{OnDrawItem
}{wxownerdrawncomboboxondrawitem
}.
176 \membersection{wxOwnerDrawnComboBox::OnDrawItem
}\label{wxownerdrawncomboboxondrawitem
}
178 \constfunc{void
}{OnDrawItem
}{\param{wxDC\&
}{dc
},
\param{const wxRect\&
}{rect
},
\param{int
}{item
},
\param{int
}{flags
}}
180 The derived class may implement this function to actually draw the item
181 with the given index on the provided DC. If function is not implemented,
182 the item text is simply drawn, as if the control was a normal combobox.
184 \wxheading{Parameters
}
186 \docparam{dc
}{The device context to use for drawing
}
188 \docparam{rect
}{The bounding rectangle for the item being drawn (DC clipping
189 region is set to this rectangle before calling this function)
}
191 \docparam{item
}{The index of the item to be drawn
}
193 \docparam{flags
}{Combines any of the following flag values:
}
196 \begin{twocollist
}\itemsep=
0pt
197 \twocolitem{{\tt wxODCB
\_PAINTING\_CONTROL}}{Combo control is being
198 painted, instead of a list item. Argument item may be wxNOT
\_FOUND in this
200 \twocolitem{{\tt wxODCB
\_PAINTING\_SELECTED}}{An item with selection
201 background is being painted. DC text colour should already be correct.
}
205 \membersection{wxOwnerDrawnComboBox::OnMeasureItem
}\label{wxownerdrawncomboboxonmeasureitem
}
207 \constfunc{wxCoord
}{OnMeasureItem
}{\param{size
\_t }{item
}}
209 The derived class may implement this method to return the height of the
210 specified item (in pixels).
212 The default implementation returns text height, as if this control was
216 \membersection{wxOwnerDrawnComboBox::OnMeasureItemWidth
}\label{wxownerdrawncomboboxonmeasureitemwidth
}
218 \constfunc{wxCoord
}{OnMeasureItemWidth
}{\param{size
\_t }{item
}}
220 The derived class may implement this method to return the width of the
221 specified item (in pixels). If -
1 is returned, then the item text width
224 The default implementation returns -
1.