-
- /** Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
- */
- FlagType UsesAutoUnspecified() const
- {
- return HasFlag(wxPG_PROP_AUTO_UNSPECIFIED);
- }
-
- wxBitmap* GetValueImage() const
- {
- return m_valueBitmap;
- }
-
- wxVariant GetAttribute( const wxString& name ) const;
-
- /**
- Returns named attribute, as string, if found.
-
- Otherwise defVal is returned.
- */
- wxString GetAttribute( const wxString& name, const wxString& defVal ) const;
-
- /**
- Returns named attribute, as long, if found.
-
- Otherwise defVal is returned.
- */
- long GetAttributeAsLong( const wxString& name, long defVal ) const;
-
- /**
- Returns named attribute, as double, if found.
-
- Otherwise defVal is returned.
- */
- 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
- prepended with 'wxPG_PROP_'.
- @param flagsMask
- String will only be made to include flags combined by this parameter.
- */
- wxString GetFlagsAsString( FlagType flagsMask ) const;
-
- /** Returns position in parent's array. */
- unsigned int GetIndexInParent() const
- {
- return (unsigned int)m_arrIndex;
- }
-
- /** Hides or reveals the property.
- @param hide
- true for hide, false for reveal.
- @param flags
- By default changes are applied recursively. Set this paramter
- wxPG_DONT_RECURSE to prevent this.
- */
- inline bool Hide( bool hide, int flags = wxPG_RECURSE );
-
- bool IsExpanded() const
- { return (!(m_flags & wxPG_PROP_COLLAPSED) && GetChildCount()); }
-
- /** Returns true if all parents expanded.
- */
- bool IsVisible() const;
-
- bool IsEnabled() const { return !(m_flags & wxPG_PROP_DISABLED); }
-
- /** If property's editor is created this forces its recreation.
- Useful in SetAttribute etc. Returns true if actually did anything.
- */
- bool RecreateEditor();
-
- /** If property's editor is active, then update it's value.
- */
- void RefreshEditor();
-
- /** Sets an attribute for this property.
- @param name
- Text identifier of attribute. See @ref propgrid_property_attributes.
- @param value
- Value of attribute.
- */
- void SetAttribute( const wxString& name, wxVariant value );
-
- void SetAttributes( const wxPGAttributeStorage& attributes );
-
-#ifndef SWIG
- /** Sets editor for a property.
-
- @param editor
- For builtin editors, use wxPGEditor_X, where X is builtin editor's
- name (TextCtrl, Choice, etc. see wxPGEditor documentation for full
- list).
-
- For custom editors, use pointer you received from
- wxPropertyGrid::RegisterEditorClass().
- */
- void SetEditor( const wxPGEditor* editor )
- {
- m_customEditor = editor;
- }
-#endif
-
- /** Sets editor for a property.
- */
- inline void SetEditor( const wxString& editorName );
-
- /** Sets cell information for given column.
-
- Note that the property takes ownership of given wxPGCell instance.
- */
- void SetCell( int column, wxPGCell* cellObj );
-
- /** Changes value of a property with choices, but only
- works if the value type is long or string. */
- void SetChoiceSelection( int newValue, const wxPGChoiceInfo& choiceInfo );
-
- /** Sets common value selected for this property. -1 for none.
- */
- void SetCommonValue( int commonValue )
- {
- m_commonValue = commonValue;
- }
-
- /** Sets flags from a '|' delimited string. Note that flag names are not
- prepended with 'wxPG_PROP_'.
- */
- void SetFlagsFromString( const wxString& str );
-
- /** Sets property's "is it modified?" flag. Affects children recursively.
- */
- void SetModifiedStatus( bool modified )
- {
- SetFlagRecursively(wxPG_PROP_MODIFIED, modified);
- }
-
- /** Call in OnEvent(), OnButtonClick() etc. to change the property value
- based on user input.
-
- @remarks
- This method is const since it doesn't actually modify value, but posts
- given variant as pending value, stored in wxPropertyGrid.
- */
- void SetValueInEvent( wxVariant value ) const;
-
- /**
- Call this to set value of the property.
-
- Unlike methods in wxPropertyGrid, this does not automatically update
- the display.
-
- @remarks
- Use wxPropertyGrid::ChangePropertyValue() instead if you need to run
- through validation process and send property change event.
-
- If you need to change property value in event, based on user input, use
- SetValueInEvent() instead.
-
- @param pList
- Pointer to list variant that contains child values. Used to indicate
- which children should be marked as modified.
- @param flags
- Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR).
- */
- void SetValue( wxVariant value, wxVariant* pList = NULL, int flags = 0 );
-
- /** Set wxBitmap in front of the value. This bitmap may be ignored
- by custom cell renderers.
- */
- void SetValueImage( wxBitmap& bmp );
-
- /** If property has choices and they are not yet exclusive, new such copy
- of them will be created.
- */
- void SetChoicesExclusive();
-
- void SetExpanded( bool expanded )
- {
- if ( !expanded ) m_flags |= wxPG_PROP_COLLAPSED;
- else m_flags &= ~wxPG_PROP_COLLAPSED;
- }
-
- void SetFlag( FlagType flag ) { m_flags |= flag; }
-
- void SetFlagRecursively( FlagType flag, bool set );
-
- void SetHelpString( const wxString& helpString )
- {
- m_helpString = helpString;
- }
-
- void SetLabel( const wxString& label ) { m_label = label; }
-
- inline void SetName( const wxString& newName );
-
- void SetValueToUnspecified()
- {
- wxVariant val; // Create NULL variant
- SetValue(val);
- }
-
-#if wxUSE_VALIDATORS
- /** Sets wxValidator for a property*/
- void SetValidator( const wxValidator& validator )
- {
- m_validator = wxDynamicCast(validator.Clone(),wxValidator);
- }
-
- /** Gets assignable version of property's validator. */
- wxValidator* GetValidator() const
- {
- if ( m_validator )
- return m_validator;
- return DoGetValidator();
- }
-#endif // #if wxUSE_VALIDATORS
-
- /** Updates property value in case there were last minute
- changes. If value was unspecified, it will be set to default.
- Use only for properties that have TextCtrl-based editor.
- @remarks
- If you have code similar to
- @code
- // Update the value in case of last minute changes
- if ( primary && propgrid->IsEditorsValueModified() )
- GetEditorClass()->CopyValueFromControl( this, primary );
- @endcode
- in wxPGProperty::OnEvent wxEVT_COMMAND_BUTTON_CLICKED handler,
- then replace it with call to this method.
- @return
- True if value changed.
- */
- bool PrepareValueForDialogEditing( wxPropertyGrid* propgrid );
-
-#ifndef SWIG
- /** Returns client data (void*) of a property.
- */
- void* GetClientData() const
- {
- return m_clientData;
- }
-
- /** Sets client data (void*) of a property.
- @remarks
- This untyped client data has to be deleted manually.
- */
- void SetClientData( void* clientData )
- {
- m_clientData = clientData;
- }
-
- /** Returns client object of a property.
- */
- void SetClientObject(wxClientData* clientObject)
- {
- delete m_clientObject;
- m_clientObject = clientObject;
- }
-
- /** Sets managed client object of a property.
- */
- wxClientData *GetClientObject() const { return m_clientObject; }
-#endif
-
- /** Sets new set of choices for property.
-
- @remarks
- This operation clears the property value.
- */
- bool SetChoices( wxPGChoices& choices );
-
- /** Sets new set of choices for property.
- */
- inline bool SetChoices( const wxArrayString& labels,
- const wxArrayInt& values = wxArrayInt() );
-
- /** Set max length of text in text editor.
- */
- inline bool SetMaxLength( int maxLen );
-
- /** Call with 'false' in OnSetValue to cancel value changes after all
- (ie. cancel 'true' returned by StringToValue() or IntToValue()).