X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3a89adc1f01554f2da86f6f357eafb524c45f191..f7ca1dd4164eff38df31c21b975e9707f97bd266:/interface/wx/propgrid/property.h diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 6795ed0a18..057154a0a6 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -240,9 +240,6 @@ @code virtual bool OnButtonClick( wxPropertyGrid* propGrid, wxString& value ) { - // Update property value from editor, if necessary - PrepareValueForDialogEditing(propGrid); - wxSize dialogSize(...size of your dialog...); wxPoint dlgPos = propGrid->GetGoodEditorDialogPosition(this, @@ -329,6 +326,8 @@ Useful alternate editor: Choice. Represents wxColour. wxButton is used to trigger a colour picker dialog. + There are various sub-classing opportunities with this class. See + below in wxSystemColourProperty section for details. @subsection wxFontProperty @@ -339,7 +338,9 @@ Represents wxColour and a system colour index. wxChoice is used to edit the value. Drop-down list has color images. Note that value type - is wxColourPropertyValue instead of wxColour. + is wxColourPropertyValue instead of wxColour (which wxColourProperty + uses). + @code class wxColourPropertyValue : public wxObject { @@ -356,6 +357,27 @@ wxColour m_colour; }; @endcode + + in wxSystemColourProperty, and its derived class wxColourProperty, there + are various sub-classing features. To set basic list list of colour + names, call wxPGProperty::SetChoices(). + + @code + // Override in derived class to customize how colours are translated + // to strings. + virtual wxString ColourToString( const wxColour& col, int index ) const; + + // Returns index of entry that triggers colour picker dialog + // (default is last). + virtual int GetCustomColourIndex() const; + + // Helper function to show the colour dialog + bool QueryColourFromUser( wxVariant& variant ) const; + + // Returns colour for given choice. + // Default function returns wxSystemSettings::GetColour(index). + virtual wxColour GetColour( int index ) const; + @endcode @subsection wxCursorProperty @@ -846,8 +868,21 @@ public: int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE ); /** - Properties which have private child properties should add them - with this function, called in their constructor. + Adds a child property. If you use this instead of + wxPropertyGridInterface::Insert() or + wxPropertyGridInterface::AppendIn(), then you must set up + property's parental type before making the call. To do this, + call property's SetParentalType() function with either + wxPG_PROP_MISC_PARENT (normal, public children) or with + wxPG_PROP_AGGREGATE (private children for subclassed property). + For instance: + + @code + wxPGProperty* prop = new wxStringProperty(wxS("Property")); + prop->SetParentalType(wxPG_PROP_MISC_PARENT); + wxPGProperty* prop2 = new wxStringProperty(wxS("Property2")); + prop->AddChild(prop2); + @endcode */ void AddChild( wxPGProperty* property ); @@ -1172,25 +1207,7 @@ public: /** Returns child property at index i. */ - wxPGProperty* Item( size_t i ) const; - - /** - 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 Returns @true if value changed. - */ - bool PrepareValueForDialogEditing( wxPropertyGrid* propgrid ); + wxPGProperty* Item( unsigned int i ) const; /** If property's editor is active, then update it's value. @@ -1295,6 +1312,23 @@ public: */ void SetName( const wxString& newName ); + /** + Changes what sort of parent this property is for its children. + + @param flag + Use one of the following values: wxPG_PROP_MISC_PARENT (for generic + parents), wxPG_PROP_CATEGORY (for categories), or + wxPG_PROP_AGGREGATE (for derived property classes with private + children). + + @remarks You only need to call this if you use AddChild() to add + child properties. Adding properties with + wxPropertyGridInterface::Insert() or + wxPropertyGridInterface::AppendIn() will automatically set + property to use wxPG_PROP_MISC_PARENT style. + */ + void SetParentalType( int flag ); + /** Sets wxValidator for a property */ void SetValidator( const wxValidator& validator ); @@ -1444,17 +1478,17 @@ public: /** Returns labe of item. */ - const wxString& GetLabel( size_t ind ) const; + const wxString& GetLabel( unsigned int ind ) const; /** Returns number of items. */ - size_t GetCount () const; + unsigned int GetCount() const; /** Returns value of item; */ - int GetValue( size_t ind ) const; + int GetValue( unsigned int ind ) const; /** Returns array of values matching the given strings. Unmatching strings