.\" This is a wxWidgets manpage page generated from the XML docs .TH wxVListBox 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxVListBox \- A listbox supporting variable height rows .SH DESCRIPTION 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 OnDrawItem() callback to draw them (so it is a Virtual listbox) and its items can have variable height as determined by OnMeasureItem() (so it is also a listbox with the lines of Variable height). Also, as a consequence of its virtual nature, it doesn't have any methods to append or insert items in it as it isn't necessary to do it: you just have to call SetItemCount() to tell the control how many items it should display. Of course, this also means that you will never use this class directly because it has pure virtual functions, but will need to derive your own class, such as wxHtmlListBox , from it. However it emits the same events as wxListBox and the same event macros may be used with it. .SH "PARENTS" wxVScrolledWindow .SH "INCLUDE FILES" wx/vlbox.h .SH MEMBERS .SS wxVListBox (wxWindow* parentwxWindowID id = wxID_ANYconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizesize_t countItems = 0long style = 0const wxString& name = wxVListBoxNameStr) Normal constructor which calls Create() internally. .SS wxVListBox () Default constructor, you must call Create() later. .SS void Clear () Deletes all items from the control. .SS bool Create (wxWindow* parentwxWindowID id = wxID_ANYconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = 0const wxString& name = wxVListBoxNameStr) Creates the control. To finish creating it you also should call SetItemCount() to let it know about the number of items it contains. The only special style which may be used with wxVListBox is wxLB_MULTIPLE which indicates that the listbox should support multiple selection. Returns true on success or false if the control couldn't be created .SS bool DeselectAll () .SS int GetFirstSelected (unsigned long& cookie) Returns the index of the first selected item in the listbox or wxNOT_FOUND if no items are currently selected. cookie is an opaque parameter which should be passed to the subsequent calls to GetNextSelected . It is needed in order to allow parallel iterations over the selected items. Here is a typical example of using these functions: unsigned long cookie; int item = hlbox->GetFirstSelected(cookie); while ( item != wxNOT_FOUND ) { ... process item ... item = hlbox->GetNextSelected(cookie); } This method is only valid for multi selection listboxes. .SS size_t GetItemCount () Get the number of items in the control. .SS wxPoint GetMargins () Returns the margins used by the control. The x field of the returned point is the horizontal margin and the y field is the vertical one. .SS int GetNextSelected (unsigned long& cookie) Returns the index of the next selected item or wxNOT_FOUND if there are no more. This method is only valid for multi selection listboxes. .SS size_t GetSelectedCount () Returns the number of the items currently selected. It is valid for both single and multi selection controls. In the former case it may only return 0 or 1 however. .SS int GetSelection () Get the currently selected item or -1 if there is no selection. .SS const wxColour& GetSelectionBackground () Returns the background colour used for the selected cells. By default the standard system colour is used. .SS bool HasMultipleSelection () Returns true if the listbox was created with wxLB_MULTIPLE style and so supports multiple selection or false if it is a single selection listbox. .SS bool IsCurrent (size_t item) Returns true if this item is the current one, 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 IsSelected but they are different for multi selection listboxes where many items may be selected but only one (at most) is current. .SS bool IsSelected (size_t item) Returns true if this item is selected, false otherwise. .SS void OnDrawBackground (wxDC& dcconst wxRect& rectsize_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. .SS void OnDrawItem (wxDC& dcconst wxRect& rectsize_t n) The derived class must implement this function to actually draw the item with the given index on the provided DC. .SS void OnDrawSeparator (wxDC& dcwxRect& rectsize_t n) This method may be used to draw separators between the lines. The rectangle passed to it may be modified, typically to deflate it a bit before passing to OnDrawItem() . The base class version of this method doesn't do anything. .SS wxCoord OnMeasureItem (size_t n) The derived class must implement this method to return the height of the specified item (in pixels). .SS bool Select (size_t itembool select = true) Selects or deselects the specified item which must be valid (i.e. not equal to wxNOT_FOUND ). Return true if the items selection status has changed or false otherwise. This function is only valid for the multiple selection listboxes, use SetSelection for the single selection ones. .SS bool SelectAll () .SS bool SelectRange (size_t fromsize_t to) .SS void SetItemCount (size_t count) Set the number of items to be shown in the control. This is just a synonym for wxVScrolledWindow::SetLineCount() . .SS void SetMargins (const wxPoint& pt) .SS void SetMargins (wxCoord xwxCoord y) Set the margins: horizontal margin is the distance between the window border and the item contents while vertical margin is half of the distance between items. By default both margins are 0. .SS void SetSelection (int selection) Set the selection to the specified item, if it is -1 the selection is 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. .SS void SetSelectionBackground (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 SetBackgroundColour . .SS void Toggle (size_t item) Toggles the state of the specified 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. .SH "SEE ALSO" wxVScrolledWindow .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.