Helper class for managing choices for properties. More...
#include <propgrid.h>
Public Types | |
typedef long | ValArrItem |
Public Member Functions | |
wxPGChoiceEntry & | Add (const wxPGChoiceEntry &entry) |
Adds a single item with full entry information. | |
wxPGChoiceEntry & | Add (const wxString &label, const wxBitmap &bitmap, int value=INT_MAX) |
Adds a single item, with bitmap. | |
wxPGChoiceEntry & | Add (const wxString &label, int value=INT_MAX) |
Adds a single choice. | |
void | Add (const wxArrayString &arr, const wxArrayInt &arrint) |
Version that works with wxArrayString and wxArrayInt. | |
void | Add (const wxArrayString &arr, const ValArrItem *values=NULL) |
Version that works with wxArrayString. | |
void | Add (const wxChar **labels, const ValArrItem *values=NULL) |
Adds to current. | |
wxPGChoiceEntry & | AddAsSorted (const wxString &label, int value=INT_MAX) |
Adds single item. | |
void | Assign (const wxPGChoices &src) |
Assigns choices data, using reference counting. | |
void | AssignData (wxPGChoicesData *data) |
void | Clear () |
Delete all choices. | |
wxPGChoices | Copy () const |
Creates a physical copy of the choices. | |
void | EnsureData () |
wxPGChoicesData * | ExtractData () |
unsigned int | GetCount () const |
wxPGChoicesData * | GetData () |
wxPGChoicesData * | GetDataPtr () const |
wxPGChoicesId | GetId () const |
Gets a unsigned number identifying this list. | |
wxArrayInt | GetIndicesForStrings (const wxArrayString &strings, wxArrayString *unmatched=NULL) const |
Returns array of indices matching given strings. | |
const wxString & | GetLabel (unsigned int ind) const |
wxArrayString | GetLabels () const |
int | GetValue (unsigned int ind) const |
wxArrayInt | GetValuesForStrings (const wxArrayString &strings) const |
Returns array of values matching the given strings. | |
bool | HasValue (unsigned int i) const |
Used to return true if given choice has valid value. | |
bool | HasValues () const |
Used to return true if choices in general were likely to have values. | |
int | Index (int val) const |
int | Index (const wxString &str) const |
wxPGChoiceEntry & | Insert (const wxPGChoiceEntry &entry, int index) |
Inserts a single item with full entry information. | |
wxPGChoiceEntry & | Insert (const wxString &label, int index, int value=INT_MAX) |
Inserts single item. | |
bool | IsOk () const |
Returns false if this is a constant empty set of choices, which should not be modified. | |
wxPGChoiceEntry & | Item (unsigned int i) |
const wxPGChoiceEntry & | Item (unsigned int i) const |
void | operator= (const wxPGChoices &a) |
const wxPGChoiceEntry & | operator[] (unsigned int i) const |
wxPGChoiceEntry & | operator[] (unsigned int i) |
void | RemoveAt (size_t nIndex, size_t count=1) |
Removes count items starting at position nIndex. | |
void | Set (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt()) |
Version that works with wxArrayString and wxArrayInt. | |
void | Set (wxArrayString &arr, const long *values=(const long *) NULL) |
Version that works with wxArrayString. | |
void | Set (const wxChar **labels, const long *values=NULL) |
Does not create copies for itself. | |
void | SetExclusive () |
wxPGChoices (wxPGChoicesData *data) | |
Simple interface constructor. | |
wxPGChoices (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt()) | |
Constructor. | |
wxPGChoices (const wxChar **labels, const long *values=NULL) | |
Constructor. | |
wxPGChoices (const wxPGChoices &src) | |
Copy constructor, uses reference counting. | |
wxPGChoices () | |
Default constructor. | |
~wxPGChoices () | |
Destructor. | |
Protected Member Functions | |
void | Free () |
void | Init () |
Protected Attributes | |
wxPGChoicesData * | m_data |
Helper class for managing choices for 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 and copy constructor only copy the reference and not the actual data. Call Copy() member function to create a real copy.
wxPGChoices::wxPGChoices | ( | ) |
Default constructor.
wxPGChoices::wxPGChoices | ( | const wxPGChoices & | src | ) |
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.
labels | Labels for choices | |
values | Values for choices. If NULL, indexes are used. |
wxPGChoices::wxPGChoices | ( | const wxArrayString & | labels, | |
const wxArrayInt & | values = wxArrayInt() | |||
) |
Constructor.
labels | Labels for choices | |
values | Values for choices. If empty, indexes are used. |
wxPGChoices::wxPGChoices | ( | wxPGChoicesData * | data | ) |
Simple interface constructor.
wxPGChoices::~wxPGChoices | ( | ) |
Destructor.
wxPGChoiceEntry& wxPGChoices::Add | ( | const wxPGChoiceEntry & | entry | ) |
Adds a single item with full entry information.
wxPGChoiceEntry& wxPGChoices::Add | ( | const wxString & | label, | |
const wxBitmap & | bitmap, | |||
int | value = INT_MAX | |||
) |
Adds a single item, with bitmap.
wxPGChoiceEntry& wxPGChoices::Add | ( | const wxString & | label, | |
int | value = INT_MAX | |||
) |
Adds a single choice.
label | Label for added choice. | |
value | Value for added choice. If unspecified, index is used. |
void wxPGChoices::Add | ( | const wxArrayString & | arr, | |
const wxArrayInt & | arrint | |||
) |
Version that works with wxArrayString and wxArrayInt.
void wxPGChoices::Add | ( | const wxArrayString & | arr, | |
const ValArrItem * | values = NULL | |||
) |
Version that works with wxArrayString.
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.
labels | Labels for added choices. | |
values | Values for added choices. If empty, relevant entry indexes are used. |
wxPGChoiceEntry& wxPGChoices::AddAsSorted | ( | const wxString & | label, | |
int | value = INT_MAX | |||
) |
Adds single item.
void wxPGChoices::Assign | ( | const wxPGChoices & | src | ) |
Assigns choices data, using reference counting.
To create a real copy, call Copy() member function instead.
void wxPGChoices::Clear | ( | ) |
Delete all choices.
wxPGChoicesId wxPGChoices::GetId | ( | ) | const |
Gets a unsigned number identifying this list.
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.
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.
bool wxPGChoices::HasValue | ( | unsigned int | i | ) | const |
Used to return true if given choice has valid value.
Now always returns since if value was not specified for choice, index is used.
bool wxPGChoices::HasValues | ( | ) | const |
Used to return true if choices in general were likely to have values.
Now always returns true since if value was not specified for choice, index is used.
wxPGChoiceEntry& wxPGChoices::Insert | ( | const wxPGChoiceEntry & | entry, | |
int | index | |||
) |
Inserts a single item with full entry information.
wxPGChoiceEntry& wxPGChoices::Insert | ( | const wxString & | label, | |
int | index, | |||
int | value = INT_MAX | |||
) |
Inserts single item.
void wxPGChoices::RemoveAt | ( | size_t | nIndex, | |
size_t | count = 1 | |||
) |
Removes count items starting at position nIndex.
void wxPGChoices::Set | ( | const wxArrayString & | labels, | |
const wxArrayInt & | values = wxArrayInt() | |||
) |
Version that works with wxArrayString and wxArrayInt.
void wxPGChoices::Set | ( | wxArrayString & | arr, | |
const long * | values = (const long*) NULL | |||
) |
Version that works with wxArrayString.
TODO: Deprecate this.
void wxPGChoices::Set | ( | const wxChar ** | labels, | |
const long * | values = NULL | |||
) |
Does not create copies for itself.