]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxDataViewCtrl::SetRowHeight() and provide its generic implementation.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 7 Jun 2011 22:49:56 +0000 (22:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 7 Jun 2011 22:49:56 +0000 (22:49 +0000)
Allow changing the (fixed) row height without using wxDV_VARIABLE_LINE_HEIGHT
which may slow down the control display too much.

The new method is not implemented for the native GTK and OS X implementations
yet but should be simple to implement there.

See #12749.

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

include/wx/dataview.h
include/wx/generic/dataview.h
interface/wx/dataview.h
src/generic/datavgen.cpp

index 13f91f3882da774de082e24370e2e9436b300404..d816a2c5583b9a05bb087ebd0eda36124bbfdf2b 100644 (file)
@@ -700,7 +700,9 @@ public:
                                 const wxDataViewColumn *column = NULL ) = 0;
     virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
     virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
-    
+
+    virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; }
+
     virtual void StartEditor( const wxDataViewItem & WXUNUSED(item),
                               unsigned int WXUNUSED(column) )
         { }
index 16117adb457760a20bca8715297202019c26297b..f56f2a5ffcef2bb323633b7f683b9e31c1ae29fb 100644 (file)
@@ -172,6 +172,8 @@ public:
     virtual wxRect GetItemRect( const wxDataViewItem & item,
                                 const wxDataViewColumn *column = NULL ) const;
 
+    virtual bool SetRowHeight( int rowHeight );
+
     virtual void Expand( const wxDataViewItem & item );
     virtual void Collapse( const wxDataViewItem & item );
     virtual bool IsExpanded( const wxDataViewItem & item ) const;
index 1d2ab0a8a5edd85e356b0fedcd30b0cdd0e1bf98..37404e1d1f188f0b546cddfcabbb8e535c4b1924 100644 (file)
@@ -1113,6 +1113,22 @@ public:
         This method only has effect if multiple selections are allowed.
     */
     virtual void UnselectAll();
+
+    /**
+        Sets the row height.
+
+        This function can only be used when all rows have the same height, i.e.
+        when wxDV_VARIABLE_LINE_HEIGHT flag is not used.
+
+        Currently this is implemented in the generic version only and nothing
+        is done (and @false returned) when using the native GTK or OS X
+        versions.
+
+        @return @true if the line height was changed or @false otherwise.
+
+        @since 2.9.2
+    */
+    virtual bool SetRowHeight(int rowHeight);
 };
 
 
index 673a83b7657fa5bb8dfe86927ab095b24b56016f..7f75fdacd5cc96b99ec96c295351aa418549b4dd 100644 (file)
@@ -532,6 +532,8 @@ public:
     int GetLineHeight( unsigned int row ) const; // m_lineHeight in fixed mode
     int GetLineAt( unsigned int y ) const;       // y / m_lineHeight in fixed mode
 
+    void SetRowHeight( int lineHeight ) { m_lineHeight = lineHeight; }
+
     // Some useful functions for row and item mapping
     wxDataViewItem GetItemByRow( unsigned int row ) const;
     int GetRowByItem( const wxDataViewItem & item ) const;
@@ -4124,6 +4126,16 @@ unsigned int wxDataViewCtrl::GetColumnCount() const
     return m_cols.GetCount();
 }
 
+bool wxDataViewCtrl::SetRowHeight( int lineHeight )
+{
+    if ( !m_clientArea )
+        return false;
+
+    m_clientArea->SetRowHeight(lineHeight);
+
+    return true;
+}
+
 wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int idx ) const
 {
     return m_cols[idx];