From 9ab5cd82265223372ae35d8e765d138a0e246a6c Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Fri, 12 Jun 2009 13:39:36 +0000 Subject: [PATCH] For needs of wxPython bindings, (re)added a version of RegisterEditorClass() that accepts a custom name for editor. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_9_0_BRANCH@61014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/propgrid.h | 9 ++++++++- src/propgrid/propgrid.cpp | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 3c6c604055..880c2251c6 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -902,7 +902,14 @@ public: Pointer to the editor class instance that should be used. */ static wxPGEditor* RegisterEditorClass( wxPGEditor* editor, - bool noDefCheck = false ); + bool noDefCheck = false ) + { + return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck); + } + + static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass, + const wxString& editorName, + bool noDefCheck = false ); #endif /** Resets all colours to the original system values. diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index cb94580aff..dc3980c4d1 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5058,15 +5058,18 @@ void wxPropertyGrid::OnCaptureChange( wxMouseCaptureChangedEvent& WXUNUSED(event // ----------------------------------------------------------------------- // noDefCheck = true prevents infinite recursion. -wxPGEditor* wxPropertyGrid::RegisterEditorClass( wxPGEditor* editorClass, - bool noDefCheck ) +wxPGEditor* wxPropertyGrid::DoRegisterEditorClass( wxPGEditor* editorClass, + const wxString& editorName, + bool noDefCheck ) { wxASSERT( editorClass ); if ( !noDefCheck && wxPGGlobalVars->m_mapEditorClasses.empty() ) RegisterDefaultEditors(); - wxString name = editorClass->GetName(); + wxString name = editorName; + if ( name.length() == 0 ) + name = editorClass->GetName(); // Existing editor under this name? wxPGHashMapS2P::iterator vt_it = wxPGGlobalVars->m_mapEditorClasses.find(name);