Version: 3.3.1
Loading...
Searching...
No Matches

#include <wx/vlbox.h>

+ Inheritance diagram for wxXRCPreviewVListBox:

Detailed Description

GUI editors, e.g., wxFormBuilder, typically allow users to lay out instances of controls.

However, wxVListBox is an abstract class, so a GUI editor can only create instances of a subclass of wxVListBox. Rather than require every GUI editor to repeat the work of subclassing wxVListBox for GUI editing, and because the user's intended subclass will not exist in GUI editors, provide a class that GUI editors can use. Also, the wxVListBoxXmlHandler can create instances of this class when in wxXRC_NO_SUBCLASSING mode;

Library:  wxCore
Category:  Controls
Since
3.3.0

Public Member Functions

 wxXRCPreviewVListBox ()
 Default constructor, you must call Create() later.
 
 wxXRCPreviewVListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxXRCPreviewVListBoxNameStr)
 Normal constructor which calls Create() internally.
 
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxXRCPreviewVListBoxNameStr)
 Creates the control.
 
- Public Member Functions inherited from wxVListBox
 wxVListBox ()
 Default constructor, you must call Create() later.
 
 wxVListBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxVListBoxNameStr)
 Normal constructor which calls Create() internally.
 
virtual ~wxVListBox ()
 Destructor.
 
void Clear ()
 Deletes all items from the control.
 
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxVListBoxNameStr)
 Creates the control.
 
bool DeselectAll ()
 Deselects all the items in the listbox.
 
int GetFirstSelected (unsigned long &cookie) const
 Returns the index of the first selected item in the listbox or wxNOT_FOUND if no items are currently selected.
 
size_t GetItemCount () const
 Get the number of items in the control.
 
wxPoint GetMargins () const
 Returns the margins used by the control.
 
wxRect GetItemRect (size_t item) const
 Returns the rectangle occupied by this item in physical coordinates.
 
int GetNextSelected (unsigned long &cookie) const
 Returns the index of the next selected item or wxNOT_FOUND if there are no more.
 
size_t GetSelectedCount () const
 Returns the number of the items currently selected.
 
int GetSelection () const
 Get the currently selected item or wxNOT_FOUND if there is no selection.
 
const wxColourGetSelectionBackground () const
 Returns the background colour used for the selected cells.
 
bool HasMultipleSelection () const
 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.
 
bool IsCurrent (size_t item) const
 Returns true if this item is the current one, false otherwise.
 
int GetCurrent () const
 Get the current item or wxNOT_FOUND if there is no current item.
 
void SetCurrent (int current)
 Set the specified item as the current item, if it is wxNOT_FOUND the current item is unset.
 
bool IsSelected (size_t item) const
 Returns true if this item is selected, false otherwise.
 
bool Select (size_t item, bool select=true)
 Selects or deselects the specified item which must be valid (i.e. not equal to wxNOT_FOUND).
 
bool SelectAll ()
 Selects all the items in the listbox.
 
bool SelectRange (size_t from, size_t to)
 Selects all items in the specified range which may be given in any order.
 
virtual void SetItemCount (size_t count)
 Set the number of items to be shown in the control.
 
void SetSelection (int selection)
 Set the selection to the specified item, if it is -1 the selection is unset.
 
void SetSelectionBackground (const wxColour &col)
 Sets the colour to be used for the selected cells background.
 
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.
 
void SetMargins (const wxPoint &pt)
 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.
 
void SetMargins (wxCoord x, wxCoord 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.
 

Additional Inherited Members

- Protected Member Functions inherited from wxVListBox
virtual void OnDrawItem (wxDC &dc, const wxRect &rect, size_t n) const =0
 The derived class must implement this function to actually draw the item with the given index on the provided DC.
 
virtual void OnDrawBackground (wxDC &dc, const wxRect &rect, size_t n) const
 This method is used to draw the item's background and, maybe, a border around it.
 
virtual void OnDrawSeparator (wxDC &dc, wxRect &rect, size_t n) const
 This method may be used to draw separators between the lines.
 
virtual wxCoord OnMeasureItem (size_t n) const =0
 The derived class must implement this method to return the height of the specified item (in pixels).
 

Constructor & Destructor Documentation

◆ wxXRCPreviewVListBox() [1/2]

wxXRCPreviewVListBox::wxXRCPreviewVListBox ( )

Default constructor, you must call Create() later.

◆ wxXRCPreviewVListBox() [2/2]

wxXRCPreviewVListBox::wxXRCPreviewVListBox ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
const wxString & name = wxXRCPreviewVListBoxNameStr )

Normal constructor which calls Create() internally.

Member Function Documentation

◆ Create()

bool wxXRCPreviewVListBox::Create ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
const wxString & name = wxXRCPreviewVListBoxNameStr )

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 wxXRCPreviewVListBox 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.