Implement wxDataViewCtrl::SetRowHeight() for wxGTK.
Also document that this method can only be used to increase the row height compared to the default, not to make it smaller. See #12749. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
16a7d8a5a5
commit
0f4a54a655
@ -158,7 +158,9 @@ public:
|
||||
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 );
|
||||
@ -182,6 +184,8 @@ public:
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
int GTKGetUniformRowHeight() const { return m_uniformRowHeight; }
|
||||
|
||||
protected:
|
||||
virtual void DoSetExpanderColumn();
|
||||
virtual void DoSetIndent();
|
||||
@ -209,6 +213,11 @@ private:
|
||||
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();
|
||||
|
@ -1120,9 +1120,13 @@ public:
|
||||
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.
|
||||
|
||||
|
@ -1333,6 +1333,17 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer,
|
||||
|
||||
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;
|
||||
@ -4473,6 +4484,8 @@ void wxDataViewCtrl::Init()
|
||||
m_internal = NULL;
|
||||
|
||||
m_cols.DeleteContents( true );
|
||||
|
||||
m_uniformRowHeight = -1;
|
||||
}
|
||||
|
||||
bool wxDataViewCtrl::Create(wxWindow *parent,
|
||||
@ -5103,6 +5116,12 @@ wxDataViewCtrl::GetItemRect(const wxDataViewItem& WXUNUSED(item),
|
||||
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),
|
||||
|
Loading…
Reference in New Issue
Block a user