]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxPGChoices::Copy(), tweaked related documentation
authorJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 26 Jan 2009 17:28:29 +0000 (17:28 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 26 Jan 2009 17:28:29 +0000 (17:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
interface/wx/propgrid/property.h

index 176db3d61ee0e0c1af93e891659222d32772cbb6..fb4dc1cae2e07f337c5178212d04bcec591693c7 100644 (file)
@@ -737,6 +737,11 @@ private:
     Helper class for managing choices of wxPropertyGrid properties.
     Each entry can have label, value, bitmap, text colour, and background
     colour.
     Helper class for managing choices of wxPropertyGrid properties.
     Each entry can have label, value, bitmap, text colour, and background
     colour.
+    wxPGChoices uses reference counting, similar to other wxWidgets classes.
+    This means that assignment operator and copy constructor only copy the
+    reference and not the actual data. Use Copy() member function to create a
+    real copy.
 
     @remarks If you do not specify value for entry, index is used.
 
 
     @remarks If you do not specify value for entry, index is used.
 
@@ -754,7 +759,10 @@ public:
         Init();
     }
 
         Init();
     }
 
-    /** Copy constructor. */
+    /**
+        Copy constructor, uses reference counting. To create a real copy,
+        use Copy() member function instead.
+    */
     wxPGChoices( const wxPGChoices& a )
     {
         if ( a.m_data != wxPGChoicesEmptyData )
     wxPGChoices( const wxPGChoices& a )
     {
         if ( a.m_data != wxPGChoicesEmptyData )
@@ -853,6 +861,10 @@ public:
     wxPGChoiceEntry& AddAsSorted( const wxString& label,
                                   int value = wxPG_INVALID_VALUE );
 
     wxPGChoiceEntry& AddAsSorted( const wxString& label,
                                   int value = wxPG_INVALID_VALUE );
 
+    /**
+        Assigns choices data, using reference counting. To create a real copy,
+        use Copy() member function instead.
+    */
     void Assign( const wxPGChoices& a )
     {
         AssignData(a.m_data);
     void Assign( const wxPGChoices& a )
     {
         AssignData(a.m_data);
@@ -867,6 +879,17 @@ public:
             m_data->Clear();
     }
 
             m_data->Clear();
     }
 
+    /**
+        Returns a real copy of the choices.
+    */
+    wxPGChoices Copy() const
+    {
+        wxPGChoices dst;
+        dst.EnsureData();
+        dst.m_data->CopyDataFrom(m_data);
+        return dst;
+    }
+
     void EnsureData()
     {
         if ( m_data == wxPGChoicesEmptyData )
     void EnsureData()
     {
         if ( m_data == wxPGChoicesEmptyData )
index 372e6d401e33df9e119938ee594ef99886cb2c3f..a8f1465f349a9f5ff79fe2bd27a9d1c86778d6ce 100644 (file)
@@ -1425,7 +1425,15 @@ public:
     @class wxPGChoices
 
     Helper class for managing choices of wxPropertyGrid properties.
     @class wxPGChoices
 
     Helper class for managing choices of wxPropertyGrid properties.
-    Each entry can have label, value, bitmap, text colour, and background colour.
+    Each entry can have label, value, bitmap, text colour, and background
+    colour.
+    wxPGChoices uses reference counting, similar to other wxWidgets classes.
+    This means that assignment operator and copy constructor only copy the
+    reference and not the actual data. Use Copy() member function to create a
+    real copy.
+
+    @remarks If you do not specify value for entry, index is used.
 
     @library{wxpropgrid}
     @category{propgrid}
 
     @library{wxpropgrid}
     @category{propgrid}
@@ -1440,7 +1448,10 @@ public:
     */
     wxPGChoices();
 
     */
     wxPGChoices();
 
-    /** Copy constructor. */
+    /**
+        Copy constructor, uses reference counting. To create a real copy,
+        use Copy() member function instead.
+    */
     wxPGChoices( const wxPGChoices& a );
 
     /** Constructor. */
     wxPGChoices( const wxPGChoices& a );
 
     /** Constructor. */
@@ -1481,7 +1492,8 @@ public:
     wxPGChoiceEntry& AddAsSorted( const wxString& label, int value = wxPG_INVALID_VALUE );
 
     /**
     wxPGChoiceEntry& AddAsSorted( const wxString& label, int value = wxPG_INVALID_VALUE );
 
     /**
-        Assigns data from another set of choices.
+        Assigns choices data, using reference counting. To create a real copy,
+        use Copy() member function instead.
     */
     void Assign( const wxPGChoices& a );
 
     */
     void Assign( const wxPGChoices& a );
 
@@ -1495,6 +1507,11 @@ public:
     */
     void Clear();
 
     */
     void Clear();
 
+    /**
+        Returns a real copy of the choices.
+    */
+    wxPGChoices Copy() const;
+
     /**
         Returns labe of item.
     */
     /**
         Returns labe of item.
     */