X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0ad10f30552aaeea5579388a7988504f4b4a2bf2..27bb2c8cb78e39d8a4def1c349e0677fd32a2c06:/interface/wx/propgrid/propgrid.h?ds=sidebyside diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index eec0ae3842..21de0b0708 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -271,6 +271,27 @@ enum wxPG_KEYBOARD_ACTIONS /** @} */ +/** This callback function is used for sorting properties. + + Call wxPropertyGrid::SetSortFunction() to set it. + + Sort function should return a value greater than 0 if position of p1 is + after p2. So, for instance, when comparing property names, you can use + following implementation: + + @code + int MyPropertySortFunction(wxPropertyGrid* propGrid, + wxPGProperty* p1, + wxPGProperty* p2) + { + return p1->GetBaseName().compare( p2->GetBaseName() ); + } + @endcode +*/ +typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid, + wxPGProperty* p1, + wxPGProperty* p2); + // ----------------------------------------------------------------------- /** @@ -297,7 +318,7 @@ enum wxPG_KEYBOARD_ACTIONS To process input from a property grid control, use these event handler macros to direct input to member functions that take a wxPropertyGridEvent argument. - @beginEventTable{wxPropertyGridEvent} + @beginEventEmissionTable{wxPropertyGridEvent} @event{EVT_PG_SELECTED (id, func)} Respond to wxEVT_PG_SELECTED event, generated when property value has been changed by user. @@ -451,6 +472,10 @@ public: /** Enables or disables (shows/hides) categories according to parameter enable. + + @remarks This functions deselects selected property, if any. Validation + failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. + selection is cleared even if editor had invalid value. */ bool EnableCategories( bool enable ); @@ -586,16 +611,6 @@ public: */ wxVariant GetUncommittedPropertyValue(); - /** - Returns cell background colour of a property. - */ - wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const; - - /** - Returns cell background colour of a property. - */ - wxColour GetPropertyTextColour( wxPGPropArg id ) const; - /** Returns "root property". It does not have name, etc. and it is not visible. It is only useful for accessing its children. @@ -627,6 +642,13 @@ public: */ wxColour GetSelectionForegroundColour() const; + /** + Returns the property sort function (default is @NULL). + + @see SetSortFunction + */ + wxPGSortCallback GetSortFunction() const; + /** Returns current splitter x position. */ @@ -650,6 +672,12 @@ public: /** Returns information about arbitrary position in the grid. + + @param pt + Coordinates in the virtual grid space. You may need to use + wxScrolledWindow::CalcScrolledPosition() for translating + wxPropertyGrid client coordinates into something this member + function can use. */ wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const; @@ -658,6 +686,11 @@ public: */ bool IsAnyModified() const; + /** + Returns @true if a property editor control has focus. + */ + bool IsEditorFocused() const; + /** Returns true if updating is frozen (ie. Freeze() called but not yet Thaw() ). @@ -665,20 +698,9 @@ public: bool IsFrozen() const; /** - When creating custom property editors, connect required editor events to - this function. For instance: - - @code - control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED, - wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), - NULL, propgrid); - @endcode - - @remarks You should never need to call this function directly! - - @see wxPGEditor::CreateControls(), wxEvtHandler::Connect() + Refreshes any active editor control. */ - void OnCustomEditorEvent( wxEvent &event ); + void RefreshEditor(); /** Redraws given property. @@ -778,24 +800,6 @@ public: */ void SetMarginColour(const wxColour& col); - /** - Sets background colour of property and all its children. Colours of - captions are not affected. Background brush cache is optimized for often - set colours to be set last. - */ - void SetPropertyBackgroundColour( wxPGPropArg id, const wxColour& col ); - - /** - Resets text and background colours of given property. - */ - void SetPropertyColoursToDefault( wxPGPropArg id ); - - /** - Sets text colour of property and all its children. - */ - void SetPropertyTextColour( wxPGPropArg id, const wxColour& col, - bool recursively = true ); - /** Sets selection background colour - applies to selected property name background. @@ -807,6 +811,33 @@ public: */ void SetSelectionTextColour(const wxColour& col); + + /** + Sets the property sorting function. + + @param sortFunction + The sorting function to be used. It should return a value greater + than 0 if position of p1 is after p2. So, for instance, when + comparing property names, you can use following implementation: + + @code + int MyPropertySortFunction(wxPropertyGrid* propGrid, + wxPGProperty* p1, + wxPGProperty* p2) + { + return p1->GetBaseName().compare( p2->GetBaseName() ); + } + @endcode + + @remarks + Default property sort function sorts properties by their labels + (case-insensitively). + + @see GetSortFunction, wxPropertyGridInterface::Sort, + wxPropertyGridInterface::SortChildren + */ + void SetSortFunction( wxPGSortCallback sortFunction ); + /** Sets x coordinate of the splitter. @@ -836,16 +867,6 @@ public: Shows an brief error message that is related to a property. */ void ShowPropertyError( wxPGPropArg id, const wxString& msg ); - - /** - Sorts all items at all levels (except private children). - */ - void Sort(); - - /** - Sorts children of a property. - */ - void SortChildren( wxPGPropArg id ); }; @@ -876,9 +897,6 @@ public: */ bool CanVeto() const; - /** Copyer. */ - virtual wxEvent* Clone() const; - /** Returns highest level non-category, non-root parent of property for which event occurred. Useful when you have nested properties with