// wxDataViewCtrl
// ---------------------------------------------------------
+WX_DECLARE_LIST(wxDataViewColumn, wxDataViewColumnList );
+
class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase,
public wxScrollHelperNative
{
virtual void DoSetExpanderColumn();
virtual void DoSetIndent();
+ 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;
virtual void SetSelections( const wxDataViewItemArray & sel );
virtual void HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) const;
virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const;
+ virtual void Expand( const wxDataViewItem & item );
+ virtual void Collapse( const wxDataViewItem & item );
+
protected:
virtual int GetSelections( wxArrayInt & sel ) const;
virtual void SetSelections( const wxArrayInt & sel );
wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; }
private:
+ wxDataViewColumnList m_cols;
wxDataViewModelNotifier *m_notifier;
wxDataViewMainWindow *m_clientArea;
wxDataViewHeaderWindow *m_headerArea;
// ---------------------------------------------------------
// wxDataViewRendererBase
// ---------------------------------------------------------
+static wxDataViewItem g_item;
IMPLEMENT_ABSTRACT_CLASS(wxDataViewRendererBase, wxObject)
m_editorCtrl->SetFocus();
#endif
+ // Now we should send Editing Started event
+ wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, GetOwner()->GetOwner()->GetId() );
+ event.SetDataViewColumn( GetOwner() );
+ event.SetModel( GetOwner()->GetOwner()->GetModel() );
+ event.SetItem( item );
+ g_item = item;
+ GetOwner()->GetOwner()->GetEventHandler()->ProcessEvent( event );
+
return true;
}
GetOwner()->GetOwner()->GetModel()->ValueChanged( m_item, col );
// m_editorCtrl->PopEventHandler( true );
+
+ // Now we should send Editing Done event
+ wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, GetOwner()->GetOwner()->GetId() );
+ event.SetDataViewColumn( GetOwner() );
+ event.SetModel( GetOwner()->GetOwner()->GetModel() );
+ event.SetItem( g_item );
+ GetOwner()->GetOwner()->GetEventHandler()->ProcessEvent( event );
return true;
}
void DestroyTree();
void HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column );
wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn* column );
+
+ void Expand( unsigned int row ) { OnExpanding( row ); }
+ void Collapse( unsigned int row ) { OnCollapsing( row ); }
private:
wxDataViewTreeNode * GetTreeNodeByRow( unsigned int row );
//We did not need this temporarily
wxDataViewItem item = GetItemByRow( m_currentRow );
m_currentCol->GetRenderer()->StartEditing( item, labelRect );
+
}
//------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxDataViewCtrl
//-----------------------------------------------------------------------------
+WX_DEFINE_LIST(wxDataViewColumnList);
IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase)
if (!wxDataViewCtrlBase::AppendColumn(col))
return false;
+ m_cols.Append( col );
OnColumnChange();
return true;
}
m_clientArea->UpdateDisplay();
}
+unsigned int wxDataViewCtrl::GetColumnCount() const
+{
+ return m_cols.GetCount();
+}
+
+wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const
+{
+ wxDataViewColumnList::const_iterator iter;
+ int i = 0;
+ for (iter = m_cols.begin(); iter!=m_cols.end(); iter++)
+ {
+ if (i == pos)
+ return *iter;
+
+ if ((*iter)->IsHidden())
+ continue;
+ i ++;
+ }
+ return NULL;
+}
+
+bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
+{
+ wxDataViewColumnList::Node * ret = m_cols.Find( column );
+ if (ret == NULL)
+ return false;
+
+ m_cols.Erase(ret);
+ delete column;
+ OnColumnChange();
+
+ return true;
+}
+
+bool wxDataViewCtrl::ClearColumns()
+{
+ m_cols.clear();
+ OnColumnChange();
+ return true;
+}
+
//Selection code with wxDataViewItem as parameters
wxDataViewItem wxDataViewCtrl::GetSelection() const
{
return m_clientArea->GetRowByItem( item );
}
+void wxDataViewCtrl::Expand( const wxDataViewItem & item )
+{
+ int row = m_clientArea->GetRowByItem( item );
+ if (row != -1)
+ m_clientArea->Expand(row);
+}
+
+void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
+{
+ int row = m_clientArea->GetRowByItem( item );
+ if (row != -1)
+ m_clientArea->Collapse(row);
+}
+
#endif
// !wxUSE_GENERICDATAVIEWCTRL