]> git.saurik.com Git - wxWidgets.git/commitdiff
When registering editor, try wxRTTI class name in additon to result of wxPGEditor...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 6 Oct 2008 15:48:27 +0000 (15:48 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 6 Oct 2008 15:48:27 +0000 (15:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/editors.h
interface/wx/propgrid/editors.h
samples/propgrid/propgrid.cpp
src/propgrid/editors.cpp
src/propgrid/propgrid.cpp

index d9d6b0729dfea486973e843b6bd2a01a53d294ac..fc2ffe4259897c887e0b22b5c9f4deb09e8f2b08 100644 (file)
@@ -92,10 +92,11 @@ public:
 
     /**
         Returns pointer to the name of the editor. For example,
-        wxPGEditor_TextCtrl has name "TextCtrl". This method is autogenerated
-        for custom editors.
+        wxPGEditor_TextCtrl has name "TextCtrl". If you dont' need to access
+        your custom editor by string name, then you do not need to implement
+        this function.
     */
-    virtual wxString GetName() const = 0;
+    virtual wxString GetName() const;
 
     /**
         Instantiates editor controls.
index 173d8e414e91aada0a428df42e25b701955d9331..1b9ff42267bb66791f171971aa3ec23b0ef71853 100644 (file)
@@ -51,9 +51,11 @@ public:
 
     /**
         Returns pointer to the name of the editor. For example,
-        wxPGEditor_TextCtrl has name "TextCtrl".
+        wxPGEditor_TextCtrl has name "TextCtrl". If you dont' need to access
+        your custom editor by string name, then you do not need to implement
+        this function.
     */
-    virtual wxString GetName() const = 0;
+    virtual wxString GetName() const;
 
     /**
         Instantiates editor controls.
index 1eda4866e675389e5371865e09c754bb5adb6d75..26dbfd835d00dae2923e68f52b3ae8135d0a1db6 100644 (file)
@@ -85,8 +85,6 @@ public:
     wxSampleMultiButtonEditor() {}
     virtual ~wxSampleMultiButtonEditor() {}
 
-    virtual wxString GetName() const { return "SampleMultiButtonEditor"; }
-
     virtual wxPGWindowList CreateControls( wxPropertyGrid* propGrid,
                                            wxPGProperty* property,
                                            const wxPoint& pos,
index 2f0f236f8e690058287ec796b454450295971c60..087d92324e479c2469c2e2b3e6605232b5eb5751 100644 (file)
@@ -162,6 +162,11 @@ wxPGEditor::~wxPGEditor()
 {
 }
 
+wxString wxPGEditor::GetName() const
+{
+    return GetClassInfo()->GetClassName();
+}
+
 void wxPGEditor::DrawValue( wxDC& dc, const wxRect& rect, wxPGProperty* property, const wxString& text ) const
 {
     if ( !property->IsValueUnspecified() )
index a21748944e241d44313dd96d0351350d4fc28ce4..e8f7b7b29350c110e0e31e8f294f96c5662a8050 100644 (file)
@@ -5335,6 +5335,13 @@ wxPGEditor* wxPropertyGrid::RegisterEditorClass( wxPGEditor* editorClass,
     // Existing editor under this name?
     wxPGHashMapS2P::iterator vt_it = wxPGGlobalVars->m_mapEditorClasses.find(name);
 
+    if ( vt_it != wxPGGlobalVars->m_mapEditorClasses.end() )
+    {
+        // If this name was already used, try class name.
+        name = editorClass->GetClassInfo()->GetClassName();
+        vt_it = wxPGGlobalVars->m_mapEditorClasses.find(name);
+    }
+
     wxCHECK_MSG( vt_it == wxPGGlobalVars->m_mapEditorClasses.end(),
                  (wxPGEditor*) vt_it->second,
                  "Editor with given name was already registered" );