Version: 3.0.2
wxPGChoices Class Reference

#include <wx/propgrid/property.h>

Detailed Description

Helper class for managing choices of wxPropertyGrid properties.

Each entry can have label, value, bitmap, text colour, and background colour.

wxPGChoices uses reference counting, similar to other wxWidgets classes. This means that assignment operator and copy constructor only copy the reference and not the actual data. Use Copy() member function to create a real copy.

Remarks
If you do not specify value for entry, index is used.

Library:  wxPropertyGrid
Category:  wxPropertyGrid

Public Types

typedef long ValArrItem
 

Public Member Functions

 wxPGChoices ()
 Default constructor.
 
 wxPGChoices (const wxPGChoices &a)
 Copy constructor, uses reference counting.
 
 wxPGChoices (const wxChar **labels, const long *values=NULL)
 Constructor.
 
 wxPGChoices (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt())
 Constructor.
 
 wxPGChoices (wxPGChoicesData *data)
 Constructor.
 
 ~wxPGChoices ()
 Destructor.
 
void Add (const wxChar **labels, const ValArrItem *values=NULL)
 Adds to current.
 
void Add (const wxArrayString &arr, const wxArrayInt &arrint)
 Version that works with wxArrayString and wxArrayInt.
 
wxPGChoiceEntry & Add (const wxString &label, int value=wxPG_INVALID_VALUE)
 Adds single item.
 
wxPGChoiceEntry & Add (const wxString &label, const wxBitmap &bitmap, int value=wxPG_INVALID_VALUE)
 Adds a single item, with bitmap.
 
wxPGChoiceEntry & Add (const wxPGChoiceEntry &entry)
 Adds a single item with full entry information.
 
wxPGChoiceEntry & AddAsSorted (const wxString &label, int value=wxPG_INVALID_VALUE)
 Adds single item, sorted.
 
void Assign (const wxPGChoices &a)
 Assigns choices data, using reference counting.
 
void AssignData (wxPGChoicesData *data)
 Assigns data from another set of choices.
 
void Clear ()
 Deletes all items.
 
wxPGChoices Copy () const
 Returns a real copy of the choices.
 
const wxStringGetLabel (unsigned int ind) const
 Returns label of item.
 
unsigned int GetCount () const
 Returns number of items.
 
int GetValue (unsigned int ind) const
 Returns value of item;.
 
wxArrayInt GetValuesForStrings (const wxArrayString &strings) const
 Returns array of values matching the given strings.
 
wxArrayInt GetIndicesForStrings (const wxArrayString &strings, wxArrayString *unmatched=NULL) const
 Returns array of indices matching given strings.
 
int Index (const wxString &label) const
 Returns index of item with given label.
 
int Index (int val) const
 Returns index of item with given value.
 
wxPGChoiceEntry & Insert (const wxString &label, int index, int value=wxPG_INVALID_VALUE)
 Inserts single item.
 
wxPGChoiceEntry & Insert (const wxPGChoiceEntry &entry, int index)
 Inserts a single item with full entry information.
 
bool IsOk () const
 Returns false if this is a constant empty set of choices, which should not be modified.
 
const wxPGChoiceEntry & Item (unsigned int i) const
 Returns item at given index.
 
wxPGChoiceEntry & Item (unsigned int i)
 Returns item at given index.
 
void RemoveAt (size_t nIndex, size_t count=1)
 Removes count items starting at position nIndex.
 
void Set (const wxChar **labels, const long *values=NULL)
 Sets contents from lists of strings and values.
 
void Set (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt())
 Sets contents from lists of strings and values.
 
void AllocExclusive ()
 Creates exclusive copy of current choices.
 
wxArrayString GetLabels () const
 Returns array of choice labels.
 
void operator= (const wxPGChoices &a)
 
wxPGChoiceEntry & operator[] (unsigned int i)
 
const wxPGChoiceEntry & operator[] (unsigned int i) const
 

Member Typedef Documentation

Constructor & Destructor Documentation

wxPGChoices::wxPGChoices ( )

Default constructor.

wxPGChoices::wxPGChoices ( const wxPGChoices a)

Copy constructor, uses reference counting.

To create a real copy, use Copy() member function instead.

