Move column organizing code to ports, away from common code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-08-26 10:05:16 +00:00
parent b1a3a96499
commit 91a6c65558
5 changed files with 75 additions and 41 deletions

View File

@@ -1977,6 +1977,9 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column,
IMPLEMENT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(wxDataViewColumnList);
wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *cell,
unsigned int model_column, int width,
wxAlignment align, int flags ) :
@@ -2986,13 +2989,65 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
if (!wxDataViewCtrlBase::AppendColumn(col))
return false;
GtkTreeViewColumn *column = (GtkTreeViewColumn *)col->GetGtkHandle();
m_cols.Append( col );
gtk_tree_view_append_column( GTK_TREE_VIEW(m_treeview), column );
gtk_tree_view_append_column( GTK_TREE_VIEW(m_treeview),
GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) );
return true;
}
unsigned int wxDataViewCtrl::GetColumnCount() const
{
return m_cols.GetCount();
}
wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const
{
GtkTreeViewColumn *gtk_col = gtk_tree_view_get_column( GTK_TREE_VIEW(m_treeview), pos );
if (!gtk_col)
return NULL;
wxDataViewColumnList::const_iterator iter;
for (iter = m_cols.begin(); iter != m_cols.end(); iter++)
{
wxDataViewColumn *col = *iter;
if (GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) == gtk_col)
{
return col;
}
}
return NULL;
}
bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
{
gtk_tree_view_remove_column( GTK_TREE_VIEW(m_treeview),
GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()) );
m_cols.remove( column );
delete column;
return true;
}
bool wxDataViewCtrl::ClearColumns()
{
wxDataViewColumnList::iterator iter;
for (iter = m_cols.begin(); iter != m_cols.end(); iter++)
{
wxDataViewColumn *col = *iter;
gtk_tree_view_remove_column( GTK_TREE_VIEW(m_treeview),
GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) );
}
m_cols.clear();
return true;
}
void wxDataViewCtrl::Expand( const wxDataViewItem & item )
{
GtkTreeIter iter;