wxPropertyGrid
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
wxPGChoices Class Reference

Helper class for managing choices for properties. More...

#include <propgrid.h>

Public Types

typedef long ValArrItem
 

Public Member Functions

void Add (const wxChar **labels, const ValArrItem *values=NULL)
 Adds to current. More...
 
void Add (const wxArrayString &arr, const ValArrItem *values=NULL)
 Version that works with wxArrayString. More...
 
void Add (const wxArrayString &arr, const wxArrayInt &arrint)
 Version that works with wxArrayString and wxArrayInt. More...
 
wxPGChoiceEntryAdd (const wxString &label, int value=INT_MAX)
 Adds a single choice. More...
 
wxPGChoiceEntryAdd (const wxString &label, const wxBitmap &bitmap, int value=INT_MAX)
 Adds a single item, with bitmap. More...
 
wxPGChoiceEntryAdd (const wxPGChoiceEntry &entry)
 Adds a single item with full entry information. More...
 
wxPGChoiceEntryAddAsSorted (const wxString &label, int value=INT_MAX)
 Adds single item. More...
 
void Assign (const wxPGChoices &src)
 Assigns choices data, using reference counting. More...
 
void AssignData (wxPGChoicesData *data)
 
void Clear ()
 Delete all choices. More...
 
wxPGChoices Copy () const
 Creates a physical copy of the choices.
 
void EnsureData ()
 
wxPGChoicesDataExtractData ()
 
unsigned int GetCount () const
 
wxPGChoicesDataGetData ()
 
wxPGChoicesDataGetDataPtr () const
 
wxPGChoicesId GetId () const
 Gets a unsigned number identifying this list. More...
 
wxArrayInt GetIndicesForStrings (const wxArrayString &strings, wxArrayString *unmatched=NULL) const
 Returns array of indices matching given strings. More...
 
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. More...
 
bool HasValue (unsigned int i) const
 Used to return true if given choice has valid value. More...
 
bool HasValues () const
 Used to return true if choices in general were likely to have values. More...
 
int Index (const wxString &str) const
 
int Index (int val) const
 
wxPGChoiceEntryInsert (const wxString &label, int index, int value=INT_MAX)
 Inserts single item. More...
 
wxPGChoiceEntryInsert (const wxPGChoiceEntry &entry, int index)
 Inserts a single item with full entry information. More...
 
bool IsOk () const
 Returns false if this is a constant empty set of choices, which should not be modified.
 
const wxPGChoiceEntryItem (unsigned int i) const
 
wxPGChoiceEntryItem (unsigned int i)
 
void operator= (const wxPGChoices &a)
 
wxPGChoiceEntryoperator[] (unsigned int i)
 
const wxPGChoiceEntryoperator[] (unsigned int i) const
 
void RemoveAt (size_t nIndex, size_t count=1)
 Removes count items starting at position nIndex. More...
 
void Set (const wxChar **labels, const long *values=NULL)
 Does not create copies for itself. More...
 
void Set (wxArrayString &arr, const long *values=(const long *) NULL)
 Version that works with wxArrayString. More...
 
void Set (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt())
 Version that works with wxArrayString and wxArrayInt. More...
 
void SetExclusive ()
 
 wxPGChoices ()
 Default constructor. More...
 
 wxPGChoices (const wxPGChoices &src)
 Copy constructor, uses reference counting. More...
 
 wxPGChoices (const wxChar **labels, const long *values=NULL)
 Constructor. More...
 
 wxPGChoices (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt())
 Constructor. More...
 
 wxPGChoices (wxPGChoicesData *data)
 Simple interface constructor. More...
 
 ~wxPGChoices ()
 Destructor. More...
 

Protected Member Functions

void Free ()
 
void Init ()
 

Protected Attributes

wxPGChoicesDatam_data
 

Detailed Description

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.

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

Constructor & Destructor Documentation

◆ wxPGChoices() [1/5]

wxPGChoices::wxPGChoices ( )

Default constructor.

◆ wxPGChoices() [2/5]

wxPGChoices::wxPGChoices ( const wxPGChoices src)

Copy constructor, uses reference counting.

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

◆ wxPGChoices() [3/5]

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

Constructor.

Parameters
labelsLabels for choices
valuesValues for choices. If NULL, indexes are used.

◆ wxPGChoices() [4/5]

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

Constructor.

Parameters
labelsLabels for choices
valuesValues for choices. If empty, indexes are used.

◆ wxPGChoices() [5/5]

wxPGChoices::wxPGChoices ( wxPGChoicesData data)

Simple interface constructor.

◆ ~wxPGChoices()

wxPGChoices::~wxPGChoices ( )

Destructor.

Member Function Documentation

◆ Add() [1/6]

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.

Parameters
labelsLabels for added choices.
valuesValues for added choices. If empty, relevant entry indexes are used.

◆ Add() [2/6]

void wxPGChoices::Add ( const wxArrayString &  arr,
const ValArrItem *  values = NULL 
)

Version that works with wxArrayString.

◆ Add() [3/6]

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

Version that works with wxArrayString and wxArrayInt.

◆ Add() [4/6]

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

Adds a single choice.

Parameters
labelLabel for added choice.
valueValue for added choice. If unspecified, index is used.

◆ Add() [5/6]

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

Adds a single item, with bitmap.

◆ Add() [6/6]

wxPGChoiceEntry& wxPGChoices::Add ( const wxPGChoiceEntry entry)

Adds a single item with full entry information.

◆ AddAsSorted()

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

Adds single item.

◆ Assign()

void wxPGChoices::Assign ( const wxPGChoices src)

Assigns choices data, using reference counting.

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

◆ Clear()

void wxPGChoices::Clear ( )

Delete all choices.

◆ GetId()

wxPGChoicesId wxPGChoices::GetId ( ) const

Gets a unsigned number identifying this list.

◆ GetIndicesForStrings()

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.

◆ GetValuesForStrings()

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.

◆ HasValue()

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.

Deprecated:
Since wxPropertyGrid 1.4.0 choice entries always have valid values.

◆ HasValues()

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.

Deprecated:
Since wxPropertyGrid 1.4.0 choice entries always have valid values.

◆ Insert() [1/2]

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

Inserts single item.

◆ Insert() [2/2]

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

Inserts a single item with full entry information.

◆ RemoveAt()

void wxPGChoices::RemoveAt ( size_t  nIndex,
size_t  count = 1 
)

Removes count items starting at position nIndex.

◆ Set() [1/3]

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

Does not create copies for itself.

◆ Set() [2/3]

void wxPGChoices::Set ( wxArrayString &  arr,
const long *  values = (const long*) NULL 
)

Version that works with wxArrayString.

TODO: Deprecate this.

◆ Set() [3/3]

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

Version that works with wxArrayString and wxArrayInt.


The documentation for this class was generated from the following file: