]> git.saurik.com Git - wxWidgets.git/commitdiff
Make wxDataViewModel::GetAttr() and GetAttrByRow() const.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Oct 2009 21:42:04 +0000 (21:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Oct 2009 21:42:04 +0000 (21:42 +0000)
This is an incompatible change but having to use a non-const model pointer to
call a clearly logically const version was simply too ugly so change it while
we still can.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/dataview.h
interface/wx/dataview.h
samples/dataview/mymodels.cpp
samples/dataview/mymodels.h

index 6360c90dce213923dd35ba091ece0d94438505a8..2ff3c5021168872979333ab2e4ef2126b4b89c42 100644 (file)
@@ -390,6 +390,10 @@ INCOMPATIBLE CHANGE SINCE 2.9.0
   2.9.0. Please use UseAppInfo(AppInfo_AppName | AppInfo_VendorName) explicitly
   to use the vendor name in the paths returned by wxStandardPaths.
 
+- wxDataViewModel::GetAttr() is now const, as it should have been from the very
+  beginning. You will need to change it to be const in your derived model
+  class too if you override it.
+
 
 All:
 
index 5052a7c0e317f74bfb189b4c18a9c33fdce44c7d..40883720964383ba911e569702a95416c63fc77f 100644 (file)
@@ -210,8 +210,12 @@ public:
     }
 
     // Get text attribute, return false of default attributes should be used
-    virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
-        { return false; }
+    virtual bool GetAttr(const wxDataViewItem &WXUNUSED(item),
+                         unsigned int WXUNUSED(col),
+                         wxDataViewItemAttr &WXUNUSED(attr)) const
+    {
+        return false;
+    }
 
     // define hierachy
     virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0;
@@ -272,7 +276,7 @@ public:
 
     virtual bool
     GetAttrByRow(unsigned WXUNUSED(row), unsigned WXUNUSED(col),
-                 wxDataViewItemAttr &WXUNUSED(attr))
+                 wxDataViewItemAttr &WXUNUSED(attr)) const
     {
         return false;
     }
@@ -310,7 +314,7 @@ public:
     }
 
     virtual bool GetAttr(const wxDataViewItem &item, unsigned int col,
-                         wxDataViewItemAttr &attr)
+                         wxDataViewItemAttr &attr) const
     {
         return GetAttrByRow( GetRow(item), col, attr );
     }
index 669de4c1d68d2b279b40549d4beaa6a4a294b933..d2a9202f3751ee02f2531118d873dd28cbbdfb8d 100644 (file)
@@ -135,10 +135,21 @@ public:
         Override this to indicate that the item has special font attributes.
         This only affects the wxDataViewTextRendererText renderer.
 
+        The base class version always simply returns @false.
+
         @see wxDataViewItemAttr.
+
+        @param item
+            The item for which the attribute is requested.
+        @param col
+            The column of the item for which the attribute is requested.
+        @param attr
+            The attribute to be filled in if the function returns @true.
+        @return
+            @true if this item has an attribute or @false otherwise.
     */
     virtual bool GetAttr(const wxDataViewItem& item, unsigned int col,
-                         wxDataViewItemAttr& attr);
+                         wxDataViewItemAttr& attr) const;
 
     /**
         Override this so the control can query the child items of an item.
@@ -339,10 +350,21 @@ public:
         Override this to indicate that the row has special font attributes.
         This only affects the wxDataViewTextRendererText() renderer.
 
+        The base class version always simply returns @false.
+
         @see wxDataViewItemAttr.
+
+        @param row
+            The row for which the attribute is requested.
+        @param col
+            The column for which the attribute is requested.
+        @param attr
+            The attribute to be filled in if the function returns @true.
+        @return
+            @true if this item has an attribute or @false otherwise.
     */
     virtual bool GetAttrByRow(unsigned int row, unsigned int col,
-                         wxDataViewItemAttr& attr);
+                         wxDataViewItemAttr& attr) const;
 
     /**
         Returns the wxDataViewItem at the given @e row.
index 11ee266e4552e5f25cbf0abc3987b8190a6541f5..3c2f7f4f6451a4279282e765ee6dfdb47616d060 100644 (file)
@@ -433,7 +433,7 @@ void MyListModel::GetValueByRow( wxVariant &variant,
 }
 
 bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
-                                wxDataViewItemAttr &attr )
+                                wxDataViewItemAttr &attr ) const
 {
     switch ( col )
     {
index a078c59150674b825740cb7ce2ddcb76aaa2488a..01084a58c477da815457a584931ffa71da2e8e5d 100644 (file)
@@ -220,7 +220,8 @@ public:
 
     virtual void GetValueByRow( wxVariant &variant,
                                 unsigned int row, unsigned int col ) const;
-    virtual bool GetAttrByRow( unsigned int row, unsigned int col, wxDataViewItemAttr &attr );
+    virtual bool GetAttrByRow( unsigned int row, unsigned int col,
+                               wxDataViewItemAttr &attr ) const;
     virtual bool SetValueByRow( const wxVariant &variant,
                                 unsigned int row, unsigned int col );