diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 9162cd9d0d..c94c8fe3c1 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -755,6 +755,12 @@ public: virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; } + // Set the colour used for the "alternate" rows when wxDV_ROW_LINES is on. + // Also only supported in the generic version, which returns true to + // indicate it. + virtual bool SetAlternateRowColour(const wxColour& WXUNUSED(colour)) + { return false; } + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h index 5efc0e1eec..6fe74d55db 100644 --- a/include/wx/generic/dataview.h +++ b/include/wx/generic/dataview.h @@ -277,10 +277,11 @@ public: virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE; - // These methods are specific to generic wxDataViewCtrl implementation and + virtual bool SetAlternateRowColour(const wxColour& colour) wxOVERRIDE; + + // This method is specific to generic wxDataViewCtrl implementation and // should not be used in portable code. wxColour GetAlternateRowColour() const { return m_alternateRowColour; } - void SetAlternateRowColour(const wxColour& colour); // The returned pointer is null if the control has wxDV_NO_HEADER style. // diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 8c2b303bdc..90c9f1b6d6 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1566,6 +1566,21 @@ public: */ virtual void SelectAll(); + /** + Set custom colour for the alternate rows used with wxDV_ROW_LINES + style. + + Note that calling this method has no effect if wxDV_ROW_LINES is off. + + @param colour The colour to use for the alternate rows. + @return @true if customizing this colour is supported (currently only + in the generic version), @false if this method is not implemented + under this platform. + + @since 3.1.1 + */ + bool SetAlternateRowColour(const wxColour& colour); + /** Set which column shall contain the tree-like expanders. */ diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index d9840af8ab..298ff6bcb8 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -5781,9 +5781,10 @@ bool wxDataViewCtrl::SetHeaderAttr(const wxItemAttr& attr) return true; } -void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) +bool wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) { m_alternateRowColour = colour; + return true; } void wxDataViewCtrl::SelectAll()