wxPGChoices::wxPGChoices ( const wxChar **  labels,
const long *  values = NULL 
)

Constructor.

wxPGChoices::wxPGChoices ( const wxArrayString labels,
const wxArrayInt values = wxArrayInt() 
)

Constructor.

wxPGChoices::wxPGChoices ( wxPGChoicesData *  data)

Constructor.

wxPGChoices::~wxPGChoices ( )

Destructor.

Member Function Documentation

void wxPGChoices::Add ( const wxChar **  labels,
const ValArrItem values = NULL 
)

Adds to current.

If did not have own copies, creates them now. If was empty, identical to set except that creates copies.

void wxPGChoices::Add ( const wxArrayString arr,
const wxArrayInt arrint 
)

Version that works with wxArrayString and wxArrayInt.

wxPGChoiceEntry& wxPGChoices::Add ( const wxString label,
int  value = wxPG_INVALID_VALUE 
)

Adds single item.

wxPGChoiceEntry& wxPGChoices::Add ( const wxString label,
const wxBitmap bitmap,
int  value = wxPG_INVALID_VALUE 
)

Adds a single item, with bitmap.

wxPGChoiceEntry& wxPGChoices::Add ( const wxPGChoiceEntry &  entry)

Adds a single item with full entry information.

wxPGChoiceEntry& wxPGChoices::AddAsSorted ( const wxString label,
int  value = wxPG_INVALID_VALUE 
)

Adds single item, sorted.

void wxPGChoices::AllocExclusive ( )

Creates exclusive copy of current choices.

void wxPGChoices::Assign ( const wxPGChoices a)

Assigns choices data, using reference counting.

To create a real copy, use Copy() member function instead.

void wxPGChoices::AssignData ( wxPGChoicesData *  data)

Assigns data from another set of choices.

void wxPGChoices::Clear ( )

Deletes all items.

wxPGChoices wxPGChoices::Copy ( ) const

Returns a real copy of the choices.

unsigned int wxPGChoices::GetCount ( ) const

Returns number of items.

wxArrayInt wxPGChoices::GetIndicesForStrings ( const wxArrayString strings,
wxArrayString unmatched = NULL 
) const

Returns array of indices matching given strings.

Unmatching strings are added to 'unmatched', if not NULL.

const wxString& wxPGChoices::GetLabel ( unsigned int  ind) const

Returns label of item.

wxArrayString wxPGChoices::GetLabels ( ) const

Returns array of choice labels.

int wxPGChoices::GetValue ( unsigned int  ind) const

Returns value of item;.

wxArrayInt wxPGChoices::GetValuesForStrings ( const wxArrayString strings) const

Returns array of values matching the given strings.

Unmatching strings result in wxPG_INVALID_VALUE entry in array.

int wxPGChoices::Index ( const wxString label) const

Returns index of item with given label.

int wxPGChoices::Index ( int  val) const

Returns index of item with given value.

wxPGChoiceEntry& wxPGChoices::Insert ( const wxString label,
int  index,
int  value = wxPG_INVALID_VALUE 
)

Inserts single item.

wxPGChoiceEntry& wxPGChoices::Insert ( const wxPGChoiceEntry &  entry,
int  index 
)

Inserts a single item with full entry information.

bool wxPGChoices::IsOk ( ) const

Returns false if this is a constant empty set of choices, which should not be modified.

const wxPGChoiceEntry& wxPGChoices::Item ( unsigned int  i) const

Returns item at given index.

wxPGChoiceEntry& wxPGChoices::Item ( unsigned int  i)

Returns item at given index.

void wxPGChoices::operator= ( const wxPGChoices a)
wxPGChoiceEntry& wxPGChoices::operator[] ( unsigned int  i)
const wxPGChoiceEntry& wxPGChoices::operator[] ( unsigned int  i) const
void wxPGChoices::RemoveAt ( size_t  nIndex,
size_t  count = 1 
)

Removes count items starting at position nIndex.

void wxPGChoices::Set ( const wxChar **  labels,
const long *  values = NULL 
)

Sets contents from lists of strings and values.

void wxPGChoices::Set ( const wxArrayString labels,
const wxArrayInt values = wxArrayInt() 
)

Sets contents from lists of strings and values.