| Version: 3.3.1

Public Member Functions | Static Public Member Functions | List of all members
wxPropertyGridPopulator Class Referenceabstract

`#include <wx/propgrid/propgrid.h>`

## Detailed Description

Allows populating wxPropertyGrid from arbitrary text source.

## Public Member Functions
| wxPropertyGridPopulator ()
| Default constructor. More...
virtual | ~wxPropertyGridPopulator ()
| Destructor. More...
void | SetState (wxPropertyGridPageState *state)
void | SetGrid (wxPropertyGrid *pg)
wxPGProperty * | Add (const wxString &propClass, const wxString &propLabel, const wxString &propName, const wxString *propValue, wxPGChoices *pChoices=nullptr)
| Appends a new property under bottommost parent. More...
void | AddChildren (wxPGProperty *property)
| Pushes property to the back of parent array (ie it becomes bottommost parent), and starts scanning/adding children for it. More...
bool | AddAttribute (const wxString &name, const wxString &type, const wxString &value, wxPGPropertyValuesFlags flags=wxPGPropertyValuesFlags::DontRecurse)
| Adds attribute to the bottommost property. More...
virtual void | DoScanForChildren ()=0
| Called once in AddChildren. More...
wxPGProperty * | GetCurParent () const
| Returns id of parent property for which children can currently be added. More...
wxPropertyGridPageState * | GetState ()
const wxPropertyGridPageState * | GetState () const
wxPGChoices | ParseChoices (const wxString &choicesString, const wxString &idString)
| Parses strings of format "choice1"[=value1] ... More...
virtual void | ProcessError (const wxString &msg)
| Implement in derived class to do custom process when an error occurs. More...

## Static Public Member Functions
static bool | ToLongPCT (const wxString &s, long *pval, long max)
| Like wxString::ToLong, except allows N% in addition of N. More...

## Constructor & Destructor Documentation

## ◆ wxPropertyGridPopulator()

wxPropertyGridPopulator::wxPropertyGridPopulator | ( |  | ) |

Default constructor.

## ◆ ~wxPropertyGridPopulator()

virtual wxPropertyGridPopulator::~wxPropertyGridPopulator | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ Add()

wxPGProperty* wxPropertyGridPopulator::Add | ( | const wxString & | propClass,
|  | const wxString & | propLabel,
|  | const wxString & | propName,
|  | const wxString * | propValue,
|  | wxPGChoices * | pChoices = `nullptr`
| ) |  |

Appends a new property under bottommost parent.

Parameters

  propClass | Property class as string.
  propLabel | Property label.
  propName | Property name.
  propValue | Property value.
  pChoices | Set of choices for the property (optional).

## ◆ AddAttribute()

bool wxPropertyGridPopulator::AddAttribute | ( | const wxString & | name,
|  | const wxString & | type,
|  | const wxString & | value,
|  | wxPGPropertyValuesFlags | flags = `wxPGPropertyValuesFlags::DontRecurse`
| ) |  |

Adds attribute to the bottommost property.

Parameters

  name | Attribute name.
  type | Allowed values: `"string"`, (same as string), `"int"`, `"bool"`. Empty string means autodetect.
  value | Attribute value.
  flags | Flags used when setting the attribute. Currently only wxPGPropertyValuesFlags::Recurse is used here. This parameter is only available since wxWidgets 3.3.0.

## ◆ AddChildren()

void wxPropertyGridPopulator::AddChildren | ( | wxPGProperty * | property | ) |

Pushes property to the back of parent array (ie it becomes bottommost parent), and starts scanning/adding children for it.

When finished, parent array is returned to the original state.

## ◆ DoScanForChildren()

virtual void wxPropertyGridPopulator::DoScanForChildren | ( |  | ) |
| pure virtual

Called once in AddChildren.

## ◆ GetCurParent()

wxPGProperty* wxPropertyGridPopulator::GetCurParent | ( |  | ) | const

Returns id of parent property for which children can currently be added.

## ◆ GetState() [1/2]

wxPropertyGridPageState* wxPropertyGridPopulator::GetState | ( |  | ) |

## ◆ GetState() [2/2]

const wxPropertyGridPageState* wxPropertyGridPopulator::GetState | ( |  | ) | const

## ◆ ParseChoices()

wxPGChoices wxPropertyGridPopulator::ParseChoices | ( | const wxString & | choicesString,
|  | const wxString & | idString
| ) |  |

Parses strings of format "choice1"[=value1] ...

"choiceN"[=valueN] into wxPGChoices. Registers parsed result using idString (if not empty). Also, if choices with given id already registered, then don't parse but return those choices instead.

## ◆ ProcessError()

virtual void wxPropertyGridPopulator::ProcessError | ( | const wxString & | msg | ) |
| virtual

Implement in derived class to do custom process when an error occurs.

Default implementation uses wxLogError.

## ◆ SetGrid()

void wxPropertyGridPopulator::SetGrid | ( | wxPropertyGrid * | pg | ) |

## ◆ SetState()

void wxPropertyGridPopulator::SetState | ( | wxPropertyGridPageState * | state | ) |

## ◆ ToLongPCT()

static bool wxPropertyGridPopulator::ToLongPCT | ( | const wxString & | s,
|  | long * | pval,
|  | long | max
| ) |  |
| static

Like wxString::ToLong, except allows N% in addition of N.