// Takes ownership of 'item'
void Insert( int index, wxPGChoiceEntry* item )
{
- wxArrayPtrVoid::iterator it;
+ wxVector<wxPGChoiceEntry*>::iterator it;
if ( index == -1 )
{
it = m_items.end();
{
wxCHECK_MSG( i < GetCount(), NULL, "invalid index" );
- return (wxPGChoiceEntry*) m_items[i];
+ return m_items[i];
}
void DecRef()
}
private:
- wxArrayPtrVoid m_items;
+ wxVector<wxPGChoiceEntry*> m_items;
// So that multiple properties can use the same set
int m_refCount;
wxPGValidationInfo& validationInfo ) const;
/**
- Converts 'text' into proper value 'variant'.
- Returns true if new (different than m_value) value could be interpreted
- from the text.
+ Converts text into wxVariant value appropriate for this property.
+
+ @param variant
+ On function entry this is the old value (should not be wxNullVariant
+ in normal cases). Translated value must be assigned back to it.
+
+ @param text
+ Text to be translated into variant.
+
@param argFlags
If wxPG_FULL_VALUE is set, returns complete, storable value instead
of displayable one (they may be different).
composite property string value (as generated by GetValueAsString()
called with this same flag).
- @remarks
- Default implementation converts semicolon delimited tokens into child
- values. Only works for properties with children.
+ @return Returns @true if resulting wxVariant value was different.
+
+ @remarks Default implementation converts semicolon delimited tokens into
+ child values. Only works for properties with children.
+
+ You might want to take into account that m_value is Null variant
+ if property value is unspecified (which is usually only case if
+ you explicitly enabled that sort behavior).
*/
virtual bool StringToValue( wxVariant& variant,
const wxString& text,
int argFlags = 0 ) const;
/**
- Converts 'number' (including choice selection) into proper value
- 'variant'.
+ Converts integer (possibly a choice selection) into wxVariant value
+ appropriate for this property.
+
+ @param variant
+ On function entry this is the old value (should not be wxNullVariant
+ in normal cases). Translated value must be assigned back to it.
- Returns true if new (different than m_value) value could be interpreted
- from the integer.
+ @param number
+ Integer to be translated into variant.
@param argFlags
If wxPG_FULL_VALUE is set, returns complete, storable value instead
of displayable one.
+ @return Returns @true if resulting wxVariant value was different.
+
@remarks
- If property is not supposed to use choice or spinctrl or other editor
with int-based value, it is not necessary to implement this method.
- If property uses choice control, and displays a dialog on some choice
items, then it is preferred to display that dialog in IntToValue
instead of OnEvent.
+ - You might want to take into account that m_value is Null variant if
+ property value is unspecified (which is usually only case if you
+ explicitly enabled that sort behavior).
*/
virtual bool IntToValue( wxVariant& value,
int number,
*/
double GetAttributeAsDouble( const wxString& name, double defVal ) const;
- unsigned int GetArrIndex() const { return m_arrIndex; }
-
unsigned int GetDepth() const { return (unsigned int)m_depth; }
/** Gets flags as a'|' delimited string. Note that flag names are not
int GetChildrenHeight( int lh, int iMax = -1 ) const;
/** Returns number of child properties */
- unsigned int GetChildCount() const { return m_children.GetCount(); }
+ unsigned int GetChildCount() const { return m_children.size(); }
/** Returns sub-property at index i. */
wxPGProperty* Item( size_t i ) const
- { return (wxPGProperty*)m_children.Item(i); }
+ { return m_children[i]; }
/** Returns last sub-property.
*/
- wxPGProperty* Last() const { return (wxPGProperty*)m_children.Last(); }
+ wxPGProperty* Last() const { return m_children.back(); }
- /** Returns index of given sub-property. */
- int Index( const wxPGProperty* p ) const
- { return m_children.Index((wxPGProperty*)p); }
+ /** Returns index of given child property. */
+ int Index( const wxPGProperty* p ) const;
/** Deletes all sub-properties. */
void Empty();
// Call for after sub-properties added with AddChild
void PrepareSubProperties();
+ // Removes child property with given pointer. Does not delete it.
+ void RemoveChild( wxPGProperty* p );
+
void SetParentalType( int flag )
{
m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
wxVariant m_value;
wxPGAttributeStorage m_attributes;
- wxArrayPtrVoid m_children;
+ wxArrayPGProperty m_children;
// Extended cell information
wxArrayPtrVoid m_cells;