From 9be603bebd3e4ecc52cd0e6b838ca6bd9b65d70c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 26 Jan 2001 00:08:54 +0000 Subject: Set the GTK_CAN_FOCUS flag on the widget, since an ETable ought to be 2001-01-25 Federico Mena Quintero * e-table.c (e_table_init): Set the GTK_CAN_FOCUS flag on the widget, since an ETable ought to be focusable. (e_table_class_init): Override ::grab_focus() and ::focus(). (et_grab_focus): Since people may do gtk_widget_grab_focus() on the ETable, we have to proxy the request to the actual focusable canvas. (e_table_setup_header): Unset GTK_CAN_FOCUS for the header canvas. (et_focus): Reject focus if our child canvas already had it. * e-table-scrolled.c (e_table_scrolled_init): Set the GTK_FOCUS_FLAG on the widget. This is just so that people can easily do gtk_widget_grab_focus (my_e_table_scrolled) on their own applications. (e_table_scrolled_class_init): Override ::grab_focus() and ::focus(). (ets_grab_focus): Proxy the grab_focus to our child ETable. (ets_focus): Proxy the request to the child ETable. svn path=/trunk/; revision=7830 --- widgets/table/e-table-scrolled.c | 42 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'widgets/table/e-table-scrolled.c') diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c index c4006a4c58..221ebdf6cb 100644 --- a/widgets/table/e-table-scrolled.c +++ b/widgets/table/e-table-scrolled.c @@ -41,6 +41,8 @@ e_table_scrolled_init (GtkObject *object) ets = E_TABLE_SCROLLED (object); scroll_frame = E_SCROLL_FRAME (object); + GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS); + ets->table = gtk_type_new(e_table_get_type()); e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -162,14 +164,48 @@ ets_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; } } - + +/* Grab_focus handler for the scrolled ETable */ +static void +ets_grab_focus (GtkWidget *widget) +{ + ETableScrolled *ets; + + ets = E_TABLE_SCROLLED (widget); + + gtk_widget_grab_focus (GTK_WIDGET (ets->table)); +} + +/* Focus handler for the scrolled ETable */ +static gint +ets_focus (GtkContainer *container, GtkDirectionType direction) +{ + ETableScrolled *ets; + + ets = E_TABLE_SCROLLED (container); + + return gtk_container_focus (GTK_CONTAINER (ets->table), direction); +} + static void -e_table_scrolled_class_init (GtkObjectClass *object_class) +e_table_scrolled_class_init (ETableScrolledClass *class) { + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + GtkContainerClass *container_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + container_class = (GtkContainerClass *) class; + parent_class = gtk_type_class (PARENT_TYPE); object_class->get_arg = ets_get_arg; - + + widget_class->grab_focus = ets_grab_focus; + + container_class->focus = ets_focus; + gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_TABLE); } -- cgit v1.2.3