int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
unsigned int column, bool ascending ) const
{
- // sort branches before leaves
- bool item1_is_container = IsContainer(item1);
- bool item2_is_container = IsContainer(item2);
-
- if (item1_is_container && !item2_is_container)
- return 1;
- if (item2_is_container && !item1_is_container)
- return -1;
-
wxVariant value1,value2;
GetValue( value1, item1, column );
GetValue( value2, item2, column );
return wxDataViewItem( m_hash[row] );
}
-bool wxDataViewIndexListModel::HasDefaultCompare() const
-{
- return !m_ordered;
-}
-
-int wxDataViewIndexListModel::Compare(const wxDataViewItem& item1,
- const wxDataViewItem& item2,
- unsigned int WXUNUSED(column),
- bool ascending) const
-{
- if (m_ordered)
- {
- unsigned int pos1 = wxPtrToUInt(item1.GetID()); // -1 not needed here
- unsigned int pos2 = wxPtrToUInt(item2.GetID()); // -1 not needed here
-
- if (ascending)
- return pos1 - pos2;
- else
- return pos2 - pos1;
- }
-
- if (ascending)
- return GetRow(item1) - GetRow(item2);
-
- return GetRow(item2) - GetRow(item1);
-}
-
unsigned int wxDataViewIndexListModel::GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const
{
if (item.IsOk())
wxPendingDelete.Append(handler);
wxPendingDelete.Append(m_editorCtrl);
+
+ // Ensure that DestroyEditControl() is not called again for this control.
+ m_editorCtrl.Release();
}
void wxDataViewRendererBase::CancelEditing()
return true;
}
+void wxDataViewCtrlBase::StartEditor(const wxDataViewItem& item, unsigned int column)
+{
+ EditItem(item, GetColumn(column));
+}
+
// ---------------------------------------------------------
// wxDataViewEvent
// ---------------------------------------------------------
return m_cols.GetCount();
}
+unsigned int wxDataViewListStore::GetItemCount() const
+{
+ return m_data.size();
+}
+
wxString wxDataViewListStore::GetColumnType( unsigned int pos ) const
{
return m_cols[pos];
}
-void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxClientData *data )
+void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxUIntPtr data )
{
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
line->m_values = values;
RowAppended();
}
-void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxClientData *data )
+void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxUIntPtr data )
{
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
line->m_values = values;
}
void wxDataViewListStore::InsertItem( unsigned int row, const wxVector<wxVariant> &values,
- wxClientData *data )
+ wxUIntPtr data )
{
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
line->m_values = values;
Reset( 0 );
}
+void wxDataViewListStore::SetItemData( const wxDataViewItem& item, wxUIntPtr data )
+{
+ wxDataViewListStoreLine* line = m_data[GetRow(item)];
+ if (!line) return;
+
+ line->SetData( data );
+}
+
+wxUIntPtr wxDataViewListStore::GetItemData( const wxDataViewItem& item ) const
+{
+ wxDataViewListStoreLine* line = m_data[GetRow(item)];
+ if (!line) return static_cast<wxUIntPtr>(NULL);
+
+ return line->GetData();
+}
+
void wxDataViewListStore::GetValueByRow( wxVariant &value, unsigned int row, unsigned int col ) const
{
wxDataViewListStoreLine *line = m_data[row];
wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent_item );
if (!parent_node) return;
- wxDataViewTreeStoreContainerNode *node = FindContainerNode( item );
- if (!node) return;
-
- parent_node->GetChildren().DeleteObject( node );
+ parent_node->GetChildren().DeleteObject( FindNode(item) );
}
void wxDataViewTreeStore::DeleteChildren( const wxDataViewItem& item )