wxVListBox is a listbox-like control with the following two main differences
from a regular listbox: it can have an arbitrarily huge number of items because
-it doesn't store them itself but uses \helpref{OnDrawItem()}{wxvlistboxondrawitem}
+it doesn't store them itself but uses \helpref{OnDrawItem()}{wxvlistboxondrawitem}
callback to draw them (so it is a {\Large V}irtual listbox) and its items can
-have variable height as determined by
+have variable height as determined by
\helpref{OnMeasureItem()}{wxvlistboxonmeasureitem} (so it is also a listbox
with the lines of {\Large V}ariable height).
derive your own class, such as \helpref{wxHtmlListBox}{wxhtmllistbox}, from it.
However it emits the same events as \helpref{wxListBox}{wxlistbox} and the same
-event macros may be used with it.
-
+event macros may be used with it. Since wxVListBox does not store its items
+itself, the events will only contain the index, not any contents such as the
+string of an item.
+
\wxheading{Derived from}
-\helpref{wxVScrolledWindow}{wxvscrolledwindow}
+\helpref{wxVScrolledWindow}{wxvscrolledwindow}\\
+\helpref{wxPanel}{wxpanel}\\
+\helpref{wxWindow}{wxwindow}\\
+\helpref{wxEvtHandler}{wxevthandler}\\
+\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/vlbox.h>
+\wxheading{See also}
+
+\helpref{wxSimpleHtmlListBox}{wxsimplehtmllistbox}, \helpref{wxHtmlListBox}{wxhtmllistbox}
+
\latexignore{\rtfignore{\wxheading{Members}}}
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxVListBoxNameStr}}
-Creates the control. To finish creating it you also should call
+Creates the control. To finish creating it you also should call
\helpref{SetItemCount()}{wxvlistboxsetitemcount} to let it know about the
number of items it contains.
-The only special style which may be used with wxVListBox is {\tt wxLB\_MULTIPLE}
+The only special style which may be used with wxVListBox is {\tt wxLB\_MULTIPLE}
which indicates that the listbox should support multiple selection.
Returns {\tt true} on success or {\tt false} if the control couldn't be created
\constfunc{int}{GetFirstSelected}{\param{unsigned long\& }{cookie}}
-Returns the index of the first selected item in the listbox or
+Returns the index of the first selected item in the listbox or
{\tt wxNOT\_FOUND} if no items are currently selected.
-{\it cookie} is an opaque parameter which should be passed to the subsequent
+\arg{cookie} is an opaque parameter which should be passed to the subsequent
calls to \helpref{GetNextSelected}{wxvlistboxgetnextselected}. It is needed in
order to allow parallel iterations over the selected items.
\constfunc{wxPoint}{GetMargins}{\void}
Returns the margins used by the control. The {\tt x} field of the returned
-point is the horizontal margine and the {\tt y} field is the vertical one.
+point is the horizontal margin and the {\tt y} field is the vertical one.
\wxheading{See also}
\constfunc{int}{GetSelection}{\void}
-Get the currently selected item or $-1$ if there is no selection.
+Get the currently selected item or {\tt wxNOT\_FOUND} if there is no selection.
+
+
+\membersection{wxVListBox::GetSelectionBackground}\label{wxvlistboxgetselectionbackground}
+
+\constfunc{const wxColour\&}{GetSelectionBackground}{\void}
+
+Returns the background colour used for the selected cells. By default the
+standard system colour is used.
+
+\wxheading{See also}
+
+\helpref{wxSystemSettings::GetColour}{wxsystemsettingsgetcolour},\\
+\helpref{SetSelectionBackground}{wxvlistboxsetselectionbackground}
\membersection{wxVListBox::HasMultipleSelection}\label{wxvlistboxishasmultipleselection}
Returns {\tt true} if this item is the current one, {\tt false} otherwise.
Current item is always the same as selected one for the single selection
-listbox and in this case this method is equivalent to
+listbox and in this case this method is equivalent to
\helpref{IsSelected}{wxvlistboxisselected} but they are different for multi
selection listboxes where many items may be selected but only one (at most) is
current.
Returns {\tt true} if this item is selected, {\tt false} otherwise.
+\membersection{wxVListBox::OnDrawBackground}\label{wxvlistboxondrawbackground}
+
+\constfunc{void}{OnDrawBackground}{\param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{size\_t }{n}}
+
+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.
+
+
\membersection{wxVListBox::OnDrawItem}\label{wxvlistboxondrawitem}
\constfunc{void}{OnDrawItem}{\param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{size\_t }{n}}
Return {\tt true} if the items selection status has changed or {\tt false}
otherwise.
-This function is only valid for the multiple selection listboxes, use
+This function is only valid for the multiple selection listboxes, use
\helpref{SetSelection}{wxvlistboxsetselection} for the single selection ones.
\helpref{SelectAll}{wxvlistboxselectall}, \helpref{Select}{wxvlistboxselect}
+\membersection{wxVListBox::SetItemCount}\label{wxvlistboxsetitemcount}
\func{void}{SetItemCount}{\param{size\_t }{count}}
unset. The selected item will be automatically scrolled into view if it isn't
currently visible.
+This method may be used both with single and multiple selection listboxes.
+
+
+\membersection{wxVListBox::SetSelectionBackground}\label{wxvlistboxsetselectionbackground}
+
+\func{void}{SetSelectionBackground}{\param{const wxColour\& }{col}}
+
+Sets the colour to be used for the selected cells background. The background of
+the standard cells may be changed by simply calling
+\helpref{SetBackgroundColour}{wxwindowsetbackgroundcolour}.
+
+Notice that using non-default background colour may result in control having
+appearance different from the similar native controls and so should in general
+be avoided.
+
+\wxheading{See also}
+
+\helpref{GetSelectionBackground}{wxvlistboxgetselectionbackground}
+
\membersection{wxVListBox::Toggle}\label{wxvlistboxtoggle}
\func{void}{Toggle}{\param{size\_t }{item}}
-Toggles the state of the specified {\it item}, i.e. selects it if it was
+Toggles the state of the specified \arg{item}, i.e. selects it if it was
unselected and deselects it if it was selected.
This method is only valid for multi selection listboxes.