2001-01-04  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
	this

	* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
	user_data instead of tree_node

	* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
	TREE_VIEW_COLUMN_SIZE

	* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
	"size" field to "width" finishes bug 40061

	* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
	for bitfields, bug 40268
This commit is contained in:
Havoc Pennington
2001-01-04 23:36:19 +00:00
committed by Havoc Pennington
parent c020b3b4f8
commit ae89b1e1b1
19 changed files with 309 additions and 185 deletions

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -1,3 +1,20 @@
2001-01-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeselection.c (gtk_tree_selection_get_tree_view): add
this
* gtk/gtktreemodel.h (struct _GtkTreeIter): rename fields to
user_data instead of tree_node
* gtk/gtktreeprivate.h (TREE_VIEW_COLUMN_WIDTH): rename from
TREE_VIEW_COLUMN_SIZE
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): rename
"size" field to "width" finishes bug 40061
* gtk/gtkcellrenderer.h: Use GtkCellRendererState instead of guint
for bitfields, bug 40268
2001-01-04 Havoc Pennington <hp@redhat.com>
Rename some stuff:

View File

@ -212,13 +212,13 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
}
void
gtk_cell_renderer_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags)
gtk_cell_renderer_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags)
{
/* It's actually okay to pass in a NULL cell, as we run into that
* a lot
@ -238,13 +238,13 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
}
gint
gtk_cell_renderer_event (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags)
gtk_cell_renderer_event (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags)
{
/* It's actually okay to pass in a NULL cell, as we run into that
* a lot

View File

@ -65,43 +65,43 @@ struct _GtkCellRendererClass
GtkWidget *widget,
gint *width,
gint *height);
void (* render) (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
gint (* event) (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags);
void (* render) (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags);
gint (* event) (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags);
};
GtkType gtk_cell_renderer_get_type (void);
void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
gint *width,
gint *height);
void gtk_cell_renderer_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
gint gtk_cell_renderer_event (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags);
void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
gint *width,
gint *height);
void gtk_cell_renderer_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags);
gint gtk_cell_renderer_event (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
gchar *path,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags);
#ifdef __cplusplus
}

View File

@ -280,10 +280,10 @@ gtk_list_store_get_iter (GtkTreeModel *tree_model,
g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
iter->tree_node = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root),
iter->user_data = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root),
gtk_tree_path_get_indices (path)[0]);
return iter->tree_node != NULL;
return iter->user_data != NULL;
}
static GtkTreePath *
@ -299,7 +299,7 @@ gtk_list_store_get_path (GtkTreeModel *tree_model,
for (list = G_SLIST (GTK_LIST_STORE (tree_model)->root); list; list = list->next)
{
if (list == G_SLIST (iter->tree_node))
if (list == G_SLIST (iter->user_data))
break;
i++;
}
@ -324,7 +324,7 @@ gtk_list_store_get_value (GtkTreeModel *tree_model,
g_return_if_fail (column < GTK_LIST_STORE (tree_model)->n_columns);
g_return_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp);
list = G_SLIST (iter->tree_node)->data;
list = G_SLIST (iter->user_data)->data;
while (tmp_column-- > 0 && list)
list = list->next;
@ -344,9 +344,9 @@ gtk_list_store_iter_next (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, FALSE);
iter->tree_node = G_SLIST (iter->tree_node)->next;
iter->user_data = G_SLIST (iter->user_data)->next;
return (iter->tree_node != NULL);
return (iter->user_data != NULL);
}
static gboolean
@ -355,7 +355,7 @@ gtk_list_store_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *parent)
{
iter->stamp = 0;
iter->tree_node = NULL;
iter->user_data = NULL;
return FALSE;
}
@ -389,18 +389,18 @@ gtk_list_store_iter_nth_child (GtkTreeModel *tree_model,
{
g_return_val_if_fail (iter->stamp == GTK_LIST_STORE (tree_model)->stamp, FALSE);
iter->stamp = 0;
iter->tree_node = NULL;
iter->user_data = NULL;
return FALSE;
}
iter->tree_node = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root), n);
if (iter->tree_node)
iter->user_data = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root), n);
if (iter->user_data)
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
else
iter->stamp = 0;
return (iter->tree_node != NULL);
return (iter->user_data != NULL);
}
static gboolean
@ -409,7 +409,7 @@ gtk_list_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *child)
{
iter->stamp = 0;
iter->tree_node = NULL;
iter->user_data = NULL;
return FALSE;
}
@ -432,7 +432,7 @@ gtk_list_store_set_cell (GtkListStore *list_store,
g_return_if_fail (iter != NULL);
g_return_if_fail (column >= 0 && column < list_store->n_columns);
prev = list = G_SLIST (iter->tree_node)->data;
prev = list = G_SLIST (iter->user_data)->data;
while (list != NULL)
{
@ -450,9 +450,9 @@ gtk_list_store_set_cell (GtkListStore *list_store,
list = list->next;
}
if (G_SLIST (iter->tree_node)->data == NULL)
if (G_SLIST (iter->user_data)->data == NULL)
{
G_SLIST (iter->tree_node)->data = list = _gtk_tree_data_list_alloc ();
G_SLIST (iter->user_data)->data = list = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
else
@ -483,13 +483,13 @@ gtk_list_store_remove (GtkListStore *list_store,
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
if (G_SLIST (iter->tree_node)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_SLIST (iter->tree_node)->data,
if (G_SLIST (iter->user_data)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_SLIST (iter->user_data)->data,
list_store->column_headers);
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
list_store->root = g_slist_remove_link (G_SLIST (list_store->root),
G_SLIST (iter->tree_node));
G_SLIST (iter->user_data));
list_store->stamp ++;
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"deleted",
@ -517,13 +517,13 @@ gtk_list_store_insert (GtkListStore *list_store,
}
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
iter->user_data = g_slist_alloc ();
list = g_slist_nth (G_SLIST (list_store->root), position - 1);
if (list)
{
G_SLIST (iter->tree_node)->next = list->next;
list->next = G_SLIST (iter->tree_node)->next;
G_SLIST (iter->user_data)->next = list->next;
list->next = G_SLIST (iter->user_data)->next;
}
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, position);
@ -554,10 +554,10 @@ gtk_list_store_insert_before (GtkListStore *list_store,
}
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
iter->user_data = g_slist_alloc ();
prev = list = list_store->root;
while (list && list != sibling->tree_node)
while (list && list != sibling->user_data)
{
prev = list;
list = list->next;
@ -566,12 +566,12 @@ gtk_list_store_insert_before (GtkListStore *list_store,
if (prev)
{
prev->next = iter->tree_node;
prev->next = iter->user_data;
}
else
{
G_SLIST (iter->tree_node)->next = list_store->root;
list_store->root = iter->tree_node;
G_SLIST (iter->user_data)->next = list_store->root;
list_store->root = iter->user_data;
}
path = gtk_tree_path_new ();
@ -603,15 +603,15 @@ gtk_list_store_insert_after (GtkListStore *list_store,
return;
}
for (list = list_store->root; list && list != sibling->tree_node; list = list->next)
for (list = list_store->root; list && list != sibling->user_data; list = list->next)
i++;
g_return_if_fail (list != NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
iter->user_data = g_slist_alloc ();
G_SLIST (iter->tree_node)->next = G_SLIST (sibling->tree_node)->next;
G_SLIST (iter->user_data)->next = G_SLIST (sibling->user_data)->next;
G_SLIST (sibling)->next = G_SLIST (iter);
path = gtk_tree_path_new ();
@ -633,10 +633,10 @@ gtk_list_store_prepend (GtkListStore *list_store,
g_return_if_fail (iter != NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
iter->user_data = g_slist_alloc ();
G_SLIST (iter->tree_node)->next = G_SLIST (list_store->root);
list_store->root = iter->tree_node;
G_SLIST (iter->user_data)->next = G_SLIST (list_store->root);
list_store->root = iter->user_data;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, 0);
@ -659,7 +659,7 @@ gtk_list_store_append (GtkListStore *list_store,
g_return_if_fail (iter != NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
iter->user_data = g_slist_alloc ();
prev = list = list_store->root;
while (list)
@ -670,9 +670,9 @@ gtk_list_store_append (GtkListStore *list_store,
}
if (prev)
prev->next = iter->tree_node;
prev->next = iter->user_data;
else
list_store->root = iter->tree_node;
list_store->root = iter->user_data;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);

View File

@ -46,9 +46,9 @@ typedef enum
struct _GtkTreeIter
{
gint stamp;
gpointer tree_node;
gpointer tree_node2;
gpointer tree_node3;
gpointer user_data;
gpointer user_data2;
gpointer user_data3;
};
struct _GtkTreeModelIface

View File

@ -390,7 +390,7 @@ gtk_tree_model_sort_changed (GtkTreeModel *s_model,
}
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
elt = (SortElt *) iter.tree_node;
elt = (SortElt *) iter.user_data;
array = get_array (elt, tree_model_sort);
/* FIXME: as an optimization for when the column other then the one we're
@ -445,8 +445,8 @@ gtk_tree_model_sort_insert_value (GtkTreeModelSort *sort,
return FALSE;
}
gtk_tree_model_get_iter (GTK_TREE_MODEL (sort), &iter, parent_path);
elt.parent = ((SortElt *) iter.tree_node);
array = ((SortElt *) iter.tree_node)->children;
elt.parent = ((SortElt *) iter.user_data);
array = ((SortElt *) iter.user_data)->children;
gtk_tree_path_free (parent_path);
if (array == NULL)
{
@ -584,7 +584,7 @@ gtk_tree_model_sort_deleted (GtkTreeModel *s_model,
gint i;
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort), &iter, path);
elt = (SortElt *) iter.tree_node;
elt = (SortElt *) iter.user_data;
offset = elt->offset;
array = get_array (elt, tree_model_sort);
if (array->len == 1)
@ -652,7 +652,7 @@ gtk_tree_model_sort_get_iter_helper (GtkTreeModelSort *tree_model_sort,
if (depth == gtk_tree_path_get_depth (path) - 1)
{
iter->stamp = tree_model_sort->stamp;
iter->tree_node = elt;
iter->user_data = elt;
return TRUE;
}
@ -713,7 +713,7 @@ gtk_tree_model_sort_get_value (GtkTreeModel *tree_model,
g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL);
g_return_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == iter->stamp);
elt = iter->tree_node;
elt = iter->user_data;
gtk_tree_model_get_value (GTK_TREE_MODEL_SORT (tree_model)->child_model, (GtkTreeIter *)elt, column, value);
}
@ -729,7 +729,7 @@ gtk_tree_model_sort_iter_next (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == iter->stamp, FALSE);
elt = iter->tree_node;
elt = iter->user_data;
array = get_array (elt, tree_model);
if (elt - ((SortElt*) array->data) >= array->len - 1)
@ -737,7 +737,7 @@ gtk_tree_model_sort_iter_next (GtkTreeModel *tree_model,
iter->stamp = 0;
return FALSE;
}
iter->tree_node = elt + 1;
iter->user_data = elt + 1;
return TRUE;
}
@ -755,7 +755,7 @@ gtk_tree_model_sort_iter_children (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == parent->stamp, FALSE);
if (parent)
elt = parent->tree_node;
elt = parent->user_data;
else
elt = (SortElt *) ((GArray *)GTK_TREE_MODEL_SORT (tree_model)->root)->data;
@ -770,7 +770,7 @@ gtk_tree_model_sort_iter_children (GtkTreeModel *tree_model,
return FALSE;
iter->stamp = GTK_TREE_MODEL_SORT (tree_model)->stamp;
iter->tree_node = elt->children->data;
iter->user_data = elt->children->data;
return TRUE;
}
@ -785,7 +785,7 @@ gtk_tree_model_sort_iter_has_child (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == iter->stamp, FALSE);
elt = iter->tree_node;
elt = iter->user_data;
if (elt->children)
return TRUE;
@ -802,7 +802,7 @@ gtk_tree_model_sort_iter_n_children (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL, 0);
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == iter->stamp, 0);
elt = iter->tree_node;
elt = iter->user_data;
if (elt->children)
return elt->children->len;
@ -823,7 +823,7 @@ gtk_tree_model_sort_iter_nth_child (GtkTreeModel *tree_model,
if (parent)
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == parent->stamp, FALSE);
elt = iter->tree_node;
elt = iter->user_data;
if (elt->children == NULL)
@ -841,7 +841,7 @@ gtk_tree_model_sort_iter_nth_child (GtkTreeModel *tree_model,
return FALSE;
iter->stamp = GTK_TREE_MODEL_SORT (tree_model)->stamp;
iter->tree_node = &g_array_index (elt->children, SortElt, n);
iter->user_data = &g_array_index (elt->children, SortElt, n);
return TRUE;
}
@ -857,11 +857,11 @@ gtk_tree_model_sort_iter_parent (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->stamp == child->stamp, FALSE);
elt = iter->tree_node;
elt = iter->user_data;
if (elt->parent)
{
iter->stamp = GTK_TREE_MODEL_SORT (tree_model)->stamp;
iter->tree_node = elt->parent;
iter->user_data = elt->parent;
return TRUE;
}

View File

@ -44,7 +44,7 @@ typedef enum
#define GTK_TREE_VIEW_UNSET_FLAG(tree_view, flag) G_STMT_START{ (tree_view->priv->flags&=~(flag)); }G_STMT_END
#define GTK_TREE_VIEW_FLAG_SET(tree_view, flag) ((tree_view->priv->flags&flag)==flag)
#define TREE_VIEW_HEADER_HEIGHT(tree_view) (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)?tree_view->priv->header_height:0)
#define TREE_VIEW_COLUMN_SIZE(column) (CLAMP (column->size, (column->min_width!=-1)?column->min_width:column->size, (column->max_width!=-1)?column->max_width:column->size))
#define TREE_VIEW_COLUMN_WIDTH(column) (CLAMP (column->width, (column->min_width!=-1)?column->min_width:column->width, (column->max_width!=-1)?column->max_width:column->width))
#define TREE_VIEW_DRAW_EXPANDERS(tree_view) (!GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST)&&GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS))
struct _GtkTreeViewPrivate

View File

@ -239,6 +239,14 @@ gtk_tree_selection_get_user_data (GtkTreeSelection *selection)
return selection->user_data;
}
GtkTreeView*
gtk_tree_selection_get_tree_view (GtkTreeSelection *selection)
{
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
return selection->tree_view;
}
/**
* gtk_tree_selection_get_selected:
* @selection: A #GtkTreeSelection.

View File

@ -76,7 +76,7 @@ void gtk_tree_selection_set_select_function (GtkTreeSelection
GtkTreeSelectionFunc func,
gpointer data);
gpointer gtk_tree_selection_get_user_data (GtkTreeSelection *selection);
GtkTreeView* gtk_tree_selection_get_tree_view (GtkTreeSelection *selection);
/* Only meaningful if GTK_TREE_SELECTION_SINGLE is set */
/* Use selected_foreach for GTK_TREE_SELECTION_MULTI */
@ -103,9 +103,6 @@ void gtk_tree_selection_select_range (GtkTreeSelection
GtkTreePath *end_path);
/*< private >*/
/* FIXME underscores, return GtkTreeSelection, rename from_tree_view */
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -286,10 +286,10 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_model), NULL);
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (GTK_TREE_STORE (tree_model)->stamp == iter->stamp, NULL);
if (iter->tree_node == NULL)
if (iter->user_data == NULL)
return NULL;
if (G_NODE (iter->tree_node)->parent == G_NODE (GTK_TREE_STORE (tree_model)->root))
if (G_NODE (iter->user_data)->parent == G_NODE (GTK_TREE_STORE (tree_model)->root))
{
retval = gtk_tree_path_new ();
tmp_node = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
@ -297,11 +297,11 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
else
{
GtkTreeIter tmp_iter = *iter;
tmp_iter.tree_node = G_NODE (tmp_iter.tree_node)->parent;
tmp_iter.user_data = G_NODE (tmp_iter.user_data)->parent;
retval = gtk_tree_store_get_path (tree_model,
&tmp_iter);
tmp_node = G_NODE (iter->tree_node)->parent->children;
tmp_node = G_NODE (iter->user_data)->parent->children;
}
if (retval == NULL)
@ -315,7 +315,7 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
for (; tmp_node; tmp_node = tmp_node->next)
{
if (tmp_node == G_NODE (iter->tree_node))
if (tmp_node == G_NODE (iter->user_data))
break;
i++;
}
@ -349,7 +349,7 @@ gtk_tree_store_get_value (GtkTreeModel *tree_model,
g_return_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp);
g_return_if_fail (column < GTK_TREE_STORE (tree_model)->n_columns);
list = G_NODE (iter->tree_node)->data;
list = G_NODE (iter->user_data)->data;
while (tmp_column-- > 0 && list)
list = list->next;
@ -371,12 +371,12 @@ static gboolean
gtk_tree_store_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
if (iter->tree_node == NULL)
if (iter->user_data == NULL)
return FALSE;
iter->tree_node = G_NODE (iter->tree_node)->next;
iter->user_data = G_NODE (iter->user_data)->next;
return (iter->tree_node != NULL);
return (iter->user_data != NULL);
}
static gboolean
@ -386,11 +386,11 @@ gtk_tree_store_iter_children (GtkTreeModel *tree_model,
{
iter->stamp = GTK_TREE_STORE (tree_model)->stamp;
if (parent)
iter->tree_node = G_NODE (parent->tree_node)->children;
iter->user_data = G_NODE (parent->user_data)->children;
else
iter->tree_node = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
iter->user_data = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
return iter->tree_node != NULL;
return iter->user_data != NULL;
}
static gboolean
@ -402,7 +402,7 @@ gtk_tree_store_iter_has_child (GtkTreeModel *tree_model,
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE);
return G_NODE (iter->tree_node)->children != NULL;
return G_NODE (iter->user_data)->children != NULL;
}
static gint
@ -420,7 +420,7 @@ gtk_tree_store_iter_n_children (GtkTreeModel *tree_model,
if (iter == NULL)
node = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
else
node = G_NODE (iter->tree_node)->children;
node = G_NODE (iter->user_data)->children;
while (node)
{
i++;
@ -447,16 +447,16 @@ gtk_tree_store_iter_nth_child (GtkTreeModel *tree_model,
if (parent == NULL)
parent_node = GTK_TREE_STORE (tree_model)->root;
else
parent_node = parent->tree_node;
parent_node = parent->user_data;
iter->tree_node = g_node_nth_child (parent_node, n);
iter->user_data = g_node_nth_child (parent_node, n);
if (iter->tree_node == NULL)
if (iter->user_data == NULL)
iter->stamp = 0;
else
iter->stamp = GTK_TREE_STORE (tree_model)->stamp;
return (iter->tree_node != NULL);
return (iter->user_data != NULL);
}
static gboolean
@ -465,9 +465,9 @@ gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *child)
{
iter->stamp = GTK_TREE_STORE (tree_model)->stamp;
iter->tree_node = G_NODE (child->tree_node)->parent;
iter->user_data = G_NODE (child->user_data)->parent;
if (iter->tree_node == GTK_TREE_STORE (tree_model)->root)
if (iter->user_data == GTK_TREE_STORE (tree_model)->root)
{
iter->stamp = 0;
return FALSE;
@ -493,7 +493,7 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (column >= 0 && column < tree_store->n_columns);
prev = list = G_NODE (iter->tree_node)->data;
prev = list = G_NODE (iter->user_data)->data;
while (list != NULL)
{
@ -511,9 +511,9 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
list = list->next;
}
if (G_NODE (iter->tree_node)->data == NULL)
if (G_NODE (iter->user_data)->data == NULL)
{
G_NODE (iter->tree_node)->data = list = _gtk_tree_data_list_alloc ();
G_NODE (iter->user_data)->data = list = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
else
@ -662,14 +662,14 @@ gtk_tree_store_remove (GtkTreeStore *model,
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
parent = G_NODE (iter->tree_node)->parent;
parent = G_NODE (iter->user_data)->parent;
if (G_NODE (iter->tree_node)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_NODE (iter->tree_node)->data,
if (G_NODE (iter->user_data)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_NODE (iter->user_data)->data,
model->column_headers);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
g_node_destroy (G_NODE (iter->tree_node));
g_node_destroy (G_NODE (iter->user_data));
model->stamp++;
gtk_signal_emit_by_name (GTK_OBJECT (model),
@ -697,12 +697,12 @@ gtk_tree_store_insert (GtkTreeStore *model,
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
if (parent->tree_node == NULL)
parent->tree_node = model->root;
if (parent->user_data == NULL)
parent->user_data = model->root;
iter->stamp = model->stamp;
iter->tree_node = g_node_new (NULL);
g_node_insert (G_NODE (parent->tree_node), position, G_NODE (iter->tree_node));
iter->user_data = g_node_new (NULL);
g_node_insert (G_NODE (parent->user_data), position, G_NODE (iter->user_data));
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
gtk_signal_emit_by_name (GTK_OBJECT (model),
@ -729,18 +729,18 @@ gtk_tree_store_insert_before (GtkTreeStore *model,
g_return_if_fail (sibling->stamp == model->stamp);
iter->stamp = model->stamp;
iter->tree_node = g_node_new (NULL);
iter->user_data = g_node_new (NULL);
if (parent == NULL && sibling == NULL)
parent_node = model->root;
else if (parent == NULL)
parent_node = G_NODE (sibling->tree_node)->parent;
parent_node = G_NODE (sibling->user_data)->parent;
else
parent_node = G_NODE (parent->tree_node);
parent_node = G_NODE (parent->user_data);
g_node_insert_before (parent_node,
sibling ? G_NODE (sibling->tree_node) : NULL,
G_NODE (iter->tree_node));
sibling ? G_NODE (sibling->user_data) : NULL,
G_NODE (iter->user_data));
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
gtk_signal_emit_by_name (GTK_OBJECT (model),
@ -767,18 +767,18 @@ gtk_tree_store_insert_after (GtkTreeStore *model,
g_return_if_fail (sibling->stamp == model->stamp);
iter->stamp = model->stamp;
iter->tree_node = g_node_new (NULL);
iter->user_data = g_node_new (NULL);
if (parent == NULL && sibling == NULL)
parent_node = model->root;
else if (parent == NULL)
parent_node = G_NODE (sibling->tree_node)->parent;
parent_node = G_NODE (sibling->user_data)->parent;
else
parent_node = G_NODE (parent->tree_node);
parent_node = G_NODE (parent->user_data);
g_node_insert_after (parent_node,
sibling ? G_NODE (sibling->tree_node) : NULL,
G_NODE (iter->tree_node));
sibling ? G_NODE (sibling->user_data) : NULL,
G_NODE (iter->user_data));
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
gtk_signal_emit_by_name (GTK_OBJECT (model),
@ -803,16 +803,16 @@ gtk_tree_store_prepend (GtkTreeStore *model,
if (parent == NULL)
parent_node = model->root;
else
parent_node = parent->tree_node;
parent_node = parent->user_data;
iter->stamp = model->stamp;
iter->tree_node = g_node_new (NULL);
iter->user_data = g_node_new (NULL);
if (parent_node->children == NULL)
{
GtkTreePath *path;
g_node_prepend (parent_node, G_NODE (iter->tree_node));
g_node_prepend (parent_node, G_NODE (iter->user_data));
if (parent_node != model->root)
{
@ -855,16 +855,16 @@ gtk_tree_store_append (GtkTreeStore *model,
if (parent == NULL)
parent_node = model->root;
else
parent_node = parent->tree_node;
parent_node = parent->user_data;
iter->stamp = model->stamp;
iter->tree_node = g_node_new (NULL);
iter->user_data = g_node_new (NULL);
if (parent_node->children == NULL)
{
GtkTreePath *path;
g_node_append (parent_node, G_NODE (iter->tree_node));
g_node_append (parent_node, G_NODE (iter->user_data));
if (parent_node != model->root)
{
@ -900,7 +900,7 @@ gtk_tree_store_get_root_iter (GtkTreeStore *model,
g_return_if_fail (iter != NULL);
iter->stamp = model->stamp;
iter->tree_node = G_NODE (model->root)->children;
iter->user_data = G_NODE (model->root)->children;
}
@ -916,8 +916,8 @@ gtk_tree_store_is_ancestor (GtkTreeStore *model,
g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
g_return_val_if_fail (descendant->stamp == model->stamp, FALSE);
return g_node_is_ancestor (G_NODE (iter->tree_node),
G_NODE (descendant->tree_node));
return g_node_is_ancestor (G_NODE (iter->user_data),
G_NODE (descendant->user_data));
}
@ -930,5 +930,5 @@ gtk_tree_store_iter_depth (GtkTreeStore *model,
g_return_val_if_fail (iter != NULL, 0);
g_return_val_if_fail (iter->stamp == model->stamp, 0);
return g_node_depth (G_NODE (iter->tree_node)) - 1;
return g_node_depth (G_NODE (iter->user_data)) - 1;
}

View File

@ -519,7 +519,7 @@ gtk_tree_view_size_request_buttons (GtkTreeView *tree_view)
gtk_widget_size_request (column->button, &requisition);
column->size = MAX (column->size, requisition.width);
column->width = MAX (column->width, requisition.width);
tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
}
}
@ -587,8 +587,8 @@ gtk_tree_view_size_allocate_buttons (GtkWidget *widget)
continue;
allocation.x = width;
allocation.width = column->size;
width += column->size;
allocation.width = column->width;
width += column->width;
gtk_widget_size_allocate (column->button, &allocation);
if (column->window)
@ -795,7 +795,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
&iter);
background_area.x = cell_offset;
background_area.width = TREE_VIEW_COLUMN_SIZE (column);
background_area.width = TREE_VIEW_COLUMN_WIDTH (column);
if (i == 0 && TREE_VIEW_DRAW_EXPANDERS(tree_view))
{
cell_area = background_area;
@ -829,7 +829,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
&event->area,
flags);
}
cell_offset += TREE_VIEW_COLUMN_SIZE (column);
cell_offset += TREE_VIEW_COLUMN_WIDTH (column);
}
if (node == cursor &&
@ -1175,7 +1175,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
if (!column->visible)
continue;
background_area.width = TREE_VIEW_COLUMN_SIZE (column);
background_area.width = TREE_VIEW_COLUMN_WIDTH (column);
if (i == 0 && TREE_VIEW_DRAW_EXPANDERS(tree_view))
{
cell_area = background_area;
@ -2214,9 +2214,9 @@ gtk_tree_view_insert_iter_height (GtkTreeView *tree_view,
max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPARATOR + height);
if (first == TRUE && TREE_VIEW_DRAW_EXPANDERS (tree_view))
column->size = MAX (column->size, depth * tree_view->priv->tab_offset + width);
column->width = MAX (column->width, depth * tree_view->priv->tab_offset + width);
else
column->size = MAX (column->size, width);
column->width = MAX (column->width, width);
first = FALSE;
}
@ -2309,9 +2309,9 @@ gtk_tree_view_calc_size (GtkTreeView *tree_view,
continue;
if (i == 0 && TREE_VIEW_DRAW_EXPANDERS (tree_view))
column->size = MAX (column->size, depth * tree_view->priv->tab_offset + width);
column->width = MAX (column->width, depth * tree_view->priv->tab_offset + width);
else
column->size = MAX (column->size, width);
column->width = MAX (column->width, width);
}
_gtk_rbtree_node_set_height (tree, temp, max_height);
if (temp->children != NULL &&
@ -2361,7 +2361,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
}
if (i == 0 && TREE_VIEW_DRAW_EXPANDERS (tree_view))
{
if (depth * tree_view->priv->tab_offset + width > column->size)
if (depth * tree_view->priv->tab_offset + width > column->width)
{
column->dirty = TRUE;
retval = TRUE;
@ -2369,7 +2369,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
}
else
{
if (width > column->size)
if (width > column->width)
{
column->dirty = TRUE;
retval = TRUE;
@ -2442,7 +2442,7 @@ gtk_tree_view_check_dirty (GtkTreeView *tree_view)
dirty = TRUE;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
column->size = column->button->requisition.width;
column->width = column->button->requisition.width;
}
}
}
@ -2741,7 +2741,7 @@ _gtk_tree_view_set_size (GtkTreeView *tree_view,
column = list->data;
if (!column->visible)
continue;
width += TREE_VIEW_COLUMN_SIZE (column);
width += TREE_VIEW_COLUMN_WIDTH (column);
}
}
if (height == -1)
@ -3526,12 +3526,12 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
continue;
last_column = tmp_column;
if (x <= tmp_column->size)
if (x <= tmp_column->width)
{
*column = tmp_column;
break;
}
x -= tmp_column->size;
x -= tmp_column->width;
}
if (*column == NULL)

View File

@ -92,7 +92,7 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
{
tree_column->button = NULL;
tree_column->justification = GTK_JUSTIFY_LEFT;
tree_column->size = 0;
tree_column->width = 0;
tree_column->min_width = -1;
tree_column->max_width = -1;
tree_column->cell = NULL;
@ -469,7 +469,7 @@ gtk_tree_view_column_get_size (GtkTreeViewColumn *tree_column)
g_return_val_if_fail (tree_column != NULL, 0);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
return tree_column->size;
return tree_column->width;
}
/**
@ -490,10 +490,10 @@ gtk_tree_view_column_set_width (GtkTreeViewColumn *tree_column,
g_return_if_fail (size > 0);
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE ||
tree_column->size == size)
tree_column->width == size)
return;
tree_column->size = size;
tree_column->width = size;
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
gtk_widget_queue_resize (tree_column->tree_view);
@ -526,12 +526,12 @@ gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
/* We want to queue a resize if the either the old min_size or the
* new min_size determined the size of the column */
if (GTK_WIDGET_REALIZED (tree_column->tree_view) &&
((tree_column->min_width > tree_column->size) ||
((tree_column->min_width > tree_column->width) ||
(tree_column->min_width == -1 &&
tree_column->button->requisition.width > tree_column->size) ||
(min_width > tree_column->size) ||
tree_column->button->requisition.width > tree_column->width) ||
(min_width > tree_column->width) ||
(min_width == -1 &&
tree_column->button->requisition.width > tree_column->size)))
tree_column->button->requisition.width > tree_column->width)))
gtk_widget_queue_resize (tree_column->tree_view);
if (tree_column->max_width != -1 &&
@ -584,8 +584,8 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
tree_column->button->requisition.width : tree_column->min_width;
if (GTK_WIDGET_REALIZED (tree_column->tree_view) &&
((tree_column->max_width < tree_column->size) ||
(max_width != -1 && max_width < tree_column->size)))
((tree_column->max_width < tree_column->width) ||
(max_width != -1 && max_width < tree_column->width)))
gtk_widget_queue_resize (tree_column->tree_view);
tree_column->max_width = max_width;

View File

@ -59,8 +59,8 @@ struct _GtkTreeViewColumn
GtkJustification justification;
gint id;
/* FIXME change this field to "width" bug 40061 */
gint size;
gint width;
gint min_width;
gint max_width;