forked from AuroraMiddleware/gtk
clean up (gtk_tree_view_move_cursor_page_up_down): implement.
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up (gtk_tree_view_move_cursor_page_up_down): implement.
This commit is contained in:
parent
444bf88aba
commit
10f3b34911
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -1,3 +1,8 @@
|
||||
Wed Jun 20 19:19:15 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): clean up
|
||||
(gtk_tree_view_move_cursor_page_up_down): implement.
|
||||
|
||||
Wed Jun 20 05:32:05 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkspinbutton.c: make maximum digits compile time configurable
|
||||
|
@ -638,9 +638,7 @@ gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
|
||||
* @iter: The uninitialized #GtkTreeIter.
|
||||
* @path: The #GtkTreePath.
|
||||
*
|
||||
* Sets @iter to a valid iterator pointing to @path. If the model does not
|
||||
* provide an implementation of this function, it is implemented in terms of
|
||||
* @gtk_tree_model_iter_nth_child.
|
||||
* Sets @iter to a valid iterator pointing to @path.
|
||||
*
|
||||
* Return value: TRUE, if @iter was set.
|
||||
**/
|
||||
@ -649,33 +647,12 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeIter parent;
|
||||
gint *indices;
|
||||
gint depth, i;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter != NULL, FALSE);
|
||||
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter != NULL)
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter) (tree_model, iter, path);
|
||||
|
||||
indices = gtk_tree_path_get_indices (path);
|
||||
depth = gtk_tree_path_get_depth (path);
|
||||
|
||||
g_return_val_if_fail (depth > 0, FALSE);
|
||||
|
||||
if (! gtk_tree_model_iter_nth_child (tree_model, iter, NULL, indices[0]))
|
||||
return FALSE;
|
||||
|
||||
for (i = 1; i < depth; i++)
|
||||
{
|
||||
parent = *iter;
|
||||
if (! gtk_tree_model_iter_nth_child (tree_model, iter, &parent, indices[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter) (tree_model, iter, path);
|
||||
}
|
||||
|
||||
|
||||
@ -1447,7 +1424,8 @@ gtk_tree_row_reference_new_proxy (GObject *proxy,
|
||||
* gtk_tree_row_reference_get_path:
|
||||
* @reference: A #GtkTreeRowReference
|
||||
*
|
||||
* Returns a path that the row reference currently points to, or NULL if
|
||||
* Returns a path that the row reference currently points to, or NULL if the
|
||||
* path pointed to is no longer valid.
|
||||
*
|
||||
* Return value: A current path, or NULL.
|
||||
**/
|
||||
|
@ -37,6 +37,9 @@ static guint gtk_tree_store_get_flags (GtkTreeModel *tree_mode
|
||||
static gint gtk_tree_store_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GType gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index);
|
||||
static gboolean gtk_tree_store_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
static GtkTreePath *gtk_tree_store_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static void gtk_tree_store_get_value (GtkTreeModel *tree_model,
|
||||
@ -190,6 +193,7 @@ gtk_tree_store_tree_model_init (GtkTreeModelIface *iface)
|
||||
iface->get_flags = gtk_tree_store_get_flags;
|
||||
iface->get_n_columns = gtk_tree_store_get_n_columns;
|
||||
iface->get_column_type = gtk_tree_store_get_column_type;
|
||||
iface->get_iter = gtk_tree_store_get_iter;
|
||||
iface->get_path = gtk_tree_store_get_path;
|
||||
iface->get_value = gtk_tree_store_get_value;
|
||||
iface->iter_next = gtk_tree_store_iter_next;
|
||||
@ -371,6 +375,39 @@ gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
|
||||
return GTK_TREE_STORE (tree_model)->column_headers[index];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_store_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
||||
GtkTreeIter parent;
|
||||
gint *indices;
|
||||
gint depth, i;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
||||
|
||||
indices = gtk_tree_path_get_indices (path);
|
||||
depth = gtk_tree_path_get_depth (path);
|
||||
|
||||
g_return_val_if_fail (depth > 0, FALSE);
|
||||
|
||||
parent.stamp = tree_store->stamp;
|
||||
parent.user_data = tree_store->root;
|
||||
|
||||
if (! gtk_tree_model_iter_nth_child (tree_model, iter, &parent, indices[0]))
|
||||
return FALSE;
|
||||
|
||||
for (i = 1; i < depth; i++)
|
||||
{
|
||||
parent = *iter;
|
||||
if (! gtk_tree_model_iter_nth_child (tree_model, iter, &parent, indices[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkTreePath *
|
||||
gtk_tree_store_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
|
@ -341,8 +341,7 @@ static gboolean gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
|
||||
gboolean open_all);
|
||||
static void gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
gboolean clear_and_select,
|
||||
GdkModifierType state);
|
||||
gboolean clear_and_select);
|
||||
|
||||
|
||||
static GtkContainerClass *parent_class = NULL;
|
||||
@ -1566,7 +1565,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
tree_view->priv->press_start_y = event->y;
|
||||
}
|
||||
|
||||
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, event->state);
|
||||
gtk_tree_view_real_set_cursor (tree_view, path, TRUE);
|
||||
|
||||
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
@ -5598,11 +5597,10 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
|
||||
}
|
||||
|
||||
if (tree_view->priv->selection->type == GTK_TREE_SELECTION_SINGLE)
|
||||
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, 0);
|
||||
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE);
|
||||
else
|
||||
gtk_tree_view_real_set_cursor (tree_view, cursor_path, FALSE, 0);
|
||||
gtk_tree_view_real_set_cursor (tree_view, cursor_path, FALSE);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5616,14 +5614,13 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
GtkTreePath *cursor_path = NULL;
|
||||
|
||||
cursor_path = NULL;
|
||||
if (tree_view->priv->cursor)
|
||||
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
|
||||
if (cursor_path == NULL)
|
||||
if (!gtk_tree_row_reference_valid (tree_view->priv->cursor))
|
||||
return;
|
||||
|
||||
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
_gtk_tree_view_find_node (tree_view, cursor_path,
|
||||
&cursor_tree, &cursor_node);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
|
||||
if (count == -1)
|
||||
_gtk_rbtree_prev_full (cursor_tree, cursor_node,
|
||||
@ -5634,19 +5631,9 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
|
||||
if (new_cursor_node)
|
||||
{
|
||||
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
|
||||
cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
|
||||
if (!tree_view->priv->in_free_motion)
|
||||
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
|
||||
new_cursor_node,
|
||||
new_cursor_tree,
|
||||
cursor_path,
|
||||
tree_view->priv->in_extended_selection?GDK_SHIFT_MASK:0);
|
||||
gtk_tree_row_reference_free (tree_view->priv->cursor);
|
||||
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, cursor_path);
|
||||
gtk_tree_view_clamp_node_visible (tree_view, new_cursor_tree, new_cursor_node);
|
||||
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5654,15 +5641,42 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
|
||||
}
|
||||
|
||||
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
|
||||
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
|
||||
gint count)
|
||||
{
|
||||
g_print ("gtk_tree_view_move_cursor_page_up_down\n");
|
||||
GtkRBTree *cursor_tree = NULL;
|
||||
GtkRBNode *cursor_node = NULL;
|
||||
GtkTreePath *cursor_path = NULL;
|
||||
gint y;
|
||||
gint vertical_separator;
|
||||
|
||||
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
|
||||
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
else
|
||||
/* This is sorta weird. Focus in should give us a cursor */
|
||||
return;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (tree_view), "vertical_separator", &vertical_separator, NULL);
|
||||
_gtk_tree_view_find_node (tree_view, cursor_path,
|
||||
&cursor_tree, &cursor_node);
|
||||
|
||||
gtk_tree_path_free (cursor_path);
|
||||
|
||||
g_return_if_fail (cursor_node != NULL);
|
||||
|
||||
y = CELL_FIRST_PIXEL (tree_view, cursor_tree, cursor_node, vertical_separator);
|
||||
y += count * tree_view->priv->vadjustment->page_size;
|
||||
y = CLAMP (y, (gint)tree_view->priv->vadjustment->lower, (gint)tree_view->priv->vadjustment->upper - vertical_separator);
|
||||
|
||||
_gtk_rbtree_find_offset (tree_view->priv->tree, y, &cursor_tree, &cursor_node);
|
||||
cursor_path = _gtk_tree_view_find_path (tree_view, cursor_tree, cursor_node);
|
||||
g_return_if_fail (cursor_path != NULL);
|
||||
gtk_tree_view_real_set_cursor (tree_view,
|
||||
cursor_path,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5675,11 +5689,9 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
||||
|
||||
g_print ("gtk_tree_view_move_cursor_left_right\n");
|
||||
|
||||
cursor_path = NULL;
|
||||
if (tree_view->priv->cursor)
|
||||
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
|
||||
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
|
||||
if (cursor_path == NULL)
|
||||
else
|
||||
return;
|
||||
|
||||
_gtk_tree_view_find_node (tree_view, cursor_path,
|
||||
@ -7290,13 +7302,13 @@ gtk_tree_view_row_expanded (GtkTreeView *tree_view,
|
||||
GtkRBTree *tree;
|
||||
GtkRBNode *node;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
|
||||
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
return FALSE;
|
||||
|
||||
return (node->children != NULL);
|
||||
}
|
||||
@ -7348,14 +7360,20 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view,
|
||||
static void
|
||||
gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
gboolean clear_and_select,
|
||||
GdkModifierType state)
|
||||
gboolean clear_and_select)
|
||||
{
|
||||
GtkRBTree *tree = NULL;
|
||||
GtkRBNode *node = NULL;
|
||||
|
||||
if (tree_view->priv->cursor)
|
||||
gtk_tree_row_reference_free (tree_view->priv->cursor);
|
||||
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
|
||||
{
|
||||
GtkTreePath *cursor_path;
|
||||
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
|
||||
gtk_tree_path_free (cursor_path);
|
||||
}
|
||||
gtk_tree_row_reference_free (tree_view->priv->cursor);
|
||||
|
||||
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
|
||||
tree_view->priv->model,
|
||||
path);
|
||||
@ -7363,13 +7381,10 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
if (clear_and_select)
|
||||
{
|
||||
gtk_tree_selection_unselect_all (tree_view->priv->selection);
|
||||
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
|
||||
node, tree,
|
||||
path, state);
|
||||
}
|
||||
if (clear_and_select && !tree_view->priv->in_free_motion)
|
||||
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
|
||||
node, tree, path,
|
||||
tree_view->priv->in_extended_selection?GDK_SHIFT_MASK:0);
|
||||
gtk_tree_view_clamp_node_visible (tree_view, tree, node);
|
||||
gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL);
|
||||
}
|
||||
@ -7392,7 +7407,7 @@ gtk_tree_view_set_cursor (GtkTreeView *tree_view,
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, 0);
|
||||
gtk_tree_view_real_set_cursor (tree_view, path, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user