summaryrefslogtreecommitdiff
path: root/gtk/gtkcontainer.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-06-09 07:11:55 +0000
committerTim Janik <timj@src.gnome.org>1998-06-09 07:11:55 +0000
commita21d063ef867d0df151872f79cb04db8e730c42a (patch)
tree4e39ac11c98f2da3e38430d09843f6c74e007b07 /gtk/gtkcontainer.c
parent257c54a0210d75fd17d19d555a90c52a07693ef4 (diff)
downloadgtk+-a21d063ef867d0df151872f79cb04db8e730c42a.tar.gz
new functions gtk_selection_data_copy and gtk_selection_data_free.
Tue Jun 9 01:57:23 1998 Tim Janik <timj@gtk.org> * gtk/gtkselection.h: * gtk/gtkselection.c: new functions gtk_selection_data_copy and gtk_selection_data_free. * gtk/gtkwidget.c (gtk_widget_class_init): fixed gtk_signal_new() call for "selection_received", which was completely bogus. * other fixups to gtk_signal_new() calls all over the place. * gtk/gtktypebuiltins.h: types as variables (formerly macros). * gtk/gtktypebuiltins_vars.c: type variable implementations. * gtk/gtktypebuiltins_ids.c: array entries for builtin type declarations. * gtk/gtktypebuiltins_evals.c: enum value arrays. * gtk/gtk-boxed.defs: gtk and gdk structure definitions, used to build gtk.defs. * gtk/gtk.defs: generated file with scheme syntax for type definitions of gtk and gdk structures and enums. * gtk/gtktypeutils.h: * gtk/gtktypeutils.c: reworked type ids, so they are variables not macros anymore (this fixes binary incompatibility with new enum definitions). * gtk/gtkwidget.c (gtk_widget_real_key_press_event): proccess possible key bindings for this widget. * gtk/gtkwindow.c (gtk_window_key_press_event): chain parent class' handler. * gtk/gtkobject.h: * gtk/gtkobject.c: removed gtk_object_class_new_user_signal_no_recurse() again. new functions gtk_object_class_user_signal_new () and gtk_object_class_user_signal_newv (), to feature the GtkSignalRunType flag on the signal creation. Mon Jun 8 20:52:21 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.h: new signal GtkContainer::set_focus_child.
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r--gtk/gtkcontainer.c62
1 files changed, 50 insertions, 12 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 4595e7fcad..21611c36de 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -28,6 +28,7 @@ enum {
NEED_RESIZE,
FOREACH,
FOCUS,
+ SET_FOCUS_CHILD,
LAST_SIGNAL
};
enum {
@@ -84,9 +85,11 @@ static void gtk_container_add_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_remove_unimplemented (GtkContainer *container,
GtkWidget *widget);
-static gint gtk_real_container_need_resize (GtkContainer *container);
-static gint gtk_real_container_focus (GtkContainer *container,
+static gint gtk_container_real_need_resize (GtkContainer *container);
+static gint gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction);
+static void gtk_container_real_set_focus_child (GtkContainer *container,
+ GtkWidget *widget);
static gint gtk_container_focus_tab (GtkContainer *container,
GList *children,
GtkDirectionType direction);
@@ -197,7 +200,14 @@ gtk_container_class_init (GtkContainerClass *class)
gtk_container_marshal_signal_3,
GTK_TYPE_DIRECTION_TYPE, 1,
GTK_TYPE_DIRECTION_TYPE);
-
+ container_signals[SET_FOCUS_CHILD] =
+ gtk_signal_new ("set-focus-child",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkContainerClass, set_focus_child),
+ gtk_container_marshal_signal_1,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
gtk_object_class_add_signals (object_class, container_signals, LAST_SIGNAL);
object_class->destroy = gtk_container_destroy;
@@ -211,9 +221,10 @@ gtk_container_class_init (GtkContainerClass *class)
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
- class->need_resize = gtk_real_container_need_resize;
+ class->need_resize = gtk_container_real_need_resize;
class->foreach = NULL;
- class->focus = gtk_real_container_focus;
+ class->focus = gtk_container_real_focus;
+ class->set_focus_child = gtk_container_real_set_focus_child;
}
static void
@@ -430,6 +441,10 @@ gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (callback != NULL);
+
gtk_signal_emit (GTK_OBJECT (container),
container_signals[FOREACH],
callback, callback_data);
@@ -479,6 +494,9 @@ gtk_container_foreach_full (GtkContainer *container,
gpointer callback_data,
GtkDestroyNotify notify)
{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+
if (marshal)
{
GtkForeachData fdata;
@@ -490,9 +508,14 @@ gtk_container_foreach_full (GtkContainer *container,
gtk_container_foreach (container, gtk_container_foreach_unmarshal, &fdata);
}
else
- gtk_container_foreach (container, callback, &callback_data);
-
- notify (callback_data);
+ {
+ g_return_if_fail (callback != NULL);
+
+ gtk_container_foreach (container, callback, &callback_data);
+ }
+
+ if (notify)
+ notify (callback_data);
}
gint
@@ -500,6 +523,9 @@ gtk_container_focus (GtkContainer *container,
GtkDirectionType direction)
{
gint return_val;
+
+ g_return_val_if_fail (container != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
gtk_signal_emit (GTK_OBJECT (container),
container_signals[FOCUS],
@@ -508,6 +534,18 @@ gtk_container_focus (GtkContainer *container,
return return_val;
}
+void
+gtk_container_set_focus_child (GtkContainer *container,
+ GtkWidget *widget)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ if (widget)
+ g_return_if_fail (GTK_IS_WIDGET (container));
+
+ gtk_signal_emit (GTK_OBJECT (container), container_signals[SET_FOCUS_CHILD], widget);
+}
+
GList*
gtk_container_children (GtkContainer *container)
{
@@ -536,8 +574,8 @@ gtk_container_unregister_toplevel (GtkContainer *container)
}
void
-gtk_container_set_focus_child (GtkContainer *container,
- GtkWidget *child)
+gtk_container_real_set_focus_child (GtkContainer *container,
+ GtkWidget *child)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
@@ -636,7 +674,7 @@ gtk_container_marshal_signal_4 (GtkObject *object,
}
static gint
-gtk_real_container_need_resize (GtkContainer *container)
+gtk_container_real_need_resize (GtkContainer *container)
{
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
@@ -648,7 +686,7 @@ gtk_real_container_need_resize (GtkContainer *container)
}
static gint
-gtk_real_container_focus (GtkContainer *container,
+gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction)
{
GList *children;