Add GTK implementation of wxDataViewCtrl::GetItemRect()
This function returns a wxRect of the given wxDataViewItem. If no column is provided, the width will be the sum of all the visible columns widths. See https://github.com/wxWidgets/wxWidgets/pull/990
This commit is contained in:
committed by
Vadim Zeitlin
parent
12f8ab20f9
commit
94a2595f5b
@@ -5289,10 +5289,36 @@ void wxDataViewCtrl::HitTest(const wxPoint& point,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxRect
|
wxRect
|
||||||
wxDataViewCtrl::GetItemRect(const wxDataViewItem& WXUNUSED(item),
|
wxDataViewCtrl::GetItemRect(const wxDataViewItem& item,
|
||||||
const wxDataViewColumn *WXUNUSED(column)) const
|
const wxDataViewColumn *column) const
|
||||||
{
|
{
|
||||||
|
if ( !item )
|
||||||
return wxRect();
|
return wxRect();
|
||||||
|
|
||||||
|
GtkTreeViewColumn *gcolumn = NULL ;
|
||||||
|
if (column)
|
||||||
|
gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
|
||||||
|
|
||||||
|
GtkTreeIter iter;
|
||||||
|
iter.user_data = item.GetID();
|
||||||
|
wxGtkTreePath path(m_internal->get_path( &iter ));
|
||||||
|
|
||||||
|
GdkRectangle item_rect;
|
||||||
|
gtk_tree_view_get_background_area(GTK_TREE_VIEW(m_treeview), path, gcolumn, &item_rect);
|
||||||
|
// If column is NULL we compute the combined width of all the columns
|
||||||
|
if ( !column )
|
||||||
|
{
|
||||||
|
unsigned int cols = GetColumnCount();
|
||||||
|
int width = 0;
|
||||||
|
for (unsigned int i = 0; i < cols; ++i)
|
||||||
|
{
|
||||||
|
wxDataViewColumn * col = GetColumn(i);
|
||||||
|
if ( !col->IsHidden() )
|
||||||
|
width += col->GetWidth();
|
||||||
|
}
|
||||||
|
item_rect.width = width;
|
||||||
|
}
|
||||||
|
return wxRectFromGDKRect(&item_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDataViewCtrl::SetRowHeight(int rowHeight)
|
bool wxDataViewCtrl::SetRowHeight(int rowHeight)
|
||||||
|
Reference in New Issue
Block a user