Add optional columns autosizing to wxDataViewCtrl.
Only implemented in the generic and GTK+ versions at the moment, OS X support will be added later. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3205,23 +3205,20 @@ int wxDataViewColumn::GetWidth() const
|
||||
|
||||
void wxDataViewColumn::SetWidth( int width )
|
||||
{
|
||||
if (width < 0)
|
||||
if ( width == wxCOL_WIDTH_AUTOSIZE )
|
||||
{
|
||||
#if 1
|
||||
gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_FIXED );
|
||||
|
||||
// TODO find a better calculation
|
||||
gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), wxDVC_DEFAULT_WIDTH );
|
||||
#else
|
||||
// this is unpractical for large numbers of items and disables
|
||||
// user resizing, which is totally unexpected
|
||||
// NB: this disables user resizing
|
||||
gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_AUTOSIZE );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_FIXED );
|
||||
if ( width == wxCOL_WIDTH_DEFAULT )
|
||||
{
|
||||
// TODO find a better calculation
|
||||
width = wxDVC_DEFAULT_WIDTH;
|
||||
}
|
||||
|
||||
gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_FIXED );
|
||||
gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), width );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user