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:
@@ -182,7 +182,7 @@ Collapses the item.
|
||||
|
||||
\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
|
||||
|
||||
\func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}
|
||||
\func{virtual bool}{DeleteColumn}{\param{const wxDataViewColumn* }{column}}
|
||||
|
||||
Deletes given column.
|
||||
|
||||
@@ -196,7 +196,9 @@ Expands the item.
|
||||
|
||||
\constfunc{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
|
||||
|
||||
Returns pointer to the column.
|
||||
Returns pointer to the column. {\it pos} refers to the
|
||||
position in the control which may change after reordering
|
||||
columns by the user.
|
||||
|
||||
\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
|
||||
|
||||
|
@@ -459,11 +459,11 @@ public:
|
||||
|
||||
virtual bool AppendColumn( wxDataViewColumn *col );
|
||||
|
||||
virtual unsigned int GetColumnCount() const;
|
||||
virtual unsigned int GetColumnCount() const = 0;
|
||||
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0;
|
||||
|
||||
virtual bool DeleteColumn( unsigned int pos );
|
||||
virtual bool ClearColumns();
|
||||
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
|
||||
virtual bool DeleteColumn( wxDataViewColumn *column ) = 0;
|
||||
virtual bool ClearColumns() = 0;
|
||||
|
||||
void SetExpanderColumn( wxDataViewColumn *col )
|
||||
{ m_expander_column = col ; DoSetExpanderColumn(); }
|
||||
@@ -499,7 +499,6 @@ protected:
|
||||
|
||||
private:
|
||||
wxDataViewModel *m_model;
|
||||
wxList m_cols;
|
||||
wxDataViewColumn *m_expander_column;
|
||||
int m_indent ;
|
||||
|
||||
|
@@ -275,6 +275,8 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(wxDataViewColumn, wxDataViewColumnList );
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCtrl
|
||||
// ---------------------------------------------------------
|
||||
@@ -305,7 +307,12 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator );
|
||||
|
||||
virtual bool AssociateModel( wxDataViewModel *model );
|
||||
|
||||
virtual bool AppendColumn( wxDataViewColumn *col );
|
||||
virtual unsigned int GetColumnCount() const;
|
||||
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
|
||||
virtual bool DeleteColumn( wxDataViewColumn *column );
|
||||
virtual bool ClearColumns();
|
||||
|
||||
virtual wxDataViewItem GetSelection() const;
|
||||
virtual int GetSelections( wxDataViewItemArray & sel ) const;
|
||||
@@ -346,6 +353,7 @@ private:
|
||||
GtkWidget *m_treeview;
|
||||
wxDataViewModelNotifier *m_notifier;
|
||||
wxDataViewCtrlInternal *m_internal;
|
||||
wxDataViewColumnList m_cols;
|
||||
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
@@ -539,18 +539,12 @@ IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl)
|
||||
wxDataViewCtrlBase::wxDataViewCtrlBase()
|
||||
{
|
||||
m_model = NULL;
|
||||
m_cols.DeleteContents( true );
|
||||
m_expander_column = 0;
|
||||
m_indent = 8;
|
||||
}
|
||||
|
||||
wxDataViewCtrlBase::~wxDataViewCtrlBase()
|
||||
{
|
||||
// IMPORTANT: before calling DecRef() on our model (since it may
|
||||
// result in a free() call), erase all columns (since
|
||||
// they hold a pointer to our model)
|
||||
m_cols.Clear();
|
||||
|
||||
if (m_model)
|
||||
{
|
||||
m_model->DecRef();
|
||||
@@ -694,34 +688,10 @@ wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int mode
|
||||
bool
|
||||
wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
|
||||
{
|
||||
m_cols.Append( (wxObject*) col );
|
||||
col->SetOwner( (wxDataViewCtrl*) this );
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int wxDataViewCtrlBase::GetColumnCount() const
|
||||
{
|
||||
return m_cols.GetCount();
|
||||
}
|
||||
|
||||
bool wxDataViewCtrlBase::DeleteColumn( unsigned int WXUNUSED(pos) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxDataViewCtrlBase::ClearColumns()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxDataViewColumn* wxDataViewCtrlBase::GetColumn( unsigned int pos ) const
|
||||
{
|
||||
if( pos >= m_cols.GetCount() )
|
||||
return NULL;
|
||||
|
||||
return (wxDataViewColumn*) m_cols[ pos ];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewEvent
|
||||
// ---------------------------------------------------------
|
||||
|
@@ -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,9 +2989,61 @@ 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user