From 020b004113a8ab9b9c42a9a56716f3a27b0a8621 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Mon, 29 Sep 2008 17:01:04 +0000 Subject: [PATCH] Moved wxPropertyGrid::SetPropertyName() to wxPropertyGridInterface git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/propgrid.h | 14 -------------- include/wx/propgrid/propgridiface.h | 15 +++++++++++++++ include/wx/propgrid/propgridpagestate.h | 2 ++ interface/wx/propgrid/propgrid.h | 11 ----------- interface/wx/propgrid/propgridiface.h | 11 +++++++++++ src/propgrid/propgrid.cpp | 12 ------------ src/propgrid/propgridpagestate.cpp | 13 +++++++++++++ 7 files changed, 41 insertions(+), 37 deletions(-) diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 1e1163bcb2..e22071ab4a 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1035,18 +1035,6 @@ public: virtual width should be disabled. */ void SetVirtualWidth( int width ); - /** Sets name of a property. - @param id - Name or pointer of property which name to change. - @param newname - New name. - */ - void SetPropertyName( wxPGPropArg id, const wxString& newname ) - { - wxPG_PROP_ARG_CALL_PROLOG() - DoSetPropertyName( p, newname ); - } - /** Moves splitter as left as possible, while still allowing all labels to be shown in full. @@ -1813,8 +1801,6 @@ protected: int CacheColour( const wxColour& colour ); - void DoSetPropertyName( wxPGProperty* p, const wxString& newname ); - // Sets up basic event handling for child control void SetupChildEventHandling( wxWindow* wnd, int id ); diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index d75fdf0aa6..5698fbe393 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -961,6 +961,21 @@ public: p->SetModifiedStatus(modified); } + /** + Sets name of a property. + + @param id + Name or pointer of property which name to change. + + @param newName + New name for property. + */ + void SetPropertyName( wxPGPropArg id, const wxString& newName ) + { + wxPG_PROP_ARG_CALL_PROLOG() + m_pState->DoSetPropertyName( p, newName ); + } + /** Sets property (and, recursively, its children) to have read-only value. In other words, user cannot change the value in the editor, but they diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h index 279c12d197..3d6e172525 100644 --- a/include/wx/propgrid/propgridpagestate.h +++ b/include/wx/propgrid/propgridpagestate.h @@ -502,6 +502,8 @@ public: wxPGProperty* DoGetRoot() const { return m_properties; } + void DoSetPropertyName( wxPGProperty* p, const wxString& newName ); + // Returns combined width of margin and all the columns int GetVirtualWidth() const { diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index 0629ec2a18..04a8ac21ad 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -797,17 +797,6 @@ public: */ void SetSplitterPosition( int newxpos, int col = 0 ); - /** - Sets name of a property. - - @param id - Name or pointer of property which name to change. - - @param newname - New name. - */ - void SetPropertyName( wxPGPropArg id, const wxString& newname ); - /** Moves splitter as left as possible, while still allowing all labels to be shown in full. diff --git a/interface/wx/propgrid/propgridiface.h b/interface/wx/propgrid/propgridiface.h index c92b1ac050..02479c777a 100644 --- a/interface/wx/propgrid/propgridiface.h +++ b/interface/wx/propgrid/propgridiface.h @@ -658,6 +658,17 @@ public: */ void SetPropertyModifiedStatus( wxPGPropArg id, bool modified ); + /** + Sets name of a property. + + @param id + Name or pointer of property which name to change. + + @param newName + New name for property. + */ + void SetPropertyName( wxPGPropArg id, const wxString& newName ); + /** Sets property (and, recursively, its children) to have read-only value. In other words, user cannot change the value in the editor, but they can diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 931633ee5a..e161307f77 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1491,18 +1491,6 @@ void wxPropertyGrid::DoSetPropertyValueUnspecified( wxPGProperty* p ) // wxPropertyGrid property operations // ----------------------------------------------------------------------- -void wxPropertyGrid::DoSetPropertyName( wxPGProperty* p, const wxString& newname ) -{ - wxCHECK_RET( p, wxT("invalid property id") ); - - if ( p->GetBaseName().Len() ) m_pState->m_dictName.erase( p->GetBaseName() ); - if ( newname.Len() ) m_pState->m_dictName[newname] = (void*) p; - - p->DoSetName(newname); -} - -// ----------------------------------------------------------------------- - bool wxPropertyGrid::EnsureVisible( wxPGPropArg id ) { wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 18c0369c6c..693d339217 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -448,6 +448,19 @@ wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByName( const wxString& na return (wxPGProperty*) NULL; } +// ----------------------------------------------------------------------- + +void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p, + const wxString& newName ) +{ + wxCHECK_RET( p, wxT("invalid property id") ); + + if ( p->GetBaseName().Len() ) m_dictName.erase( p->GetBaseName() ); + if ( newName.Len() ) m_dictName[newName] = (void*) p; + + p->DoSetName(newName); +} + // ----------------------------------------------------------------------- // wxPropertyGridPageState global operations // ----------------------------------------------------------------------- -- 2.47.2