wxDataViewColumn *&column ) const;
virtual wxRect GetItemRect( const wxDataViewItem &item,
const wxDataViewColumn *column = NULL ) const;
-
+
+ virtual bool SetRowHeight( int rowHeight );
+
virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
virtual void Expand( const wxDataViewItem & item );
virtual void OnInternalIdle();
+ int GTKGetUniformRowHeight() const { return m_uniformRowHeight; }
+
protected:
virtual void DoSetExpanderColumn();
virtual void DoSetIndent();
wxDataViewColumnList m_cols;
wxDataViewItem m_ensureVisibleDefered;
+ // By default this is set to -1 and the height of the rows is determined by
+ // GetRect() methods of the renderers but this can be set to a positive
+ // value to force the height of all rows to the given value.
+ int m_uniformRowHeight;
+
virtual void AddChildGTK(wxWindowGTK* child);
void GtkEnableSelectionEvents();
void GtkDisableSelectionEvents();
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.
+ Currently this is implemented in the generic and native GTK versions
+ only and nothing is done (and @false returned) when using OS X port.
+
+ Also notice that this method can only be used to increase the row
+ height compared with the default one (as determined by the return value
+ of wxDataViewRenderer::GetSize()), if it is set to a too small value
+ then the minimum required by the renderers will be used.
@return @true if the line height was changed or @false otherwise.
wxSize size = cell->GetSize();
+ wxDataViewCtrl * const ctrl = cell->GetOwner()->GetOwner();
+
+ // Uniform row height, if specified, overrides the value returned by the
+ // renderer.
+ if ( !ctrl->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
+ {
+ const int uniformHeight = ctrl->GTKGetUniformRowHeight();
+ if ( uniformHeight > 0 )
+ size.y = uniformHeight;
+ }
+
int xpad, ypad;
gtk_cell_renderer_get_padding(renderer, &xpad, &ypad);
int calc_width = xpad * 2 + size.x;
m_internal = NULL;
m_cols.DeleteContents( true );
+
+ m_uniformRowHeight = -1;
}
bool wxDataViewCtrl::Create(wxWindow *parent,
return wxRect();
}
+bool wxDataViewCtrl::SetRowHeight(int rowHeight)
+{
+ m_uniformRowHeight = rowHeight;
+ return true;
+}
+
void wxDataViewCtrl::DoSetExpanderColumn()
{
gtk_tree_view_set_expander_column( GTK_TREE_VIEW(m_treeview),