added Collapse() and Expand()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-08-25 21:05:51 +00:00
parent d14e1c3a1a
commit f71d3ba46c
3 changed files with 27 additions and 3 deletions

View File

@@ -485,6 +485,9 @@ public:
virtual void SelectAll() = 0;
virtual void UnselectAll() = 0;
virtual void Expand( const wxDataViewItem & item ) = 0;
virtual void Collapse( const wxDataViewItem & item ) = 0;
virtual void EnsureVisible( const wxDataViewItem & item,
const wxDataViewColumn *column = NULL ) = 0;
virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;

View File

@@ -34,15 +34,16 @@ public:
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
// implementation
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
virtual void SetMode( wxDataViewCellMode mode );
virtual wxDataViewCellMode GetMode() const;
virtual void SetAlignment( int align );
virtual int GetAlignment() const;
// implementation
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
void GtkInitHandlers();
protected:
GtkCellRenderer *m_renderer;
@@ -323,6 +324,8 @@ public:
virtual wxRect GetItemRect( const wxDataViewItem &item,
const wxDataViewColumn *column = NULL ) const;
virtual void Expand( const wxDataViewItem & item );
virtual void Collapse( const wxDataViewItem & item );
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);

View File

@@ -2993,6 +2993,24 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
return true;
}
void wxDataViewCtrl::Expand( const wxDataViewItem & item )
{
GtkTreeIter iter;
iter.user_data = item.GetID();
GtkTreePath *path = m_internal->get_path( &iter );
gtk_tree_view_expand_row( GTK_TREE_VIEW(m_treeview), path, false );
gtk_tree_path_free( path );
}
void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
{
GtkTreeIter iter;
iter.user_data = item.GetID();
GtkTreePath *path = m_internal->get_path( &iter );
gtk_tree_view_collapse_row( GTK_TREE_VIEW(m_treeview), path );
gtk_tree_path_free( path );
}
wxDataViewItem wxDataViewCtrl::GetSelection() const
{
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );