More experimenting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -214,7 +214,14 @@ wxgtk_list_store_get_flags (GtkTreeModel *tree_model)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), 0);
|
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), 0);
|
||||||
|
|
||||||
return GTK_TREE_MODEL_ITERS_PERSIST | GTK_TREE_MODEL_LIST_ONLY;
|
// GTK+ list store uses a linked list for storing the
|
||||||
|
// items and a pointer to a child is used as the member
|
||||||
|
// field of a GtkTreeIter. This means that the iter is
|
||||||
|
// valid in the GtkListStore as long as the child exists.
|
||||||
|
// We use the index of the row and since the index of a
|
||||||
|
// specific row will change if a row above is deleted,
|
||||||
|
// the iter does not persist
|
||||||
|
return /* GTK_TREE_MODEL_ITERS_PERSIST | */ GTK_TREE_MODEL_LIST_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@@ -343,18 +350,22 @@ static gboolean
|
|||||||
wxgtk_list_store_iter_next (GtkTreeModel *tree_model,
|
wxgtk_list_store_iter_next (GtkTreeModel *tree_model,
|
||||||
GtkTreeIter *iter)
|
GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
GtkWxListStore *list_store = (GtkListStore *) tree_model;
|
|
||||||
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), FALSE);
|
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), FALSE);
|
||||||
|
GtkWxListStore *list_store = (GtkListStore *) tree_model;
|
||||||
|
|
||||||
#if 0
|
g_return_val_if_fail (list_store->stamp == iter->stamp, FALSE);
|
||||||
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, FALSE);
|
|
||||||
|
|
||||||
iter->user_data = G_SLIST (iter->user_data)->next;
|
int n = (int) iter->user_data;
|
||||||
|
|
||||||
|
if (n == -1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (n >= (int) list_store->model->GetRowCount())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
iter->user_data = (gpointer) n++;
|
||||||
|
|
||||||
return (iter->user_data != NULL);
|
return TRUE;
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -362,21 +373,17 @@ wxgtk_list_store_iter_children (GtkTreeModel *tree_model,
|
|||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
GtkTreeIter *parent)
|
GtkTreeIter *parent)
|
||||||
{
|
{
|
||||||
/* this is a list, nodes have no children */
|
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), FALSE);
|
||||||
|
GtkWxListStore *list_store = (GtkListStore *) tree_model;
|
||||||
|
|
||||||
|
// this is a list, nodes have no children
|
||||||
if (parent)
|
if (parent)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* but if parent == NULL we return the list itself */
|
iter->stamp = list_store->stamp;
|
||||||
if (GTK_WX_LIST_STORE (tree_model)->root)
|
iter->user_data = (gpointer) -1;
|
||||||
{
|
|
||||||
iter->stamp = GTK_WX_LIST_STORE (tree_model)->stamp;
|
return TRUE;
|
||||||
iter->user_data = GTK_WX_LIST_STORE (tree_model)->root;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -391,11 +398,12 @@ wxgtk_list_store_iter_n_children (GtkTreeModel *tree_model,
|
|||||||
GtkTreeIter *iter)
|
GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), -1);
|
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), -1);
|
||||||
|
GtkWxListStore *list_store = (GtkListStore *) tree_model;
|
||||||
|
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
return GTK_WX_LIST_STORE (tree_model)->model->GetLength();
|
return (gint) list_store->model->GetRowCount();
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_WX_LIST_STORE (tree_model)->stamp == iter->stamp, -1);
|
g_return_val_if_fail (list_store->stamp == iter->stamp, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -406,25 +414,22 @@ wxgtk_list_store_iter_nth_child (GtkTreeModel *tree_model,
|
|||||||
GtkTreeIter *parent,
|
GtkTreeIter *parent,
|
||||||
gint n)
|
gint n)
|
||||||
{
|
{
|
||||||
#if 0
|
g_return_val_if_fail (GTK_IS_WX_LIST_STORE (tree_model), FALSE);
|
||||||
GSList *child;
|
GtkWxListStore *list_store = (GtkListStore *) tree_model;
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
|
if (n < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (n >= (gint) list_store->model->GetRowCount())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (parent)
|
iter->stamp = list_store->stamp;
|
||||||
return FALSE;
|
iter->user_data = (gpointer) n;
|
||||||
|
|
||||||
child = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root), n);
|
return TRUE;
|
||||||
|
|
||||||
if (child)
|
|
||||||
{
|
|
||||||
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
|
|
||||||
iter->user_data = child;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Reference in New Issue
Block a user