gboolean wxDataViewCtrlInternal::get_iter( GtkTreeIter *iter, GtkTreePath *path )
{
+
if (m_wx_model->IsVirtualListModel())
{
- wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
-
+ wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model;
+
unsigned int i = (unsigned int)gtk_tree_path_get_indices (path)[0];
-
- if (i >= wx_model->GetLastIndex() + 1)
+
+ if (i >= wx_model->GetCount())
return FALSE;
iter->stamp = m_gtk_model->stamp;
- // user_data is just the index
- iter->user_data = (gpointer) i;
+ // user_data is just the index +1
+ iter->user_data = (gpointer) (i+1);
return TRUE;
}
if (m_wx_model->IsVirtualListModel())
{
- // user_data is just the index
- int i = (wxUIntPtr) iter->user_data;
+ // user_data is just the index +1
+ int i = ( (wxUIntPtr) iter->user_data ) -1;
gtk_tree_path_append_index (retval, i);
}
else
{
if (m_wx_model->IsVirtualListModel())
{
- wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
+ wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model;
- int n = (wxUIntPtr) iter->user_data;
+ // user_data is just the index +1
+ int n = ( (wxUIntPtr) iter->user_data ) -1;
if (n == -1)
return FALSE;
- if (n >= (int) wx_model->GetLastIndex())
+ if (n >= (int) wx_model->GetCount())
return FALSE;
- iter->user_data = (gpointer) ++n;
+ // user_data is just the index +1 (+2 because we need the next)
+ iter->user_data = (gpointer) (n+2);
}
else
{
return FALSE;
iter->stamp = m_gtk_model->stamp;
- iter->user_data = (gpointer) -1;
+ iter->user_data = (gpointer) 1;
return TRUE;
}
{
if (m_wx_model->IsVirtualListModel())
{
+ wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model;
+
+ if (iter == NULL)
+ return (gint) wx_model->GetCount();
+
// this is a list, nodes have no children
return FALSE;
}
{
if (m_wx_model->IsVirtualListModel())
{
- wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
+ wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model;
if (iter == NULL)
- return (gint) wx_model->GetLastIndex() + 1;
+ return (gint) wx_model->GetCount();
return 0;
}
{
if (m_wx_model->IsVirtualListModel())
{
- wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
+ wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model;
if (parent)
return FALSE;
if (n < 0)
return FALSE;
- if (n >= (gint) wx_model->GetLastIndex() + 1)
+ if (n >= (gint) wx_model->GetCount())
return FALSE;
iter->stamp = m_gtk_model->stamp;
- iter->user_data = (gpointer) n;
+ // user_data is just the index +1
+ iter->user_data = (gpointer) (n+1);
return TRUE;
}