1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: odcbox.tex
%% Purpose: wxOwnerDrawnComboBox docs
%% Author: Jaakko Salli
%% Modified by:
%% Created:
%% RCS-ID: $Id: odcbox.tex 41905 2006-10-10 17:46:49Z JS $
%% Copyright: (c) Jaakko Salli
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxOwnerDrawnComboBox}}\label{wxownerdrawncombobox}
wxOwnerDrawnComboBox is a combobox with owner-drawn list items.
In essence, it is a \helpref{wxComboCtrl}{wxcomboctrl} with
\helpref{wxVListBox}{wxvlistbox} popup and \helpref{wxControlWithItems}{wxcontrolwithitems}
interface.
Implementing item drawing and measuring is similar to \helpref{wxVListBox}{wxvlistbox}.
Application needs to subclass wxOwnerDrawnComboBox and implement
\helpref{OnDrawItem()}{wxownerdrawncomboboxondrawitem}, \helpref{OnMeasureItem()}{wxownerdrawncomboboxonmeasureitem}
and \helpref{OnMeasureItemWidth()}{wxownerdrawncomboboxonmeasureitemwidth}.
\wxheading{Derived from}
\helpref{wxComboCtrl}{wxcomboctrl}\\
\helpref{wxControlWithItems}{wxcontrolwithitems}\\
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<odcombo.h>
\wxheading{Window styles}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxODCB\_DCLICK\_CYCLES}}{Double-clicking cycles item
if wxCB\_READONLY is also used. Synonymous with wxCC\_SPECIAL\_DCLICK.}
\twocolitem{\windowstyle{wxODCB\_STD\_CONTROL\_PAINT}}{Control itself is not
custom painted using OnDrawItem. Even if this style is not used, writable
wxOwnerDrawnComboBox is never custom painted unless SetCustomPaintWidth is
called.}
\end{twocollist}
See also \helpref{wxComboCtrl window styles}{wxcomboctrl} and
base \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event,
when an item on the list is selected. Note that calling
\helpref{GetValue}{wxcomboctrlgetvalue} returns the new value of selection.}
\end{twocollist}
See also events emitted by \helpref{wxComboCtrl}{wxcomboctrl}.
\wxheading{See also}
\helpref{wxComboCtrl}{wxcomboctrl}, \helpref{wxComboBox}{wxcombobox}, \helpref{wxVListBox}{wxvlistbox},
\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxOwnerDrawnComboBox::wxOwnerDrawnComboBox}\label{wxownerdrawncomboboxctor}
\func{}{wxOwnerDrawnComboBox}{\void}
Default constructor.
\func{}{wxOwnerDrawnComboBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{int}{ n = 0}, \param{const wxString }{choices[] = NULL},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
\func{}{wxOwnerDrawnComboBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value}, \param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size},\rtfsp
\param{const wxArrayString\& }{choices},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
Constructor, creating and showing a owner-drawn combobox.
\wxheading{Parameters}
\docparam{parent}{Parent window. Must not be NULL.}
\docparam{id}{Window identifier. A value of -1 indicates a default value.}
\docparam{value}{Initial selection string. An empty string indicates no selection.}
\docparam{pos}{Window position.}
\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized
appropriately.}
\docparam{n}{Number of strings with which to initialise the control.}
\docparam{choices}{An array of strings with which to initialise the control.}
\docparam{style}{Window style. See \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}.}
\docparam{validator}{Window validator.}
\docparam{name}{Window name.}
\wxheading{See also}
\helpref{wxOwnerDrawnComboBox::Create}{wxownerdrawncomboboxcreate}, \helpref{wxValidator}{wxvalidator}
\membersection{wxOwnerDrawnComboBox::\destruct{wxOwnerDrawnComboBox}}\label{wxownerdrawncomboboxdtor}
\func{}{\destruct{wxOwnerDrawnComboBox}}{\void}
Destructor, destroying the owner-drawn combobox.
\membersection{wxOwnerDrawnComboBox::Create}\label{wxownerdrawncomboboxcreate}
\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value}, \param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size},\rtfsp
\param{const wxArrayString\& }{choices},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
Creates the combobox for two-step construction. Derived classes
should call or replace this function. See
\helpref{wxOwnerDrawnComboBox::wxOwnerDrawnComboBox}{wxownerdrawncomboboxctor}\rtfsp
for further details.
\membersection{wxOwnerDrawnComboBox::GetWidestItem}\label{wxownerdrawncomboboxgetwidestitem}
\constfunc{int}{GetWidestItem}{\void}
Returns index to the widest item in the list.
\membersection{wxOwnerDrawnComboBox::GetWidestItemWidth}\label{wxownerdrawncomboboxgetwidestitemwidth}
\constfunc{int}{GetWidestItemWidth}{\void}
Returns width of the widest item in the list.
\membersection{wxOwnerDrawnComboBox::OnDrawBackground}\label{wxownerdrawncomboboxondrawbackground}
\constfunc{void}{OnDrawBackground}{\param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{item}, \param{int }{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.
\wxheading{Remarks}
\arg{flags} has the same meaning as with \helpref{OnDrawItem}{wxownerdrawncomboboxondrawitem}.
\membersection{wxOwnerDrawnComboBox::OnDrawItem}\label{wxownerdrawncomboboxondrawitem}
\constfunc{void}{OnDrawItem}{\param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{item}, \param{int }{flags}}
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.
\wxheading{Parameters}
\docparam{dc}{The device context to use for drawing}
\docparam{rect}{The bounding rectangle for the item being drawn (DC clipping
region is set to this rectangle before calling this function)}
\docparam{item}{The index of the item to be drawn}
\docparam{flags}{Combines any of the following flag values:}
\twocolwidtha{7cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\tt wxODCB\_PAINTING\_CONTROL}}{Combo control is being
painted, instead of a list item. Argument item may be wxNOT\_FOUND in this
case.}
\twocolitem{{\tt wxODCB\_PAINTING\_SELECTED}}{An item with selection
background is being painted. DC text colour should already be correct.}
\end{twocollist}
\membersection{wxOwnerDrawnComboBox::OnMeasureItem}\label{wxownerdrawncomboboxonmeasureitem}
\constfunc{wxCoord}{OnMeasureItem}{\param{size\_t }{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.
\membersection{wxOwnerDrawnComboBox::OnMeasureItemWidth}\label{wxownerdrawncomboboxonmeasureitemwidth}
\constfunc{wxCoord}{OnMeasureItemWidth}{\param{size\_t }{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.
|