Commit 8c114fa6 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford
Browse files

implement. (gtk_tree_view_move_cursor_up_down): check for focus

Fri Apr  5 05:55:14 2002  Jonathan Blandford  <jrb@gnome.org>

	* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
	  (gtk_tree_view_move_cursor_up_down): check for focus
	  (gtk_tree_view_move_cursor_page_up_down): ditto
	  (gtk_tree_view_move_cursor_left_right): ditto
	  (gtk_tree_view_move_cursor_start_end): ditto
	  (gtk_tree_view_real_select_all): ditto
	  (gtk_tree_view_real_unselect_all): ditto
	  (gtk_tree_view_real_select_cursor_row): ditto
	  (gtk_tree_view_real_toggle_cursor_row): ditto
	  (gtk_tree_view_real_expand_collapse_cursor_row): ditto
	  (gtk_tree_view_real_select_cursor_parent): ditto
	  (gtk_tree_view_real_start_interactive_search): ditto

	* gtk/gtktreeviewcolumn.c: grab focus
parent 356a5971
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
Fri Apr 5 05:55:14 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_grab_focus): implement.
(gtk_tree_view_move_cursor_up_down): check for focus
(gtk_tree_view_move_cursor_page_up_down): ditto
(gtk_tree_view_move_cursor_left_right): ditto
(gtk_tree_view_move_cursor_start_end): ditto
(gtk_tree_view_real_select_all): ditto
(gtk_tree_view_real_unselect_all): ditto
(gtk_tree_view_real_select_cursor_row): ditto
(gtk_tree_view_real_toggle_cursor_row): ditto
(gtk_tree_view_real_expand_collapse_cursor_row): ditto
(gtk_tree_view_real_select_cursor_parent): ditto
(gtk_tree_view_real_start_interactive_search): ditto
* gtk/gtktreeviewcolumn.c: grab focus
2002-04-05 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkkeyboard-fb.c (write_string):
......
......@@ -170,6 +170,7 @@ static gint gtk_tree_view_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_tree_view_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_tree_view_grab_focus (GtkWidget *widget);
static void gtk_tree_view_style_set (GtkWidget *widget,
GtkStyle *previous_style);
......@@ -489,6 +490,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
widget_class->drag_drop = gtk_tree_view_drag_drop;
widget_class->drag_data_received = gtk_tree_view_drag_data_received;
widget_class->focus = gtk_tree_view_focus;
widget_class->grab_focus = gtk_tree_view_grab_focus;
widget_class->style_set = gtk_tree_view_style_set;
/* GtkContainer signals */
......@@ -5350,7 +5352,7 @@ gtk_tree_view_focus (GtkWidget *widget,
case GTK_DIR_DOWN:
if (tree_view->priv->tree == NULL)
return FALSE;
gtk_tree_view_focus_to_cursor (tree_view);
gtk_widget_grab_focus (widget);
return TRUE;
}
}
......@@ -5371,7 +5373,7 @@ gtk_tree_view_focus (GtkWidget *widget,
if (tree_view->priv->tree == NULL)
return FALSE;
gtk_tree_view_focus_to_cursor (tree_view);
gtk_widget_grab_focus (widget);
return TRUE;
}
......@@ -5385,10 +5387,18 @@ gtk_tree_view_focus (GtkWidget *widget,
return FALSE;
/* Other directions caught by the keybindings */
gtk_tree_view_focus_to_cursor (tree_view);
gtk_widget_grab_focus (widget);
return TRUE;
}
static void
gtk_tree_view_grab_focus (GtkWidget *widget)
{
(* GTK_WIDGET_CLASS (parent_class)->grab_focus) (widget);
gtk_tree_view_focus_to_cursor (GTK_TREE_VIEW (widget));
}
static void
gtk_tree_view_style_set (GtkWidget *widget,
GtkStyle *previous_style)
......@@ -6395,7 +6405,7 @@ gtk_tree_view_add_move_binding (GtkBindingSet *binding_set,
GtkMovementStep step,
gint count)
{
gtk_binding_entry_add_signal (binding_set, keyval, modmask,
"move_cursor", 2,
GTK_TYPE_ENUM, step,
......@@ -6841,7 +6851,6 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
return;
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
cursor_path = NULL;
if (tree_view->priv->cursor)
......@@ -6858,7 +6867,9 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
else
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE);
}
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
if (tree_view->priv->focus_column == NULL)
{
GList *list;
......@@ -6883,6 +6894,9 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
GtkRBNode *new_cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
cursor_path = NULL;
if (!gtk_tree_row_reference_valid (tree_view->priv->cursor))
/* FIXME: we lost the cursor; should we get the first? */
......@@ -6927,6 +6941,9 @@ gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
gint y;
gint vertical_separator;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
else
......@@ -6977,6 +6994,9 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
GList *list;
gboolean found_column = FALSE;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
else
......@@ -7045,6 +7065,9 @@ gtk_tree_view_move_cursor_start_end (GtkTreeView *tree_view,
GtkRBNode *cursor_node;
GtkTreePath *path;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
g_return_if_fail (tree_view->priv->tree != NULL);
if (count == -1)
......@@ -7079,6 +7102,9 @@ gtk_tree_view_move_cursor_start_end (GtkTreeView *tree_view,
static void
gtk_tree_view_real_select_all (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
return;
gtk_tree_selection_select_all (tree_view->priv->selection);
......@@ -7087,6 +7113,9 @@ gtk_tree_view_real_select_all (GtkTreeView *tree_view)
static void
gtk_tree_view_real_unselect_all (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
return;
gtk_tree_selection_unselect_all (tree_view->priv->selection);
......@@ -7102,6 +7131,9 @@ gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view,
GdkModifierType state = 0;
cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
......@@ -7153,6 +7185,9 @@ gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
......@@ -7193,6 +7228,9 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view,
GtkRBTree *tree;
GtkRBNode *node;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
......@@ -7221,6 +7259,9 @@ gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view)
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
......@@ -7267,6 +7308,9 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view)
GtkWidget *search_dialog;
GdkEventFocus focus_event;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (tree_view->priv->enable_search == FALSE ||
tree_view->priv->search_column < 0)
return;
......
......@@ -548,7 +548,6 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
g_signal_connect (G_OBJECT (tree_column->button), "event",
G_CALLBACK (gtk_tree_view_column_button_event),
(gpointer) tree_column);
g_signal_connect (G_OBJECT (tree_column->button), "clicked",
(GtkSignalFunc) gtk_tree_view_column_button_clicked,
(gpointer) tree_column);
......@@ -661,10 +660,10 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
break;
}
/* Put arrow on the right if the text is left-or-center justified,
* and on the left otherwise; do this by packing boxes, so flipping
* text direction will reverse things
*/
/* Put arrow on the right if the text is left-or-center justified, and on the
* left otherwise; do this by packing boxes, so flipping text direction will
* reverse things
*/
gtk_widget_ref (arrow);
gtk_container_remove (GTK_CONTAINER (hbox), arrow);
......@@ -685,8 +684,8 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
else
gtk_widget_hide (arrow);
/* It's always safe to hide the button. It isn't always safe to show it, as if you show it
* before it's realized, it'll get the wrong window. */
/* It's always safe to hide the button. It isn't always safe to show it, as
* if you show it before it's realized, it'll get the wrong window. */
if (tree_column->button &&
tree_column->tree_view != NULL &&
GTK_WIDGET_REALIZED (tree_column->tree_view))
......@@ -817,17 +816,13 @@ gtk_tree_view_column_mnemonic_activate (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), FALSE);
GTK_TREE_VIEW (column->tree_view)->priv->focus_column = column;
if (column->clickable)
gtk_button_clicked (GTK_BUTTON (column->button));
else if (GTK_WIDGET_CAN_FOCUS (column->button))
gtk_widget_grab_focus (column->button);
else
{
GTK_TREE_VIEW (column->tree_view)->priv->focus_column = column;
GTK_TREE_VIEW_SET_FLAG (GTK_TREE_VIEW (column->tree_view),
GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_widget_grab_focus (column->tree_view);
}
gtk_widget_grab_focus (column->tree_view);
return TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment