summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog84
-rw-r--r--ChangeLog.pre-2-084
-rw-r--r--ChangeLog.pre-2-1084
-rw-r--r--ChangeLog.pre-2-284
-rw-r--r--ChangeLog.pre-2-484
-rw-r--r--ChangeLog.pre-2-684
-rw-r--r--ChangeLog.pre-2-884
-rw-r--r--examples/packer/pack.c24
-rw-r--r--gtk/gtk.defs41
-rw-r--r--gtk/gtkaccellabel.c1
-rw-r--r--gtk/gtkbin.c11
-rw-r--r--gtk/gtkbox.c192
-rw-r--r--gtk/gtkbox.h28
-rw-r--r--gtk/gtkbutton.c38
-rw-r--r--gtk/gtkcheckbutton.c4
-rw-r--r--gtk/gtkcheckbutton.h10
-rw-r--r--gtk/gtkcheckmenuitem.c2
-rw-r--r--gtk/gtkclist.c4
-rw-r--r--gtk/gtkclist.h11
-rw-r--r--gtk/gtkcontainer.c434
-rw-r--r--gtk/gtkcontainer.h64
-rw-r--r--gtk/gtkfixed.c8
-rw-r--r--gtk/gtkframe.c1
-rw-r--r--gtk/gtkitemfactory.c40
-rw-r--r--gtk/gtkitemfactory.h4
-rw-r--r--gtk/gtklabel.c1
-rw-r--r--gtk/gtklist.c8
-rw-r--r--gtk/gtklist.h9
-rw-r--r--gtk/gtklistitem.c4
-rw-r--r--gtk/gtklistitem.h11
-rw-r--r--gtk/gtkmenushell.c8
-rw-r--r--gtk/gtkmisc.c1
-rw-r--r--gtk/gtknotebook.c12
-rw-r--r--gtk/gtknotebook.h23
-rw-r--r--gtk/gtkobject.c38
-rw-r--r--gtk/gtkobject.h6
-rw-r--r--gtk/gtkoptionmenu.c16
-rw-r--r--gtk/gtkoptionmenu.h15
-rw-r--r--gtk/gtkpacker.c119
-rw-r--r--gtk/gtkpacker.h79
-rw-r--r--gtk/gtkpaned.c11
-rw-r--r--gtk/gtkpaned.h31
-rw-r--r--gtk/gtkradiobutton.c4
-rw-r--r--gtk/gtkradiobutton.h29
-rw-r--r--gtk/gtkradiomenuitem.c4
-rw-r--r--gtk/gtkradiomenuitem.h27
-rw-r--r--gtk/gtktable.c1377
-rw-r--r--gtk/gtktable.h89
-rw-r--r--gtk/gtktipsquery.c1
-rw-r--r--gtk/gtktogglebutton.c4
-rw-r--r--gtk/gtktogglebutton.h10
-rw-r--r--gtk/gtktooltips.c2
-rw-r--r--gtk/gtktree.c12
-rw-r--r--gtk/gtktree.h15
-rw-r--r--gtk/gtktreeitem.c4
-rw-r--r--gtk/gtktreeitem.h14
-rw-r--r--gtk/gtktypebuiltins_evals.c9
-rw-r--r--gtk/gtktypeutils.c2
-rw-r--r--gtk/gtktypeutils.h4
-rw-r--r--gtk/gtkwidget.c1
-rw-r--r--gtk/gtkwindow.c1
-rwxr-xr-xgtk/makeenums.pl2
62 files changed, 2593 insertions, 915 deletions
diff --git a/ChangeLog b/ChangeLog
index c6a705846..ff2763233 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index c6a705846..ff2763233 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,87 @@
+Tue Jun 16 06:29:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_set_state): check for
+ != 0 on the argument.
+
+ * gtk/gtktable.h:
+ * gtk/gtktable.c: new function gtk_table_resize() which allowes
+ shrinking and expanding of tables. implementation of widget arguments
+ and child arguments. many signedness corrections.
+
+Mon Jun 15 04:15:03 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkbox.c (gtk_box_set_child_packing): queue the resize for the box
+ not only the child, otherwise we might end up taking away other
+ childrens space after the resize.
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_menu_path): if we parse
+ an unknown menu path from any source, that path must always be flagged
+ as "modified", since we don't really know whether it has its default
+ value or not.
+
+ * gtk/gtktree.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtknotebook.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkbutton.c: implement gtk_*_child_type functions.
+
+ * gtk/gtkbox.h:
+ * gtk/gtkbox.c: type corrections for expand, fill, padding and pack_type
+ arguments. implemented child arguments.
+
+ * more GtkType and macro fixups.
+
+Sun Jun 14 16:30:02 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcheckbutton.h: GtkType and macro fixups.
+
+ * gtk/gtkclist.h: exported the prototypes for gtk_clist_get_vadjustment
+ and gtk_clist_get_hadjustment.
+
+ * gtk/gtkcontainer.c:
+ implementation of children arguments, new class member functions
+ (child_type), (get_child_arg) and (set_child_arg) plus a new field
+ n_child_args.
+ (gtk_container_child_type): new function which returns the type of a
+ child that the container expects for its next addition.
+ (gtk_container_add_child_arg_type): new function to introduce a new
+ child argument at class creation time.
+ (gtk_container_query_child_args): new function to query all child
+ arguments that are supported by a container class.
+ (gtk_container_child_arg_getv): new fucntion to retrive the value of a
+ child argument.
+ (gtk_container_child_arg_setv): new function to set a child argument for
+ a certain container and child combination.
+ (gtk_container_add_with_args):
+ (gtk_container_add_with_argv): new functions to feature addition of a
+ new child in combination with the setting of certain child arguments.
+
+ * gtk/gtktypeuitils.c (gtk_type_class_init): feature initialization of
+ GtkContainerClass.n_child_args, similar to the GtkObjectClass members.
+ this should really be done through class cretion hooks some day.
+
+ * gtk/gtkcontainer.c: changed type of border_width from gint16 to
+ guint : 16.
+
+ * gtk/gtkpacker.h:
+ * gtk/gtkpacker.c: renamed all PadX and PadY to pad_x and pad_y to
+ follow the gtk convention for lower case variable names (important
+ for language wrappers and widget arguments), and made them guint : 16.
+
+ * examples/packer/pack.c: adaptions for the case converted GtkPacker
+ fields.
+
+Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_scanner): do not
+ change the character pair for single line comments.
+ (gtk_item_factory_parse_rc): use the cpair_comment_signle specified in
+ GtkItemFactoryClass.
+ (gtk_item_factory_parse_rc_string): likewise.
+
Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font
diff --git a/examples/packer/pack.c b/examples/packer/pack.c
index 2aafa1178..e3200b22c 100644
--- a/examples/packer/pack.c
+++ b/examples/packer/pack.c
@@ -395,10 +395,10 @@ toggle_options (GtkWidget *widget, gpointer data)
pchild->anchor,
fillx | filly | expand,
pchild->border_width,
- pchild->padX,
- pchild->padY,
- pchild->iPadX,
- pchild->iPadY);
+ pchild->pad_x,
+ pchild->pad_y,
+ pchild->i_pad_x,
+ pchild->i_pad_y);
}
void
@@ -425,10 +425,10 @@ toggle_anchor (GtkWidget *widget, gpointer data)
anchor,
pchild->options,
pchild->border_width,
- pchild->padX,
- pchild->padY,
- pchild->iPadX,
- pchild->iPadY);
+ pchild->pad_x,
+ pchild->pad_y,
+ pchild->i_pad_x,
+ pchild->i_pad_y);
if (info->button_n != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_n),0);
@@ -495,10 +495,10 @@ toggle_side (GtkWidget *widget, gpointer data)
pchild->anchor,
pchild->options,
pchild->border_width,
- pchild->padX,
- pchild->padY,
- pchild->iPadX,
- pchild->iPadY);
+ pchild->pad_x,
+ pchild->pad_y,
+ pchild->i_pad_x,
+ pchild->i_pad_y);
if (info->button_top != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_top),0);
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
index fad51b5f7..2f325360b 100644
--- a/gtk/gtk.defs
+++ b/gtk/gtk.defs
@@ -1,7 +1,7 @@
-;; generated by makeenums.awk ; -*- scheme -*-
+;; generated by makeenums.pl ; -*- scheme -*-
-; enumerations from "../../gtk+/gtk/gtkclist.h"
+; enumerations from "./gtkclist.h"
(define-enum GtkCellType
(empty GTK_CELL_EMPTY)
@@ -10,7 +10,7 @@
(pixtext GTK_CELL_PIXTEXT)
(widget GTK_CELL_WIDGET))
-; enumerations from "../../gtk+/gtk/gtkctree.h"
+; enumerations from "./gtkctree.h"
(define-enum GtkCTreePos
(before GTK_CTREE_POS_BEFORE)
@@ -22,14 +22,14 @@
(dotted GTK_CTREE_LINES_DOTTED)
(none GTK_CTREE_LINES_NONE))
-; enumerations from "../../gtk+/gtk/gtkdebug.h"
+; enumerations from "./gtkdebug.h"
(define-flags GtkDebugFlag
(objects GTK_DEBUG_OBJECTS)
(misc GTK_DEBUG_MISC)
(signals GTK_DEBUG_SIGNALS))
-; enumerations from "../../gtk+/gtk/gtkenums.h"
+; enumerations from "./gtkenums.h"
(define-flags GtkAccelFlags
(visible GTK_ACCEL_VISIBLE)
@@ -206,13 +206,13 @@
(dialog GTK_WINDOW_DIALOG)
(popup GTK_WINDOW_POPUP))
-; enumerations from "../../gtk+/gtk/gtkfontsel.h"
+; enumerations from "./gtkfontsel.h"
(define-enum GtkFontMetricType
(ixels-metric PIXELS_METRIC)
(oints-metric POINTS_METRIC))
-; enumerations from "../../gtk+/gtk/gtkobject.h"
+; enumerations from "./gtkobject.h"
(define-flags GtkObjectFlags
(destroyed GTK_DESTROYED)
@@ -225,10 +225,11 @@
(readable GTK_ARG_READABLE)
(writable GTK_ARG_WRITABLE)
(construct GTK_ARG_CONSTRUCT)
+ (child-arg GTK_ARG_CHILD_ARG)
(mask GTK_ARG_MASK)
(readwrite GTK_ARG_READWRITE))
-; enumerations from "../../gtk+/gtk/gtkpacker.h"
+; enumerations from "./gtkpacker.h"
(define-flags GtkPackerOptions
(expand GTK_PACK_EXPAND)
@@ -243,6 +244,14 @@
(define-enum GtkAnchorType
(center GTK_ANCHOR_CENTER)
+ (north GTK_ANCHOR_NORTH)
+ (north-west GTK_ANCHOR_NORTH_WEST)
+ (north-east GTK_ANCHOR_NORTH_EAST)
+ (south GTK_ANCHOR_SOUTH)
+ (south-west GTK_ANCHOR_SOUTH_WEST)
+ (south-east GTK_ANCHOR_SOUTH_EAST)
+ (west GTK_ANCHOR_WEST)
+ (east GTK_ANCHOR_EAST)
(n GTK_ANCHOR_N)
(nw GTK_ANCHOR_NW)
(ne GTK_ANCHOR_NE)
@@ -252,7 +261,7 @@
(w GTK_ANCHOR_W)
(e GTK_ANCHOR_E))
-; enumerations from "../../gtk+/gtk/gtkprivate.h"
+; enumerations from "./gtkprivate.h"
(define-flags GtkPrivateFlags
(user-style PRIVATE_GTK_USER_STYLE)
@@ -263,14 +272,14 @@
(has-shape-mask PRIVATE_GTK_HAS_SHAPE_MASK)
(in-reparent PRIVATE_GTK_IN_REPARENT))
-; enumerations from "../../gtk+/gtk/gtkspinbutton.h"
+; enumerations from "./gtkspinbutton.h"
(define-flags GtkSpinButtonUpdatePolicy
(always GTK_UPDATE_ALWAYS)
(if-valid GTK_UPDATE_IF_VALID)
(snap-to-ticks GTK_UPDATE_SNAP_TO_TICKS))
-; enumerations from "../../gtk+/gtk/gtktoolbar.h"
+; enumerations from "./gtktoolbar.h"
(define-enum GtkToolbarChildType
(space GTK_TOOLBAR_CHILD_SPACE)
@@ -279,13 +288,13 @@
(radiobutton GTK_TOOLBAR_CHILD_RADIOBUTTON)
(widget GTK_TOOLBAR_CHILD_WIDGET))
-; enumerations from "../../gtk+/gtk/gtktree.h"
+; enumerations from "./gtktree.h"
(define-enum GtkTreeViewMode
(line GTK_TREE_VIEW_LINE)
(item GTK_TREE_VIEW_ITEM))
-; enumerations from "../../gtk+/gtk/gtktypeutils.h"
+; enumerations from "./gtktypeutils.h"
(define-enum GtkFundamentalType
(invalid GTK_TYPE_INVALID)
@@ -310,7 +319,7 @@
(c-callback GTK_TYPE_C_CALLBACK)
(object GTK_TYPE_OBJECT))
-; enumerations from "../../gtk+/gtk/gtkwidget.h"
+; enumerations from "./gtkwidget.h"
(define-flags GtkWidgetFlags
(toplevel GTK_TOPLEVEL)
@@ -328,7 +337,7 @@
(rc-style GTK_RC_STYLE)
(basic GTK_BASIC))
-; enumerations from "../../gtk+/gdk/gdkprivate.h"
+; enumerations from "../gdk/gdkprivate.h"
(define-flags GdkDebugFlag
(misc GDK_DEBUG_MISC)
@@ -337,7 +346,7 @@
(color-context GDK_DEBUG_COLOR_CONTEXT)
(xim GDK_DEBUG_XIM))
-; enumerations from "../../gtk+/gdk/gdktypes.h"
+; enumerations from "../gdk/gdktypes.h"
(define-enum GdkWindowType
(root GDK_WINDOW_ROOT)
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 2a10e8f8f..ac005a3dd 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -119,7 +119,6 @@ gtk_accel_label_set_arg (GtkAccelLabel *accel_label,
gtk_accel_label_set_accel_widget (accel_label, (GtkWidget*) GTK_VALUE_OBJECT (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index c0ba64fca..6e7f397df 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -34,6 +34,7 @@ static void gtk_bin_remove (GtkContainer *container,
static void gtk_bin_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
+static GtkType gtk_bin_child_type (GtkContainer*container);
static GtkContainerClass *parent_class = NULL;
@@ -84,6 +85,7 @@ gtk_bin_class_init (GtkBinClass *class)
container_class->add = gtk_bin_add;
container_class->remove = gtk_bin_remove;
container_class->foreach = gtk_bin_foreach;
+ container_class->child_type = gtk_bin_child_type;
}
static void
@@ -95,6 +97,15 @@ gtk_bin_init (GtkBin *bin)
}
+static GtkType
+gtk_bin_child_type (GtkContainer *container)
+{
+ if (!GTK_BIN (container)->child)
+ return GTK_TYPE_WIDGET;
+ else
+ return GTK_TYPE_NONE;
+}
+
static void
gtk_bin_map (GtkWidget *widget)
{
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 2d0353400..8ed7dc022 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -24,6 +24,15 @@ enum {
ARG_HOMOGENEOUS
};
+enum {
+ CHILD_ARG_0,
+ CHILD_ARG_EXPAND,
+ CHILD_ARG_FILL,
+ CHILD_ARG_PADDING,
+ CHILD_ARG_PACK_TYPE,
+ CHILD_ARG_POSITION
+};
+
static void gtk_box_class_init (GtkBoxClass *klass);
static void gtk_box_init (GtkBox *box);
static void gtk_box_get_arg (GtkBox *box,
@@ -45,7 +54,16 @@ static void gtk_box_remove (GtkContainer *container,
static void gtk_box_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
-
+static void gtk_box_set_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
+static void gtk_box_get_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
+static GtkType gtk_box_child_type (GtkContainer *container);
+
static GtkContainerClass *parent_class = NULL;
@@ -89,6 +107,11 @@ gtk_box_class_init (GtkBoxClass *class)
gtk_object_add_arg_type ("GtkBox::spacing", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SPACING);
gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
+ gtk_container_add_child_arg_type ("GtkBox::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND);
+ gtk_container_add_child_arg_type ("GtkBox::fill", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_FILL);
+ gtk_container_add_child_arg_type ("GtkBox::padding", GTK_TYPE_ULONG, GTK_ARG_READWRITE, CHILD_ARG_PADDING);
+ gtk_container_add_child_arg_type ("GtkBox::pack_type", GTK_TYPE_PACK_TYPE, GTK_ARG_READWRITE, CHILD_ARG_PACK_TYPE);
+ gtk_container_add_child_arg_type ("GtkBox::position", GTK_TYPE_LONG, GTK_ARG_READWRITE, CHILD_ARG_POSITION);
widget_class->map = gtk_box_map;
widget_class->unmap = gtk_box_unmap;
@@ -98,6 +121,9 @@ gtk_box_class_init (GtkBoxClass *class)
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
container_class->foreach = gtk_box_foreach;
+ container_class->child_type = gtk_box_child_type;
+ container_class->set_child_arg = gtk_box_set_child_arg;
+ container_class->get_child_arg = gtk_box_get_child_arg;
}
static void
@@ -124,7 +150,6 @@ gtk_box_set_arg (GtkBox *box,
gtk_box_set_homogeneous (box, GTK_VALUE_BOOL (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -148,12 +173,135 @@ gtk_box_get_arg (GtkBox *box,
}
}
+static GtkType
+gtk_box_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
+}
+
+static void
+gtk_box_set_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id)
+{
+ gboolean expand = 0;
+ gboolean fill = 0;
+ guint padding = 0;
+ GtkPackType pack_type = 0;
+
+ if (arg_id != CHILD_ARG_POSITION)
+ gtk_box_query_child_packing (GTK_BOX (container),
+ child,
+ &expand,
+ &fill,
+ &padding,
+ &pack_type);
+
+ switch (arg_id)
+ {
+ case CHILD_ARG_EXPAND:
+ gtk_box_set_child_packing (GTK_BOX (container),
+ child,
+ GTK_VALUE_BOOL (*arg),
+ fill,
+ padding,
+ pack_type);
+ break;
+ case CHILD_ARG_FILL:
+ gtk_box_set_child_packing (GTK_BOX (container),
+ child,
+ expand,
+ GTK_VALUE_BOOL (*arg),
+ padding,
+ pack_type);
+ break;
+ case CHILD_ARG_PADDING:
+ gtk_box_set_child_packing (GTK_BOX (container),
+ child,
+ expand,
+ fill,
+ GTK_VALUE_ULONG (*arg),
+ pack_type);
+ break;
+ case CHILD_ARG_PACK_TYPE:
+ gtk_box_set_child_packing (GTK_BOX (container),
+ child,
+ expand,
+ fill,
+ padding,
+ GTK_VALUE_ENUM (*arg));
+ break;
+ case CHILD_ARG_POSITION:
+ gtk_box_reorder_child (GTK_BOX (container),
+ child,
+ GTK_VALUE_LONG (*arg));
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gtk_box_get_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id)
+{
+ gboolean expand = 0;
+ gboolean fill = 0;
+ guint padding = 0;
+ GtkPackType pack_type = 0;
+ GList *list;
+
+ if (arg_id != CHILD_ARG_POSITION)
+ gtk_box_query_child_packing (GTK_BOX (container),
+ child,
+ &expand,
+ &fill,
+ &padding,
+ &pack_type);
+
+ switch (arg_id)
+ {
+ case CHILD_ARG_EXPAND:
+ GTK_VALUE_BOOL (*arg) = expand;
+ break;
+ case CHILD_ARG_FILL:
+ GTK_VALUE_BOOL (*arg) = fill;
+ break;
+ case CHILD_ARG_PADDING:
+ GTK_VALUE_ULONG (*arg) = padding;
+ break;
+ case CHILD_ARG_PACK_TYPE:
+ GTK_VALUE_ENUM (*arg) = pack_type;
+ break;
+ case CHILD_ARG_POSITION:
+ GTK_VALUE_LONG (*arg) = 0;
+ for (list = GTK_BOX (container)->children; list; list = list->next)
+ {
+ GtkBoxChild *child_entry;
+
+ child_entry = list->data;
+ if (child_entry->widget == child)
+ break;
+ GTK_VALUE_LONG (*arg)++;
+ }
+ if (!list)
+ GTK_VALUE_LONG (*arg) = -1;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
void
gtk_box_pack_start (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding)
+ gboolean expand,
+ gboolean fill,
+ guint padding)
{
GtkBoxChild *child_info;
@@ -191,9 +339,9 @@ gtk_box_pack_start (GtkBox *box,
void
gtk_box_pack_end (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding)
+ gboolean expand,
+ gboolean fill,
+ guint padding)
{
GtkBoxChild *child_info;
@@ -251,8 +399,8 @@ gtk_box_pack_end_defaults (GtkBox *box,
}
void
-gtk_box_set_homogeneous (GtkBox *box,
- gint homogeneous)
+gtk_box_set_homogeneous (GtkBox *box,
+ gboolean homogeneous)
{
g_return_if_fail (box != NULL);
g_return_if_fail (GTK_IS_BOX (box));
@@ -281,7 +429,7 @@ gtk_box_set_spacing (GtkBox *box,
void
gtk_box_reorder_child (GtkBox *box,
GtkWidget *child,
- guint pos)
+ gint position)
{
GList *list;
@@ -313,13 +461,13 @@ gtk_box_reorder_child (GtkBox *box,
box->children = list->next;
tmp_list = box->children;
- while (pos && tmp_list->next)
+ while (position && tmp_list->next)
{
- pos--;
+ position--;
tmp_list = tmp_list->next;
}
- if (pos)
+ if (position)
{
tmp_list->next = list;
list->prev = tmp_list;
@@ -344,9 +492,9 @@ gtk_box_reorder_child (GtkBox *box,
void
gtk_box_query_child_packing (GtkBox *box,
GtkWidget *child,
- gint *expand,
- gint *fill,
- gint *padding,
+ gboolean *expand,
+ gboolean *fill,
+ guint *padding,
GtkPackType *pack_type)
{
GList *list;
@@ -382,10 +530,10 @@ gtk_box_query_child_packing (GtkBox *box,
void
gtk_box_set_child_packing (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding,
- GtkPackType pack_type)
+ gboolean expand,
+ gboolean fill,
+ guint padding,
+ GtkPackType pack_type)
{
GList *list;
GtkBoxChild *child_info;
@@ -415,7 +563,7 @@ gtk_box_set_child_packing (GtkBox *box,
child_info->pack = GTK_PACK_START;
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
+ gtk_widget_queue_resize (GTK_WIDGET (box));
}
}
diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h
index 7eebb5ae4..223207f95 100644
--- a/gtk/gtkbox.h
+++ b/gtk/gtkbox.h
@@ -65,36 +65,36 @@ struct _GtkBoxChild
guint gtk_box_get_type (void);
void gtk_box_pack_start (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding);
+ gboolean expand,
+ gboolean fill,
+ guint padding);
void gtk_box_pack_end (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding);
+ gboolean expand,
+ gboolean fill,
+ guint padding);
void gtk_box_pack_start_defaults (GtkBox *box,
GtkWidget *widget);
void gtk_box_pack_end_defaults (GtkBox *box,
GtkWidget *widget);
void gtk_box_set_homogeneous (GtkBox *box,
- gint homogeneous);
+ gboolean homogeneous);
void gtk_box_set_spacing (GtkBox *box,
gint spacing);
void gtk_box_reorder_child (GtkBox *box,
GtkWidget *child,
- guint pos);
+ gint position);
void gtk_box_query_child_packing (GtkBox *box,
GtkWidget *child,
- gint *expand,
- gint *fill,
- gint *padding,
+ gboolean *expand,
+ gboolean *fill,
+ guint *padding,
GtkPackType *pack_type);
void gtk_box_set_child_packing (GtkBox *box,
GtkWidget *child,
- gint expand,
- gint fill,
- gint padding,
+ gboolean expand,
+ gboolean fill,
+ guint padding,
GtkPackType pack_type);
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 9c4afe0b3..198ea17b2 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -49,6 +49,9 @@ static void gtk_button_init (GtkButton *button);
static void gtk_button_set_arg (GtkButton *button,
GtkArg *arg,
guint arg_id);
+static void gtk_button_get_arg (GtkButton *button,
+ GtkArg *arg,
+ guint arg_id);
static void gtk_button_map (GtkWidget *widget);
static void gtk_button_unmap (GtkWidget *widget);
static void gtk_button_realize (GtkWidget *widget);
@@ -87,6 +90,7 @@ static void gtk_real_button_pressed (GtkButton *button);
static void gtk_real_button_released (GtkButton *button);
static void gtk_real_button_enter (GtkButton *button);
static void gtk_real_button_leave (GtkButton *button);
+static GtkType gtk_button_child_type (GtkContainer *container);
static GtkContainerClass *parent_class;
@@ -108,7 +112,7 @@ gtk_button_get_type (void)
(GtkClassInitFunc) gtk_button_class_init,
(GtkObjectInitFunc) gtk_button_init,
(GtkArgSetFunc) gtk_button_set_arg,
- (GtkArgGetFunc) NULL,
+ (GtkArgGetFunc) gtk_button_get_arg,
};
button_type = gtk_type_unique (gtk_container_get_type (), &button_info);
@@ -131,7 +135,7 @@ gtk_button_class_init (GtkButtonClass *klass)
parent_class = gtk_type_class (gtk_container_get_type ());
- gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_LABEL);
+ gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
button_signals[PRESSED] =
gtk_signal_new ("pressed",
@@ -191,6 +195,7 @@ gtk_button_class_init (GtkButtonClass *klass)
container_class->add = gtk_button_add;
container_class->remove = gtk_button_remove;
container_class->foreach = gtk_button_foreach;
+ container_class->child_type = gtk_button_child_type;
klass->pressed = gtk_real_button_pressed;
klass->released = gtk_real_button_released;
@@ -210,6 +215,15 @@ gtk_button_init (GtkButton *button)
button->relief = GTK_RELIEF_NORMAL;
}
+static GtkType
+gtk_button_child_type (GtkContainer *container)
+{
+ if (!GTK_BUTTON (container)->child)
+ return GTK_TYPE_WIDGET;
+ else
+ return GTK_TYPE_NONE;
+}
+
static void
gtk_button_set_arg (GtkButton *button,
GtkArg *arg,
@@ -228,13 +242,31 @@ gtk_button_set_arg (GtkButton *button,
button->child = NULL;
}
- label = gtk_label_new (GTK_VALUE_STRING(*arg));
+ label = gtk_label_new (GTK_VALUE_STRING(*arg) ? GTK_VALUE_STRING(*arg) : "");
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (button), label);
gtk_container_enable_resize (GTK_CONTAINER (button));
break;
default:
+ break;
+ }
+}
+
+static void
+gtk_button_get_arg (GtkButton *button,
+ GtkArg *arg,
+ guint arg_id)
+{
+ switch (arg_id)
+ {
+ case ARG_LABEL:
+ if (button->child && GTK_IS_LABEL (button->child))
+ GTK_VALUE_STRING (*arg) = g_strdup (GTK_LABEL (button->child)->label);
+ else
+ GTK_VALUE_STRING (*arg) = NULL;
+ break;
+ default:
arg->type = GTK_TYPE_INVALID;
break;
}
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 45a57896f..81a41c349 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -46,10 +46,10 @@ static void gtk_real_check_button_draw_indicator (GtkCheckButton *check_but
static GtkToggleButtonClass *parent_class = NULL;
-guint
+GtkType
gtk_check_button_get_type (void)
{
- static guint check_button_type = 0;
+ static GtkType check_button_type = 0;
if (!check_button_type)
{
diff --git a/gtk/gtkcheckbutton.h b/gtk/gtkcheckbutton.h
index 899aa1791..d3cd0f306 100644
--- a/gtk/gtkcheckbutton.h
+++ b/gtk/gtkcheckbutton.h
@@ -29,9 +29,11 @@ extern "C" {
#endif /* __cplusplus */
-#define GTK_CHECK_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_check_button_get_type (), GtkCheckButton)
-#define GTK_CHECK_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_check_button_get_type (), GtkCheckButtonClass)
-#define GTK_IS_CHECK_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_check_button_get_type ())
+#define GTK_TYPE_CHECK_BUTTON (gtk_check_button_get_type ())
+#define GTK_CHECK_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CHECK_BUTTON, GtkCheckButton))
+#define GTK_CHECK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_BUTTON, GtkCheckButtonClass))
+#define GTK_IS_CHECK_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CHECK_BUTTON))
+#define GTK_IS_CHECK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_BUTTON))
typedef struct _GtkCheckButton GtkCheckButton;
@@ -54,7 +56,7 @@ struct _GtkCheckButtonClass
};
-guint gtk_check_button_get_type (void);
+GtkType gtk_check_button_get_type (void);
GtkWidget* gtk_check_button_new (void);
GtkWidget* gtk_check_button_new_with_label (const gchar *label);
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 91489b098..3da14fa88 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -101,7 +101,7 @@ gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item,
g_return_if_fail (check_menu_item != NULL);
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
- if (check_menu_item->active != state)
+ if (check_menu_item->active != (state != 0))
gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
}
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 3fdc17cee..d4e090c7f 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -1657,7 +1657,7 @@ gtk_clist_row_is_visible (GtkCList * clist,
return GTK_VISIBILITY_FULL;
}
-GtkAdjustment *
+GtkAdjustment*
gtk_clist_get_vadjustment (GtkCList * clist)
{
g_return_val_if_fail (clist != NULL, NULL);
@@ -1666,7 +1666,7 @@ gtk_clist_get_vadjustment (GtkCList * clist)
return gtk_range_get_adjustment (GTK_RANGE (clist->vscrollbar));
}
-GtkAdjustment *
+GtkAdjustment*
gtk_clist_get_hadjustment (GtkCList * clist)
{
g_return_val_if_fail (clist != NULL, NULL);
diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h
index 0a7bac42b..fb1ed5d58 100644
--- a/gtk/gtkclist.h
+++ b/gtk/gtkclist.h
@@ -53,9 +53,11 @@ typedef enum
GTK_CELL_WIDGET
} GtkCellType;
-#define GTK_CLIST(obj) (GTK_CHECK_CAST ((obj), gtk_clist_get_type (), GtkCList))
-#define GTK_CLIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_clist_get_type (), GtkCListClass))
-#define GTK_IS_CLIST(obj) (GTK_CHECK_TYPE ((obj), gtk_clist_get_type ()))
+#define GTK_TYPE_CLIST (gtk_clist_get_type ())
+#define GTK_CLIST(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CLIST, GtkCList))
+#define GTK_CLIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIST, GtkCListClass))
+#define GTK_IS_CLIST(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CLIST))
+#define GTK_IS_CLIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIST))
#define GTK_CLIST_FLAGS(clist) (GTK_CLIST (clist)->flags)
#define GTK_CLIST_SET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) |= (GTK_ ## flag))
@@ -362,6 +364,9 @@ void gtk_clist_moveto (GtkCList * clist,
GtkVisibility gtk_clist_row_is_visible (GtkCList * clist,
gint row);
+GtkAdjustment* gtk_clist_get_vadjustment (GtkCList * clist);
+GtkAdjustment* gtk_clist_get_hadjustment (GtkCList * clist);
+
/* returns the cell type */
GtkCellType gtk_clist_get_cell_type (GtkCList * clist,
gint row,
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 21611c36d..8b4db22d6 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -20,6 +20,7 @@
#include "gtkcontainer.h"
#include "gtkprivate.h"
#include "gtksignal.h"
+#include <stdarg.h>
enum {
@@ -39,6 +40,17 @@ enum {
ARG_CHILD
};
+typedef struct _GtkLArgInfo GtkLArgInfo;
+struct _GtkLArgInfo
+{
+ gchar *name;
+ GtkType type;
+ GtkType class_type;
+ guint arg_flags;
+ guint arg_id;
+ guint seq_id;
+};
+
typedef void (*GtkContainerSignal1) (GtkObject *object,
gpointer arg1,
@@ -107,9 +119,14 @@ static void gtk_container_children_callback (GtkWidget *widget,
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
+GtkArg* gtk_object_collect_args (guint *n_args,
+ va_list args1,
+ va_list args2);
+
static guint container_signals[LAST_SIGNAL] = { 0 };
+static GHashTable *arg_info_ht = NULL;
static GtkWidgetClass *parent_class = NULL;
@@ -156,7 +173,7 @@ gtk_container_class_init (GtkContainerClass *class)
vadjustment_key_id = gtk_object_data_force_id (vadjustment_key);
hadjustment_key_id = gtk_object_data_force_id (hadjustment_key);
- gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_LONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
+ gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_RESIZE);
gtk_object_add_arg_type ("GtkContainer::block_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_BLOCK_RESIZE);
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);
@@ -225,6 +242,414 @@ gtk_container_class_init (GtkContainerClass *class)
class->foreach = NULL;
class->focus = gtk_container_real_focus;
class->set_focus_child = gtk_container_real_set_focus_child;
+
+ /* linkage */
+ class->child_type = NULL;
+ class->get_child_arg = NULL;
+ class->set_child_arg = NULL;
+}
+
+static void
+gtk_container_get_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkType type,
+ GtkArg *arg,
+ guint arg_id)
+{
+ GtkContainerClass *class;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->get_child_arg)
+ class->get_child_arg (container, child, arg, arg_id);
+ else
+ arg->type = GTK_TYPE_INVALID;
+}
+
+static void
+gtk_container_set_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkType type,
+ GtkArg *arg,
+ guint arg_id)
+{
+ GtkContainerClass *class;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->set_child_arg)
+ class->set_child_arg (container, child, arg, arg_id);
+}
+
+GtkType
+gtk_container_child_type (GtkContainer *container)
+{
+ GtkType slot;
+ GtkContainerClass *class;
+
+ g_return_val_if_fail (container != NULL, 0);
+ g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
+
+ slot = GTK_TYPE_NONE;
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+ if (class->child_type)
+ slot = class->child_type (container);
+
+ return slot;
+}
+
+void
+gtk_container_add_child_arg_type (const gchar *arg_name,
+ GtkType arg_type,
+ guint arg_flags,
+ guint arg_id)
+{
+ GtkLArgInfo *info;
+ gchar class_part[1024];
+ gchar *arg_part;
+ GtkType class_type;
+
+ g_return_if_fail (arg_name != NULL);
+ g_return_if_fail (arg_type > GTK_TYPE_NONE);
+ g_return_if_fail (arg_id > 0);
+ g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) == GTK_ARG_READWRITE);
+
+ arg_flags |= GTK_ARG_CHILD_ARG;
+ arg_flags &= GTK_ARG_MASK;
+
+ arg_part = strchr (arg_name, ':');
+ if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
+ {
+ g_warning ("gtk_container_add_arg_type(): invalid arg name: \"%s\"\n", arg_name);
+ return;
+ }
+
+ strncpy (class_part, arg_name, (glong) (arg_part - arg_name));
+ class_part[(glong) (arg_part - arg_name)] = '\0';
+
+ class_type = gtk_type_from_name (class_part);
+ if (!class_type && !gtk_type_is_a (class_type, GTK_TYPE_CONTAINER))
+ {
+ g_warning ("gtk_container_add_arg_type(): invalid class name in arg: \"%s\"\n", arg_name);
+ return;
+ }
+
+ info = g_new (GtkLArgInfo, 1);
+ info->name = g_strdup (arg_name);
+ info->type = arg_type;
+ info->class_type = class_type;
+ info->arg_flags = arg_flags;
+ info->arg_id = arg_id;
+ info->seq_id = ++((GtkContainerClass*) gtk_type_class (class_type))->n_child_args;
+
+ if (!arg_info_ht)
+ arg_info_ht = g_hash_table_new (g_str_hash, g_str_equal);
+
+ g_hash_table_insert (arg_info_ht, info->name, info);
+}
+
+typedef struct
+{
+ GList *arg_list;
+ GtkType class_type;
+} GtkQueryLArgData;
+
+static void
+gtk_query_larg_foreach (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ register GtkLArgInfo *info;
+ register GtkQueryLArgData *data;
+
+ info = value;
+ data = user_data;
+
+ if (info->class_type == data->class_type)
+ data->arg_list = g_list_prepend (data->arg_list, info);
+}
+
+GtkArg*
+gtk_container_query_child_args (GtkType class_type,
+ guint32 **arg_flags,
+ guint *n_args)
+{
+ GtkArg *args;
+ GtkQueryLArgData query_data;
+
+ if (arg_flags)
+ *arg_flags = NULL;
+ g_return_val_if_fail (n_args != NULL, NULL);
+ *n_args = 0;
+ g_return_val_if_fail (gtk_type_is_a (class_type, GTK_TYPE_CONTAINER), NULL);
+
+ if (!arg_info_ht)
+ return NULL;
+
+ /* make sure the types class has been initialized, because
+ * the argument setup happens in the gtk_*_class_init() functions.
+ */
+ gtk_type_class (class_type);
+
+ query_data.arg_list = NULL;
+ query_data.class_type = class_type;
+ g_hash_table_foreach (arg_info_ht, gtk_query_larg_foreach, &query_data);
+
+ if (query_data.arg_list)
+ {
+ register GList *list;
+ register guint len;
+
+ list = query_data.arg_list;
+ len = 1;
+ while (list->next)
+ {
+ len++;
+ list = list->next;
+ }
+ g_assert (len == ((GtkContainerClass*) gtk_type_class (class_type))->n_child_args); /* paranoid */
+
+ args = g_new0 (GtkArg, len);
+ *n_args = len;
+ if (arg_flags)
+ *arg_flags = g_new (guint32, len);
+
+ do
+ {
+ GtkLArgInfo *info;
+
+ info = list->data;
+ list = list->prev;
+
+ g_assert (info->seq_id > 0 && info->seq_id <= len); /* paranoid */
+
+ args[info->seq_id - 1].type = info->type;
+ args[info->seq_id - 1].name = info->name;
+ if (arg_flags)
+ (*arg_flags)[info->seq_id - 1] = info->arg_flags;
+ }
+ while (list);
+
+ g_list_free (query_data.arg_list);
+ }
+ else
+ args = NULL;
+
+ return args;
+}
+
+void
+gtk_container_child_arg_getv (GtkContainer *container,
+ GtkWidget *child,
+ guint n_args,
+ GtkArg *args)
+{
+ guint i;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ if (!arg_info_ht)
+ return;
+
+ for (i = 0; i < n_args; i++)
+ {
+ GtkLArgInfo *info;
+ gchar *lookup_name;
+ gchar *d;
+
+
+ /* hm, the name cutting shouldn't be needed on gets, but what the heck...
+ */
+ lookup_name = g_strdup (args[i].name);
+ d = strchr (lookup_name, ':');
+ if (d && d[1] == ':')
+ {
+ d = strchr (d + 2, ':');
+ if (d)
+ *d = 0;
+
+ info = g_hash_table_lookup (arg_info_ht, lookup_name);
+ }
+ else
+ info = NULL;
+
+ if (!info)
+ {
+ g_warning ("gtk_container_child_arg_getv(): invalid arg name: \"%s\"\n",
+ lookup_name);
+ args[i].type = GTK_TYPE_INVALID;
+ g_free (lookup_name);
+ continue;
+ }
+ else if (!gtk_type_is_a (GTK_OBJECT_TYPE (container), info->class_type))
+ {
+ g_warning ("gtk_container_child_arg_getv(): invalid arg for %s: \"%s\"\n",
+ gtk_type_name (GTK_OBJECT_TYPE (container)), lookup_name);
+ args[i].type = GTK_TYPE_INVALID;
+ g_free (lookup_name);
+ continue;
+ }
+ else if (! (info->arg_flags & GTK_ARG_READABLE))
+ {
+ g_warning ("gtk_container_child_arg_getv(): arg is not supplied for read-access: \"%s\"\n",
+ lookup_name);
+ args[i].type = GTK_TYPE_INVALID;
+ g_free (lookup_name);
+ continue;
+ }
+ else
+ g_free (lookup_name);
+
+ args[i].type = info->type;
+ gtk_container_get_child_arg (container, child, info->class_type, &args[i], info->arg_id);
+ }
+}
+
+void
+gtk_container_child_arg_setv (GtkContainer *container,
+ GtkWidget *child,
+ guint n_args,
+ GtkArg *args)
+{
+ guint i;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ if (!arg_info_ht)
+ return;
+
+ for (i = 0; i < n_args; i++)
+ {
+ GtkLArgInfo *info;
+ gchar *lookup_name;
+ gchar *d;
+ gboolean arg_ok;
+
+ lookup_name = g_strdup (args[i].name);
+ d = strchr (lookup_name, ':');
+ if (d && d[1] == ':')
+ {
+ d = strchr (d + 2, ':');
+ if (d)
+ *d = 0;
+
+ info = g_hash_table_lookup (arg_info_ht, lookup_name);
+ }
+ else
+ info = NULL;
+
+ arg_ok = TRUE;
+
+ if (!info)
+ {
+ g_warning ("gtk_container_child_arg_setv(): invalid arg name: \"%s\"\n",
+ lookup_name);
+ arg_ok = FALSE;
+ }
+ else if (info->type != args[i].type)
+ {
+ g_warning ("gtk_container_child_arg_setv(): invalid arg type for: \"%s\"\n",
+ lookup_name);
+ arg_ok = FALSE;
+ }
+ else if (!gtk_type_is_a (GTK_OBJECT_TYPE (container), info->class_type))
+ {
+ g_warning ("gtk_container_child_arg_setv(): invalid arg for %s: \"%s\"\n",
+ gtk_type_name (GTK_OBJECT_TYPE (container)), lookup_name);
+ arg_ok = FALSE;
+ }
+ else if (! (info->arg_flags & GTK_ARG_WRITABLE))
+ {
+ g_warning ("gtk_container_child_arg_setv(): arg is not supplied for write-access: \"%s\"\n",
+ lookup_name);
+ arg_ok = FALSE;
+ }
+
+ g_free (lookup_name);
+
+ if (!arg_ok)
+ continue;
+
+ gtk_container_set_child_arg (container, child, info->class_type, &args[i], info->arg_id);
+ }
+}
+
+void
+gtk_container_add_with_args (GtkContainer *container,
+ GtkWidget *widget,
+ ...)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (widget->parent == NULL);
+
+ gtk_widget_ref (GTK_WIDGET (container));
+ gtk_widget_ref (widget);
+
+ gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
+
+ if (widget->parent)
+ {
+ GtkArg *args;
+ guint n_args;
+ va_list args1;
+ va_list args2;
+
+ va_start (args1, widget);
+ va_start (args2, widget);
+
+ args = gtk_object_collect_args (&n_args, args1, args2);
+ gtk_container_child_arg_setv (container, widget, n_args, args);
+ g_free (args);
+
+ va_end (args1);
+ va_end (args2);
+ }
+
+ gtk_widget_unref (widget);
+ gtk_widget_unref (GTK_WIDGET (container));
+}
+
+void
+gtk_container_add_with_argv (GtkContainer *container,
+ GtkWidget *widget,
+ guint n_args,
+ GtkArg *args)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (widget->parent == NULL);
+
+ gtk_widget_ref (GTK_WIDGET (container));
+ gtk_widget_ref (widget);
+
+ gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
+
+ if (widget->parent)
+ gtk_container_child_arg_setv (container, widget, n_args, args);
+
+ gtk_widget_unref (widget);
+ gtk_widget_unref (GTK_WIDGET (container));
}
static void
@@ -285,7 +710,7 @@ gtk_container_set_arg (GtkContainer *container,
switch (arg_id)
{
case ARG_BORDER_WIDTH:
- gtk_container_border_width (container, GTK_VALUE_LONG (*arg));
+ gtk_container_border_width (container, GTK_VALUE_ULONG (*arg));
break;
case ARG_AUTO_RESIZE:
if (GTK_VALUE_BOOL (*arg))
@@ -303,7 +728,6 @@ gtk_container_set_arg (GtkContainer *container,
gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -316,7 +740,7 @@ gtk_container_get_arg (GtkContainer *container,
switch (arg_id)
{
case ARG_BORDER_WIDTH:
- GTK_VALUE_LONG (*arg) = container->border_width;
+ GTK_VALUE_ULONG (*arg) = container->border_width;
break;
case ARG_AUTO_RESIZE:
GTK_VALUE_BOOL (*arg) = container->auto_resize;
@@ -332,7 +756,7 @@ gtk_container_get_arg (GtkContainer *container,
void
gtk_container_border_width (GtkContainer *container,
- gint border_width)
+ guint border_width)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index c0315b08b..62916110c 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -48,7 +48,7 @@ struct _GtkContainer
GtkWidget *focus_child;
- gint16 border_width;
+ guint border_width : 16;
guint auto_resize : 1;
guint need_resize : 1;
guint block_resize : 1;
@@ -63,6 +63,8 @@ struct _GtkContainerClass
{
GtkWidgetClass parent_class;
+ guint n_child_args;
+
void (* add) (GtkContainer *container,
GtkWidget *widget);
void (* remove) (GtkContainer *container,
@@ -75,13 +77,21 @@ struct _GtkContainerClass
GtkDirectionType direction);
void (* set_focus_child) (GtkContainer *container,
GtkWidget *widget);
+ GtkType (*child_type) (GtkContainer *container);
+ void (*set_child_arg) (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
+ void (*get_child_arg) (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
};
-
GtkType gtk_container_get_type (void);
void gtk_container_border_width (GtkContainer *container,
- gint border_width);
+ guint border_width);
void gtk_container_add (GtkContainer *container,
GtkWidget *widget);
void gtk_container_remove (GtkContainer *container,
@@ -114,7 +124,53 @@ void gtk_container_set_focus_vadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
void gtk_container_set_focus_hadjustment (GtkContainer *container,
GtkAdjustment *adjustment);
-
+
+GtkType gtk_container_child_type (GtkContainer *container);
+
+void gtk_container_add_child_arg_type (const gchar *arg_name,
+ GtkType arg_type,
+ guint arg_flags,
+ guint arg_id);
+
+/* Allocate a GtkArg array of size nargs that hold the
+ * names and types of the args that can be used with
+ * gtk_container_child_arg_get/gtk_container_child_arg_set.
+ * if (arg_flags!=NULL),
+ * (*arg_flags) will be set to point to a newly allocated
+ * guint array that holds the flags of the args.
+ * It is the callers response to do a
+ * g_free (returned_args); g_free (*arg_flags).
+ */
+GtkArg* gtk_container_query_child_args (GtkType class_type,
+ guint32 **arg_flags,
+ guint *nargs);
+
+/* gtk_container_child_arg_getv() sets an arguments type and value, or just
+ * its type to GTK_TYPE_INVALID.
+ * if arg->type == GTK_TYPE_STRING, it's the callers response to
+ * do a g_free (GTK_VALUE_STRING (arg));
+ */
+void gtk_container_child_arg_getv (GtkContainer *container,
+ GtkWidget *child,
+ guint n_args,
+ GtkArg *args);
+void gtk_container_child_arg_setv (GtkContainer *container,
+ GtkWidget *child,
+ guint n_args,
+ GtkArg *args);
+
+/* gtk_container_add_with_args() takes a variable argument list of the form:
+ * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
+ * where ARG_VALUES type depend on the argument and can consist of
+ * more than one c-function argument.
+ */
+void gtk_container_add_with_args (GtkContainer *container,
+ GtkWidget *widget,
+ ...);
+void gtk_container_add_with_argv (GtkContainer *container,
+ GtkWidget *widget,
+ guint n_args,
+ GtkArg *args);
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index b3d04c159..3dbce8ca1 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -41,6 +41,7 @@ static void gtk_fixed_remove (GtkContainer *container,
static void gtk_fixed_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
+static GtkType gtk_fixed_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
@@ -94,6 +95,13 @@ gtk_fixed_class_init (GtkFixedClass *class)
container_class->add = gtk_fixed_add;
container_class->remove = gtk_fixed_remove;
container_class->foreach = gtk_fixed_foreach;
+ container_class->child_type = gtk_fixed_child_type;
+}
+
+static GtkType
+gtk_fixed_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
}
static void
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 4e090d270..c5848e529 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -136,7 +136,6 @@ gtk_frame_set_arg (GtkFrame *frame,
gtk_frame_set_shadow_type (frame, GTK_VALUE_ENUM (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c
index 7b71e8ed6..ee35869e3 100644
--- a/gtk/gtkitemfactory.c
+++ b/gtk/gtkitemfactory.c
@@ -166,7 +166,7 @@ gtk_item_factory_get_type (void)
(GtkArgGetFunc) NULL,
};
- item_factory_type = gtk_type_unique (gtk_object_get_type (), &item_factory_info);
+ item_factory_type = gtk_type_unique (GTK_TYPE_OBJECT, &item_factory_info);
}
return item_factory_type;
@@ -179,7 +179,7 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
gtk_item_factory_class = class;
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
object_class = (GtkObjectClass*) class;
@@ -552,8 +552,8 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
g_return_if_fail (ifactory->accel_group == NULL);
g_return_if_fail (path != NULL);
- if (!gtk_type_is_a (container_type, gtk_option_menu_get_type ()))
- g_return_if_fail (gtk_type_is_a (container_type, gtk_menu_shell_get_type ()));
+ if (!gtk_type_is_a (container_type, GTK_TYPE_OPTION_MENU))
+ g_return_if_fail (gtk_type_is_a (container_type, GTK_TYPE_MENU_SHELL));
len = strlen (path);
@@ -913,21 +913,21 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
radio_group = NULL;
if (type_id == key_id_type_item)
- type = gtk_menu_item_get_type ();
+ type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_title)
- type = gtk_menu_item_get_type ();
+ type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_radio_item)
- type = gtk_radio_menu_item_get_type ();
+ type = GTK_TYPE_RADIO_MENU_ITEM;
else if (type_id == key_id_type_check_item)
- type = gtk_check_menu_item_get_type ();
+ type = GTK_TYPE_CHECK_MENU_ITEM;
else if (type_id == key_id_type_toggle_item)
- type = gtk_check_menu_item_get_type ();
+ type = GTK_TYPE_CHECK_MENU_ITEM;
else if (type_id == key_id_type_separator_item)
- type = gtk_menu_item_get_type ();
+ type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_branch)
- type = gtk_menu_item_get_type ();
+ type = GTK_TYPE_MENU_ITEM;
else if (type_id == key_id_type_last_branch)
- type = gtk_menu_item_get_type ();
+ type = GTK_TYPE_MENU_ITEM;
else
{
GtkWidget *radio_link;
@@ -935,7 +935,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
radio_link = gtk_item_factory_get_widget (ifactory, item_type_path);
if (radio_link && GTK_IS_RADIO_MENU_ITEM (radio_link))
{
- type = gtk_radio_menu_item_get_type ();
+ type = GTK_TYPE_RADIO_MENU_ITEM;
radio_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (radio_link));
}
else
@@ -985,7 +985,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
"GtkWidget::parent", parent,
NULL);
- if (type == gtk_radio_menu_item_get_type ())
+ if (type == GTK_TYPE_RADIO_MENU_ITEM)
gtk_radio_menu_item_set_group (GTK_RADIO_MENU_ITEM (widget), radio_group);
if (GTK_IS_CHECK_MENU_ITEM (widget))
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE);
@@ -1011,7 +1011,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
parent = widget;
widget =
- gtk_widget_new (gtk_menu_get_type (),
+ gtk_widget_new (GTK_TYPE_MENU,
NULL);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), widget);
}
@@ -1351,7 +1351,7 @@ gtk_item_factory_parse_menu_path (GScanner *scanner,
item->path = g_strdup (scanner->value.v_string);
item->accelerator_key = 0;
item->accelerator_mods = 0;
- item->modified = FALSE;
+ item->modified = TRUE;
item->in_propagation = FALSE;
item->item_type = NULL;
item->widgets = NULL;
@@ -1440,6 +1440,7 @@ gtk_item_factory_parse_rc_string (const gchar *rc_string)
g_return_if_fail (rc_string != NULL);
+ ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single;
scanner = g_scanner_new (&ifactory_scanner_config);
g_scanner_input_text (scanner, rc_string, strlen (rc_string));
@@ -1452,7 +1453,6 @@ gtk_item_factory_parse_rc_string (const gchar *rc_string)
void
gtk_item_factory_parse_rc_scanner (GScanner *scanner)
{
- gchar *orig_cpair_comment_single;
gpointer saved_symbol;
g_return_if_fail (scanner != NULL);
@@ -1464,9 +1464,6 @@ gtk_item_factory_parse_rc_scanner (GScanner *scanner)
g_scanner_remove_symbol (scanner, "menu-path");
g_scanner_add_symbol (scanner, "menu-path", gtk_item_factory_parse_menu_path);
- orig_cpair_comment_single = scanner->config->cpair_comment_single;
- scanner->config->cpair_comment_single = gtk_item_factory_class->cpair_comment_single;
-
g_scanner_peek_next_token (scanner);
while (scanner->next_token == '(')
@@ -1478,8 +1475,6 @@ gtk_item_factory_parse_rc_scanner (GScanner *scanner)
g_scanner_peek_next_token (scanner);
}
- scanner->config->cpair_comment_single = orig_cpair_comment_single;
-
g_scanner_remove_symbol (scanner, "menu-path");
g_scanner_add_symbol (scanner, "menu-path", saved_symbol);
}
@@ -1499,6 +1494,7 @@ gtk_item_factory_parse_rc (const gchar *file_name)
if (fd < 0)
return;
+ ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single;
scanner = g_scanner_new (&ifactory_scanner_config);
g_scanner_input_file (scanner, fd);
diff --git a/gtk/gtkitemfactory.h b/gtk/gtkitemfactory.h
index 44622b48c..01597fb00 100644
--- a/gtk/gtkitemfactory.h
+++ b/gtk/gtkitemfactory.h
@@ -114,8 +114,8 @@ struct _GtkItemFactoryItem
GtkType gtk_item_factory_get_type (void);
-/* `container_type' must be of gtk_menu_bar_get_type (), gtk_menu_get_type (),
- * or gtk_option_menu_get_type ().
+/* `container_type' must be of GTK_TYPE_MENU_BAR, GTK_TYPE_MENU,
+ * or GTK_TYPE_OPTION_MENU.
*/
GtkItemFactory* gtk_item_factory_new (GtkType container_type,
const gchar *path,
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index b369af075..da5ee65f0 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -110,7 +110,6 @@ gtk_label_set_arg (GtkLabel *label,
gtk_label_set_justify (label, GTK_VALUE_ENUM (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 9300b7765..fcba63c2f 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -73,6 +73,7 @@ static void gtk_list_marshal_signal (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
+static GtkType gtk_list_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
@@ -159,12 +160,19 @@ gtk_list_class_init (GtkListClass *class)
container_class->add = gtk_list_add;
container_class->remove = gtk_list_remove;
container_class->foreach = gtk_list_foreach;
+ container_class->child_type = gtk_list_child_type;
class->selection_changed = NULL;
class->select_child = gtk_real_list_select_child;
class->unselect_child = gtk_real_list_unselect_child;
}
+static GtkType
+gtk_list_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_LIST_ITEM;
+}
+
static void
gtk_list_init (GtkList *list)
{
diff --git a/gtk/gtklist.h b/gtk/gtklist.h
index 9f68b67a2..ef6a3d5e6 100644
--- a/gtk/gtklist.h
+++ b/gtk/gtklist.h
@@ -27,12 +27,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_LIST(obj) (GTK_CHECK_CAST (obj, gtk_list_get_type (), GtkList))
-#define GTK_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_list_get_type (), GtkListClass))
-#define GTK_IS_LIST(obj) (GTK_CHECK_TYPE (obj, gtk_list_get_type ()))
+#define GTK_TYPE_LIST (gtk_list_get_type ())
+#define GTK_LIST(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_LIST, GtkList))
+#define GTK_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST, GtkListClass))
+#define GTK_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_LIST))
+#define GTK_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST))
typedef struct _GtkList GtkList;
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index 3cf336db4..3120d0a71 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -46,10 +46,10 @@ static void gtk_real_list_item_toggle (GtkItem *item);
static GtkItemClass *parent_class = NULL;
-guint
+GtkType
gtk_list_item_get_type (void)
{
- static guint list_item_type = 0;
+ static GtkType list_item_type = 0;
if (!list_item_type)
{
diff --git a/gtk/gtklistitem.h b/gtk/gtklistitem.h
index 371b6d9b4..7a1476b2e 100644
--- a/gtk/gtklistitem.h
+++ b/gtk/gtklistitem.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_LIST_ITEM(obj) GTK_CHECK_CAST (obj, gtk_list_item_get_type (), GtkListItem)
-#define GTK_LIST_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_list_item_get_type (), GtkListItemClass)
-#define GTK_IS_LIST_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_list_item_get_type ())
+#define GTK_TYPE_LIST_ITEM (gtk_list_item_get_type ())
+#define GTK_LIST_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_LIST_ITEM, GtkListItem))
+#define GTK_LIST_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_ITEM, GtkListItemClass))
+#define GTK_IS_LIST_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_LIST_ITEM))
+#define GTK_IS_LIST_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_ITEM))
typedef struct _GtkListItem GtkListItem;
@@ -48,7 +51,7 @@ struct _GtkListItemClass
};
-guint gtk_list_item_get_type (void);
+GtkType gtk_list_item_get_type (void);
GtkWidget* gtk_list_item_new (void);
GtkWidget* gtk_list_item_new_with_label (const gchar *label);
void gtk_list_item_select (GtkListItem *list_item);
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index d89a68c38..efb3e9770 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -57,6 +57,7 @@ static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
GtkWidget *child);
static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
GdkEvent *event);
+static GtkType gtk_menu_shell_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
@@ -126,12 +127,19 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
container_class->add = gtk_menu_shell_add;
container_class->remove = gtk_menu_shell_remove;
container_class->foreach = gtk_menu_shell_foreach;
+ container_class->child_type = gtk_menu_shell_child_type;
klass->submenu_placement = GTK_TOP_BOTTOM;
klass->deactivate = gtk_real_menu_shell_deactivate;
klass->selection_done = NULL;
}
+static GtkType
+gtk_menu_shell_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_MENU_ITEM;
+}
+
static void
gtk_menu_shell_init (GtkMenuShell *menu_shell)
{
diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c
index 0fdea1619..4c773b977 100644
--- a/gtk/gtkmisc.c
+++ b/gtk/gtkmisc.c
@@ -109,7 +109,6 @@ gtk_misc_set_arg (GtkMisc *misc,
gtk_misc_set_alignment (misc, misc->xpad, GTK_VALUE_INT (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index d67bfaa62..acaeaf90e 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -141,15 +141,16 @@ static void gtk_notebook_menu_label_unparent (GtkWidget *widget,
static void gtk_notebook_menu_item_create (GtkNotebook *notebook,
GtkNotebookPage *page,
gint position);
+static GtkType gtk_notebook_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
static guint notebook_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_notebook_get_type (void)
{
- static guint notebook_type = 0;
+ static GtkType notebook_type = 0;
if (!notebook_type)
{
@@ -219,10 +220,17 @@ gtk_notebook_class_init (GtkNotebookClass *class)
container_class->foreach = gtk_notebook_foreach;
container_class->focus = gtk_notebook_focus;
container_class->set_focus_child = gtk_notebook_set_focus_child;
+ container_class->child_type = gtk_notebook_child_type;
class->switch_page = gtk_real_notebook_switch_page;
}
+static GtkType
+gtk_notebook_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
+}
+
static void
gtk_notebook_init (GtkNotebook *notebook)
{
diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h
index 501a991aa..c74ae40f1 100644
--- a/gtk/gtknotebook.h
+++ b/gtk/gtknotebook.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_NOTEBOOK(obj) GTK_CHECK_CAST (obj, gtk_notebook_get_type (), GtkNotebook)
-#define GTK_NOTEBOOK_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_notebook_get_type (), GtkNotebookClass)
-#define GTK_IS_NOTEBOOK(obj) GTK_CHECK_TYPE (obj, gtk_notebook_get_type ())
+#define GTK_TYPE_NOTEBOOK (gtk_notebook_get_type ())
+#define GTK_NOTEBOOK(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
+#define GTK_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
+#define GTK_IS_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_NOTEBOOK))
+#define GTK_IS_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
typedef struct _GtkNotebook GtkNotebook;
@@ -41,19 +44,19 @@ typedef struct _GtkNotebookPage GtkNotebookPage;
struct _GtkNotebook
{
GtkContainer container;
-
+
GtkNotebookPage *cur_page;
GList *children;
GList *first_tab;
GList *focus_tab;
-
+
GtkWidget *menu;
GdkWindow *panel;
-
+
guint32 timer;
-
+
gint16 tab_border;
-
+
guint show_tabs : 1;
guint show_border : 1;
guint tab_pos : 2;
@@ -68,7 +71,7 @@ struct _GtkNotebook
struct _GtkNotebookClass
{
GtkContainerClass parent_class;
-
+
void (* switch_page) (GtkNotebook *notebook,
GtkNotebookPage *page,
gint page_num);
@@ -86,7 +89,7 @@ struct _GtkNotebookPage
};
-guint gtk_notebook_get_type (void);
+GtkType gtk_notebook_get_type (void);
GtkWidget* gtk_notebook_new (void);
void gtk_notebook_append_page (GtkNotebook *notebook,
GtkWidget *child,
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c
index 2d8c145c3..ff4a0ea49 100644
--- a/gtk/gtkobject.c
+++ b/gtk/gtkobject.c
@@ -52,7 +52,7 @@ struct _GtkObjectData
struct _GtkArgInfo
{
- char *name;
+ gchar *name;
GtkType type;
GtkType class_type;
guint arg_flags;
@@ -61,6 +61,7 @@ struct _GtkArgInfo
};
+void gtk_object_init_type (void);
static void gtk_object_class_init (GtkObjectClass *klass);
static void gtk_object_init (GtkObject *object);
static void gtk_object_set_arg (GtkObject *object,
@@ -285,7 +286,6 @@ gtk_object_set_arg (GtkObject *object,
if ((arg->name[9 + 2 + 6] != ':') || (arg->name[9 + 2 + 7] != ':'))
{
g_warning ("invalid signal argument: \"%s\"\n", arg->name);
- arg->type = GTK_TYPE_INVALID;
return;
}
gtk_signal_connect (object, arg->name + 9 + 2 + 6 + 2,
@@ -296,7 +296,6 @@ gtk_object_set_arg (GtkObject *object,
if ((arg->name[9 + 2 + 13] != ':') || (arg->name[9 + 2 + 14] != ':'))
{
g_warning ("invalid signal argument: \"%s\"\n", arg->name);
- arg->type = GTK_TYPE_INVALID;
return;
}
gtk_signal_connect_object (object, arg->name + 9 + 2 + 13 + 2,
@@ -304,7 +303,6 @@ gtk_object_set_arg (GtkObject *object,
(GtkObject*) GTK_VALUE_SIGNAL (*arg).d);
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -697,21 +695,24 @@ gtk_object_getv (GtkObject *object,
if (!info)
{
- g_warning ("invalid arg name: \"%s\"\n", lookup_name);
+ g_warning ("gtk_object_getv(): invalid arg name: \"%s\"\n",
+ lookup_name);
args[i].type = GTK_TYPE_INVALID;
g_free (lookup_name);
continue;
}
else if (!gtk_type_is_a (object->klass->type, info->class_type))
{
- g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
+ g_warning ("gtk_object_getv(): invalid arg for %s: \"%s\"\n",
+ gtk_type_name (object->klass->type), lookup_name);
args[i].type = GTK_TYPE_INVALID;
g_free (lookup_name);
continue;
}
else if (! (info->arg_flags & GTK_ARG_READABLE))
{
- g_warning ("arg is not supplied for read-access: \"%s\"\n", lookup_name);
+ g_warning ("gtk_object_getv(): arg is not supplied for read-access: \"%s\"\n",
+ lookup_name);
args[i].type = GTK_TYPE_INVALID;
g_free (lookup_name);
continue;
@@ -766,7 +767,7 @@ gtk_object_query_args (GtkType class_type,
*arg_flags = NULL;
g_return_val_if_fail (nargs != NULL, NULL);
*nargs = 0;
- g_return_val_if_fail (gtk_type_is_a (class_type, gtk_object_get_type ()), NULL);
+ g_return_val_if_fail (gtk_type_is_a (class_type, GTK_TYPE_OBJECT), NULL);
if (!arg_info_ht)
return NULL;
@@ -898,22 +899,26 @@ gtk_object_setv (GtkObject *object,
if (!info)
{
- g_warning ("invalid arg name: \"%s\"\n", lookup_name);
+ g_warning ("gtk_object_setv(): invalid arg name: \"%s\"\n",
+ lookup_name);
arg_ok = FALSE;
}
else if (info->type != args[i].type)
{
- g_warning ("invalid arg type for: \"%s\"\n", lookup_name);
+ g_warning ("gtk_object_setv(): invalid arg type for: \"%s\"\n",
+ lookup_name);
arg_ok = FALSE;
}
else if (!gtk_type_is_a (object->klass->type, info->class_type))
{
- g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
+ g_warning ("gtk_object_setv(): invalid arg for %s: \"%s\"\n",
+ gtk_type_name (object->klass->type), lookup_name);
arg_ok = FALSE;
}
else if (! (info->arg_flags & GTK_ARG_WRITABLE))
{
- g_warning ("arg is not supplied for write-access: \"%s\"\n", lookup_name);
+ g_warning ("gtk_object_setv(): arg is not supplied for write-access: \"%s\"\n",
+ lookup_name);
arg_ok = FALSE;
}
@@ -949,7 +954,10 @@ gtk_object_add_arg_type (const char *arg_name,
g_return_if_fail (arg_type > GTK_TYPE_NONE);
g_return_if_fail (arg_id > 0);
g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0);
+ g_return_if_fail ((arg_flags & GTK_ARG_CHILD_ARG) == 0);
+ arg_flags &= GTK_ARG_MASK;
+
arg_part = strchr (arg_name, ':');
if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
{
@@ -963,7 +971,7 @@ gtk_object_add_arg_type (const char *arg_name,
class_type = gtk_type_from_name (class_part);
if (!class_type)
{
- g_warning ("invalid class name in arg: \"%s\"\n", arg_name);
+ g_warning ("gtk_object_add_arg_type(): invalid class name in arg: \"%s\"\n", arg_name);
return;
}
@@ -971,7 +979,7 @@ gtk_object_add_arg_type (const char *arg_name,
info->name = g_strdup (arg_name);
info->type = arg_type;
info->class_type = class_type;
- info->arg_flags = arg_flags & (GTK_ARG_READABLE | GTK_ARG_WRITABLE);
+ info->arg_flags = arg_flags;
info->arg_id = arg_id;
info->seq_id = ++((GtkObjectClass*) gtk_type_class (class_type))->n_args;
@@ -1386,7 +1394,7 @@ gtk_object_collect_args (guint *nargs,
switch (GTK_FUNDAMENTAL_TYPE (type))
{
case GTK_TYPE_INVALID:
- g_warning ("invalid arg name: \"%s\" %x\n", name, type);
+ g_warning ("GTK: invalid arg name: \"%s\" %x\n", name, type);
(void) va_arg (args1, long);
continue;
case GTK_TYPE_NONE:
diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h
index 289e76a42..aa61d4473 100644
--- a/gtk/gtkobject.h
+++ b/gtk/gtkobject.h
@@ -126,7 +126,9 @@ typedef enum
GTK_ARG_READABLE = 1 << 0,
GTK_ARG_WRITABLE = 1 << 1,
GTK_ARG_CONSTRUCT = 1 << 2,
- GTK_ARG_MASK = 0x03,
+ GTK_ARG_CHILD_ARG = 1 << 3,
+ GTK_ARG_MASK = 0x0f,
+
/* aliases
*/
GTK_ARG_READWRITE = GTK_ARG_READABLE | GTK_ARG_WRITABLE
@@ -295,7 +297,7 @@ void gtk_object_setv (GtkObject *object,
* (*arg_flags) will be set to point to a newly allocated
* guint array that holds the flags of the args.
* It is the callers response to do a
- * g_free (returned_args); g_free (*acess_masks).
+ * g_free (returned_args); g_free (*arg_flags).
*/
GtkArg* gtk_object_query_args (GtkType class_type,
guint32 **arg_flags,
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index 228f496e6..fb00bf614 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -57,15 +57,16 @@ static void gtk_option_menu_position (GtkMenu *menu,
gpointer user_data);
static void gtk_option_menu_show_all (GtkWidget *widget);
static void gtk_option_menu_hide_all (GtkWidget *widget);
+static GtkType gtk_option_menu_child_type (GtkContainer *container);
static GtkButtonClass *parent_class = NULL;
-guint
+GtkType
gtk_option_menu_get_type (void)
{
- static guint option_menu_type = 0;
+ static GtkType option_menu_type = 0;
if (!option_menu_type)
{
@@ -92,10 +93,12 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class)
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
+ GtkContainerClass *container_class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
+ container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (gtk_button_get_type ());
@@ -109,6 +112,14 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class)
widget_class->button_press_event = gtk_option_menu_button_press;
widget_class->show_all = gtk_option_menu_show_all;
widget_class->hide_all = gtk_option_menu_hide_all;
+
+ container_class->child_type = gtk_option_menu_child_type;
+}
+
+static GtkType
+gtk_option_menu_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_NONE;
}
static void
@@ -414,6 +425,7 @@ gtk_option_menu_expose (GtkWidget *widget,
if (remove_child)
gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget));
#else
+ remove_child = FALSE;
child = GTK_BUTTON (widget)->child;
child_event = *event;
if (child && GTK_WIDGET_NO_WINDOW (child) &&
diff --git a/gtk/gtkoptionmenu.h b/gtk/gtkoptionmenu.h
index 774eeeef9..e406e1a72 100644
--- a/gtk/gtkoptionmenu.h
+++ b/gtk/gtkoptionmenu.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_OPTION_MENU(obj) GTK_CHECK_CAST (obj, gtk_option_menu_get_type (), GtkOptionMenu)
-#define GTK_OPTION_MENU_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_option_menu_get_type (), GtkOptionMenuClass)
-#define GTK_IS_OPTION_MENU(obj) GTK_CHECK_TYPE (obj, gtk_option_menu_get_type ())
+#define GTK_TYPE_OPTION_MENU (gtk_option_menu_get_type ())
+#define GTK_OPTION_MENU(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_OPTION_MENU, GtkOptionMenu))
+#define GTK_OPTION_MENU_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_OPTION_MENU, GtkOptionMenuClass))
+#define GTK_IS_OPTION_MENU(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_OPTION_MENU))
+#define GTK_IS_OPTION_MENU_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_OPTION_MENU))
typedef struct _GtkOptionMenu GtkOptionMenu;
@@ -40,10 +43,10 @@ typedef struct _GtkOptionMenuClass GtkOptionMenuClass;
struct _GtkOptionMenu
{
GtkButton button;
-
+
GtkWidget *menu;
GtkWidget *menu_item;
-
+
guint16 width;
guint16 height;
};
@@ -54,7 +57,7 @@ struct _GtkOptionMenuClass
};
-guint gtk_option_menu_get_type (void);
+GtkType gtk_option_menu_get_type (void);
GtkWidget* gtk_option_menu_new (void);
GtkWidget* gtk_option_menu_get_menu (GtkOptionMenu *option_menu);
void gtk_option_menu_set_menu (GtkOptionMenu *option_menu,
diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c
index 0eb413053..1a3e7b5c9 100644
--- a/gtk/gtkpacker.c
+++ b/gtk/gtkpacker.c
@@ -108,6 +108,7 @@ static void gtk_packer_remove (GtkContainer *container,
static void gtk_packer_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
+static GtkType gtk_packer_child_type (GtkContainer *container);
static GtkPackerClass *parent_class;
@@ -156,10 +157,15 @@ gtk_packer_class_init (GtkPackerClass *klass)
container_class->add = gtk_packer_container_add;
container_class->remove = gtk_packer_remove;
- container_class->foreach = gtk_packer_foreach;
-
+ container_class->foreach = gtk_packer_foreach;
+ container_class->child_type = gtk_packer_child_type;
}
+static GtkType
+gtk_packer_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
+}
static void
gtk_packer_init (GtkPacker *packer)
@@ -204,10 +210,10 @@ redo_defaults_children (GtkPacker *packer)
if (child->use_default)
{
child->border_width = packer->default_border_width;
- child->padX = packer->default_padX;
- child->padY = packer->default_padY;
- child->iPadX = packer->default_iPadX;
- child->iPadY = packer->default_iPadY;
+ child->pad_x = packer->default_pad_x;
+ child->pad_y = packer->default_pad_y;
+ child->i_pad_x = packer->default_i_pad_x;
+ child->i_pad_y = packer->default_i_pad_y;
gtk_widget_queue_resize(GTK_WIDGET(packer));
}
list = g_list_next(list);
@@ -228,32 +234,36 @@ gtk_packer_set_default_border_width (GtkPacker *packer,
}
}
void
-gtk_packer_set_default_pad(GtkPacker *packer, gint padX ,gint padY)
+gtk_packer_set_default_pad(GtkPacker *packer,
+ guint pad_x,
+ guint pad_y)
{
g_return_if_fail (packer != NULL);
g_return_if_fail (GTK_IS_PACKER (packer));
- if (packer->default_padX != padX ||
- packer->default_padY != padY)
+ if (packer->default_pad_x != pad_x ||
+ packer->default_pad_y != pad_y)
{
- packer->default_padX = padX;;
- packer->default_padY = padY;;
- redo_defaults_children(packer);
+ packer->default_pad_x = pad_x;
+ packer->default_pad_y = pad_y;
+ redo_defaults_children (packer);
}
}
void
-gtk_packer_set_default_ipad(GtkPacker *packer, gint iPadX ,gint iPadY)
+gtk_packer_set_default_ipad(GtkPacker *packer,
+ guint i_pad_x,
+ guint i_pad_y)
{
g_return_if_fail (packer != NULL);
g_return_if_fail (GTK_IS_PACKER (packer));
- if (packer->default_iPadX != iPadX ||
- packer->default_iPadY != iPadY) {
+ if (packer->default_i_pad_x != i_pad_x ||
+ packer->default_i_pad_y != i_pad_y) {
- packer->default_iPadX = iPadX;;
- packer->default_iPadY = iPadY;;
- redo_defaults_children(packer);
+ packer->default_i_pad_x = i_pad_x;
+ packer->default_i_pad_y = i_pad_y;
+ redo_defaults_children (packer);
}
}
@@ -276,6 +286,7 @@ gtk_packer_add_defaults (GtkPacker *packer,
g_return_if_fail (packer != NULL);
g_return_if_fail (GTK_IS_PACKER (packer));
g_return_if_fail (child != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (child));
pchild = (GtkPackerChild*) g_malloc(sizeof(GtkPackerChild));
@@ -287,10 +298,10 @@ gtk_packer_add_defaults (GtkPacker *packer,
pchild->use_default = 1;
pchild->border_width = packer->default_border_width;
- pchild->padX = packer->default_padX;
- pchild->padY = packer->default_padY;
- pchild->iPadX = packer->default_iPadX;
- pchild->iPadY = packer->default_iPadY;
+ pchild->pad_x = packer->default_pad_x;
+ pchild->pad_y = packer->default_pad_y;
+ pchild->i_pad_x = packer->default_i_pad_x;
+ pchild->i_pad_y = packer->default_i_pad_y;
packer->children = g_list_append(packer->children, (gpointer) pchild);
@@ -319,10 +330,10 @@ gtk_packer_add (GtkPacker *packer,
GtkAnchorType anchor,
GtkPackerOptions options,
guint border_width,
- gint padX,
- gint padY,
- gint iPadX,
- gint iPadY)
+ guint pad_x,
+ guint pad_y,
+ guint i_pad_x,
+ guint i_pad_y)
{
GtkPackerChild *pchild;
@@ -341,10 +352,10 @@ gtk_packer_add (GtkPacker *packer,
pchild->use_default = 0;
pchild->border_width = border_width;
- pchild->padX = padX;
- pchild->padY = padY;
- pchild->iPadX = iPadX;
- pchild->iPadY = iPadY;
+ pchild->pad_x = pad_x;
+ pchild->pad_y = pad_y;
+ pchild->i_pad_x = i_pad_x;
+ pchild->i_pad_y = i_pad_y;
packer->children = g_list_append(packer->children, (gpointer) pchild);
@@ -373,10 +384,10 @@ gtk_packer_configure (GtkPacker *packer,
GtkAnchorType anchor,
GtkPackerOptions options,
guint border_width,
- gint padX,
- gint padY,
- gint ipadX,
- gint ipadY)
+ guint pad_x,
+ guint pad_y,
+ guint i_pad_x,
+ guint i_pad_y)
{
GList *list;
GtkPackerChild *pchild;
@@ -398,10 +409,10 @@ gtk_packer_configure (GtkPacker *packer,
pchild->use_default = 0;
pchild->border_width = border_width;
- pchild->padX = padX;
- pchild->padY = padY;
- pchild->iPadX = ipadX;
- pchild->iPadY = ipadY;
+ pchild->pad_x = pad_x;
+ pchild->pad_y = pad_y;
+ pchild->i_pad_x = i_pad_x;
+ pchild->i_pad_y = i_pad_y;
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (packer))
gtk_widget_queue_resize (child);
@@ -599,22 +610,22 @@ gtk_packer_size_request (GtkWidget *widget, GtkRequisition *requisition)
maxWidth = MAX (maxWidth,
(child->widget->requisition.width +
2 * child->border_width +
- child->padX + child->iPadX +
+ child->pad_x + child->i_pad_x +
width));
height += (child->widget->requisition.height +
2 * child->border_width +
- child->padY + child->iPadY);
+ child->pad_y + child->i_pad_y);
}
else
{
maxHeight = MAX (maxHeight,
(child->widget->requisition.height +
2 * child->border_width +
- child->padY + child->iPadY +
+ child->pad_y + child->i_pad_y +
height));
width += (child->widget->requisition.width +
2 * child->border_width +
- child->padX + child->iPadX);
+ child->pad_x + child->i_pad_x);
}
}
@@ -643,8 +654,8 @@ YExpansion (GList *children, gint cavityHeight)
widget = child->widget;
childHeight = (widget->requisition.height +
2 * child->border_width +
- child->iPadY +
- child->padY);
+ child->i_pad_y +
+ child->pad_y);
if ((child->side == GTK_SIDE_LEFT) || (child->side == GTK_SIDE_RIGHT))
{
curExpand = (cavityHeight - childHeight)/numExpand;
@@ -683,8 +694,8 @@ XExpansion (GList *children, gint cavityWidth)
widget = child->widget;
childWidth = (widget->requisition.width +
2 * child->border_width +
- child->iPadX +
- child->padX);
+ child->i_pad_x +
+ child->pad_x);
if ((child->side == GTK_SIDE_TOP) || (child->side == GTK_SIDE_BOTTOM))
{
@@ -741,8 +752,8 @@ gtk_packer_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
frameWidth = cavityWidth;
frameHeight = (child->widget->requisition.height +
2 * child->border_width +
- child->padY +
- child->iPadY);
+ child->pad_y +
+ child->i_pad_y);
if (child->options & GTK_PACK_EXPAND)
frameHeight += YExpansion(list, cavityHeight);
cavityHeight -= frameHeight;
@@ -767,8 +778,8 @@ gtk_packer_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
frameHeight = cavityHeight;
frameWidth = (child->widget->requisition.width +
2 * child->border_width +
- child->padX +
- child->iPadX);
+ child->pad_x +
+ child->i_pad_x);
if (child->options & GTK_PACK_EXPAND)
frameWidth += XExpansion(list, cavityWidth);
cavityWidth -= frameWidth;
@@ -788,18 +799,18 @@ gtk_packer_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
}
- borderX = child->padX + 2 * child->border_width;
- borderY = child->padY + 2 * child->border_width;
+ borderX = child->pad_x + 2 * child->border_width;
+ borderY = child->pad_y + 2 * child->border_width;
width = (child->widget->requisition.width +
2 * child->border_width +
- child->iPadX);
+ child->i_pad_x);
if ((child->options & GTK_FILL_X) || (width > (frameWidth - borderX)))
width = frameWidth - borderX;
height = (child->widget->requisition.height +
2 * child->border_width +
- child->iPadY);
+ child->i_pad_y);
if ((child->options & GTK_FILL_Y) || (height > (frameHeight - borderY)))
height = frameHeight - borderY;
diff --git a/gtk/gtkpacker.h b/gtk/gtkpacker.h
index b1c16e356..26a968a0a 100644
--- a/gtk/gtkpacker.h
+++ b/gtk/gtkpacker.h
@@ -43,29 +43,40 @@ typedef struct _GtkPacker GtkPacker;
typedef struct _GtkPackerClass GtkPackerClass;
typedef struct _GtkPackerChild GtkPackerChild;
-typedef enum {
+typedef enum
+{
GTK_PACK_EXPAND = 1 << 0, /*< nick=expand >*/
GTK_FILL_X = 1 << 1,
GTK_FILL_Y = 1 << 2
} GtkPackerOptions;
-typedef enum {
+typedef enum
+{
GTK_SIDE_TOP,
GTK_SIDE_BOTTOM,
GTK_SIDE_LEFT,
GTK_SIDE_RIGHT
} GtkSideType;
-typedef enum {
- GTK_ANCHOR_CENTER,
- GTK_ANCHOR_N,
- GTK_ANCHOR_NW,
- GTK_ANCHOR_NE,
- GTK_ANCHOR_S,
- GTK_ANCHOR_SW,
- GTK_ANCHOR_SE,
- GTK_ANCHOR_W,
- GTK_ANCHOR_E
+typedef enum
+{
+ GTK_ANCHOR_CENTER,
+ GTK_ANCHOR_NORTH,
+ GTK_ANCHOR_NORTH_WEST,
+ GTK_ANCHOR_NORTH_EAST,
+ GTK_ANCHOR_SOUTH,
+ GTK_ANCHOR_SOUTH_WEST,
+ GTK_ANCHOR_SOUTH_EAST,
+ GTK_ANCHOR_WEST,
+ GTK_ANCHOR_EAST,
+ GTK_ANCHOR_N = GTK_ANCHOR_NORTH,
+ GTK_ANCHOR_NW = GTK_ANCHOR_NORTH_WEST,
+ GTK_ANCHOR_NE = GTK_ANCHOR_NORTH_EAST,
+ GTK_ANCHOR_S = GTK_ANCHOR_SOUTH,
+ GTK_ANCHOR_SW = GTK_ANCHOR_SOUTH_WEST,
+ GTK_ANCHOR_SE = GTK_ANCHOR_SOUTH_EAST,
+ GTK_ANCHOR_W = GTK_ANCHOR_WEST,
+ GTK_ANCHOR_E = GTK_ANCHOR_EAST
} GtkAnchorType;
struct _GtkPackerChild
@@ -78,11 +89,11 @@ struct _GtkPackerChild
guint use_default : 1;
- guint border_width;
- gint padX;
- gint padY;
- gint iPadX;
- gint iPadY;
+ guint border_width : 16;
+ guint pad_x : 16;
+ guint pad_y : 16;
+ guint i_pad_x : 16;
+ guint i_pad_y : 16;
};
struct _GtkPacker
@@ -93,11 +104,11 @@ struct _GtkPacker
guint spacing;
- guint default_border_width;
- gint default_padX;
- gint default_padY;
- gint default_iPadX;
- gint default_iPadY;
+ guint default_border_width : 16;
+ guint default_pad_x : 16;
+ guint default_pad_y : 16;
+ guint default_i_pad_x : 16;
+ guint default_i_pad_y : 16;
};
struct _GtkPackerClass
@@ -119,30 +130,30 @@ void gtk_packer_add (GtkPacker *packer,
GtkAnchorType anchor,
GtkPackerOptions options,
guint border_width,
- gint padX,
- gint padY,
- gint ipadX,
- gint ipadY);
+ guint pad_x,
+ guint pad_y,
+ guint i_pad_x,
+ guint i_pad_y);
void gtk_packer_configure (GtkPacker *packer,
GtkWidget *child,
GtkSideType side,
GtkAnchorType anchor,
GtkPackerOptions options,
guint border_width,
- gint padX,
- gint padY,
- gint ipadX,
- gint ipadY);
+ guint pad_x,
+ guint pad_y,
+ guint i_pad_x,
+ guint i_pad_y);
void gtk_packer_set_spacing (GtkPacker *packer,
guint spacing);
void gtk_packer_set_default_border_width (GtkPacker *packer,
guint border);
void gtk_packer_set_default_pad (GtkPacker *packer,
- gint padX,
- gint padY);
+ guint pad_x,
+ guint pad_y);
void gtk_packer_set_default_ipad (GtkPacker *packer,
- gint iPadX,
- gint iPadY);
+ guint i_pad_x,
+ guint i_pad_y);
#ifdef __cplusplus
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index c1d8780b3..2009ae7f7 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -34,6 +34,7 @@ static void gtk_paned_remove (GtkContainer *container,
static void gtk_paned_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
+static GtkType gtk_paned_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
@@ -85,6 +86,16 @@ gtk_paned_class_init (GtkPanedClass *class)
container_class->add = gtk_paned_add;
container_class->remove = gtk_paned_remove;
container_class->foreach = gtk_paned_foreach;
+ container_class->child_type = gtk_paned_child_type;
+}
+
+static GtkType
+gtk_paned_child_type (GtkContainer *container)
+{
+ if (!GTK_PANED (container)->child1 || !GTK_PANED (container)->child2)
+ return GTK_TYPE_WIDGET;
+ else
+ return GTK_TYPE_NONE;
}
static void
diff --git a/gtk/gtkpaned.h b/gtk/gtkpaned.h
index fd2990d39..f7e78d88e 100644
--- a/gtk/gtkpaned.h
+++ b/gtk/gtkpaned.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_PANED(obj) GTK_CHECK_CAST (obj, gtk_paned_get_type (), GtkPaned)
-#define GTK_PANED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_paned_get_type (), GtkPanedClass)
-#define GTK_IS_PANED(obj) GTK_CHECK_TYPE (obj, gtk_paned_get_type ())
+#define GTK_TYPE_PANED (gtk_paned_get_type ())
+#define GTK_PANED(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PANED, GtkPaned))
+#define GTK_PANED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_PANED, GtkPanedClass))
+#define GTK_IS_PANED(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_PANED))
+#define GTK_IS_PANED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PANED))
typedef struct _GtkPaned GtkPaned;
@@ -40,22 +43,22 @@ typedef struct _GtkPanedClass GtkPanedClass;
struct _GtkPaned
{
GtkContainer container;
-
+
GtkWidget *child1;
GtkWidget *child2;
-
+
GdkWindow *handle;
GdkCursor *cursor;
GdkRectangle groove_rectangle;
GdkGC *xor_gc;
-
+
guint16 handle_size;
guint16 gutter_size;
gint child1_size;
guint position_set : 1;
guint in_drag : 1;
-
+
gint16 handle_xpos;
gint16 handle_ypos;
};
@@ -66,11 +69,15 @@ struct _GtkPanedClass
};
-guint gtk_paned_get_type (void);
-void gtk_paned_add1 (GtkPaned *paned, GtkWidget *child);
-void gtk_paned_add2 (GtkPaned *paned, GtkWidget *child);
-void gtk_paned_handle_size (GtkPaned *paned, guint16 size);
-void gtk_paned_gutter_size (GtkPaned *paned, guint16 size);
+GtkType gtk_paned_get_type (void);
+void gtk_paned_add1 (GtkPaned *paned,
+ GtkWidget *child);
+void gtk_paned_add2 (GtkPaned *paned,
+ GtkWidget *child);
+void gtk_paned_handle_size (GtkPaned *paned,
+ guint16 size);
+void gtk_paned_gutter_size (GtkPaned *paned,
+ guint16 size);
#ifdef __cplusplus
}
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 7f3c11409..52f4b290a 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -35,10 +35,10 @@ static void gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
static GtkCheckButtonClass *parent_class = NULL;
-guint
+GtkType
gtk_radio_button_get_type (void)
{
- static guint radio_button_type = 0;
+ static GtkType radio_button_type = 0;
if (!radio_button_type)
{
diff --git a/gtk/gtkradiobutton.h b/gtk/gtkradiobutton.h
index e5aa89e1e..f84b85c7f 100644
--- a/gtk/gtkradiobutton.h
+++ b/gtk/gtkradiobutton.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,21 +26,24 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_RADIO_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_radio_button_get_type (), GtkRadioButton)
-#define GTK_RADIO_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_radio_button_get_type (), GtkRadioButtonClass)
-#define GTK_IS_RADIO_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_radio_button_get_type ())
+#define GTK_TYPE_RADIO_BUTTON (gtk_radio_button_get_type ())
+#define GTK_RADIO_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_RADIO_BUTTON, GtkRadioButton))
+#define GTK_RADIO_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_BUTTON, GtkRadioButtonClass))
+#define GTK_IS_RADIO_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_RADIO_BUTTON))
+#define GTK_IS_RADIO_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_BUTTON))
-typedef struct _GtkRadioButton GtkRadioButton;
+typedef struct _GtkRadioButton GtkRadioButton;
typedef struct _GtkRadioButtonClass GtkRadioButtonClass;
struct _GtkRadioButton
{
GtkCheckButton check_button;
-
+
GSList *group;
};
@@ -50,16 +53,16 @@ struct _GtkRadioButtonClass
};
-guint gtk_radio_button_get_type (void);
-GtkWidget* gtk_radio_button_new (GSList *group);
+GtkType gtk_radio_button_get_type (void);
+GtkWidget* gtk_radio_button_new (GSList *group);
GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group);
-GtkWidget* gtk_radio_button_new_with_label (GSList *group,
+GtkWidget* gtk_radio_button_new_with_label (GSList *group,
const gchar *label);
GtkWidget* gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
- const gchar *label);
-GSList* gtk_radio_button_group (GtkRadioButton *radio_button);
-void gtk_radio_button_set_group (GtkRadioButton *radio_button,
- GSList *group);
+ const gchar *label);
+GSList* gtk_radio_button_group (GtkRadioButton *radio_button);
+void gtk_radio_button_set_group (GtkRadioButton *radio_button,
+ GSList *group);
#ifdef __cplusplus
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index ddfc0c698..711557776 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -27,10 +27,10 @@ static void gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_men
GdkRectangle *area);
-guint
+GtkType
gtk_radio_menu_item_get_type (void)
{
- static guint radio_menu_item_type = 0;
+ static GtkType radio_menu_item_type = 0;
if (!radio_menu_item_type)
{
diff --git a/gtk/gtkradiomenuitem.h b/gtk/gtkradiomenuitem.h
index 61ffd4720..37c0d0ec9 100644
--- a/gtk/gtkradiomenuitem.h
+++ b/gtk/gtkradiomenuitem.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_RADIO_MENU_ITEM(obj) GTK_CHECK_CAST (obj, gtk_radio_menu_item_get_type (), GtkRadioMenuItem)
-#define GTK_RADIO_MENU_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_radio_menu_item_get_type (), GtkRadioMenuItemClass)
-#define GTK_IS_RADIO_MENU_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_radio_menu_item_get_type ())
+#define GTK_TYPE_RADIO_MENU_ITEM (gtk_radio_menu_item_get_type ())
+#define GTK_RADIO_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem))
+#define GTK_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass))
+#define GTK_IS_RADIO_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_RADIO_MENU_ITEM))
+#define GTK_IS_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_MENU_ITEM))
typedef struct _GtkRadioMenuItem GtkRadioMenuItem;
@@ -40,7 +43,7 @@ typedef struct _GtkRadioMenuItemClass GtkRadioMenuItemClass;
struct _GtkRadioMenuItem
{
GtkCheckMenuItem check_menu_item;
-
+
GSList *group;
};
@@ -50,13 +53,13 @@ struct _GtkRadioMenuItemClass
};
-guint gtk_radio_menu_item_get_type (void);
-GtkWidget* gtk_radio_menu_item_new (GSList *group);
-GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
- const gchar *label);
-GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
-void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
- GSList *group);
+GtkType gtk_radio_menu_item_get_type (void);
+GtkWidget* gtk_radio_menu_item_new (GSList *group);
+GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
+ const gchar *label);
+GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
+void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
+ GSList *group);
#ifdef __cplusplus
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index f77e405ec..8d7a64dd3 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -18,29 +18,68 @@
*/
#include "gtktable.h"
+enum
+{
+ ARG_0,
+ ARG_N_ROWS,
+ ARG_N_COLUMNS,
+ ARG_COLUMN_SPACING,
+ ARG_ROW_SPACING,
+ ARG_HOMOGENEOUS,
+};
+
+enum
+{
+ CHILD_ARG_0,
+ CHILD_ARG_LEFT_ATTACH,
+ CHILD_ARG_RIGHT_ATTACH,
+ CHILD_ARG_TOP_ATTACH,
+ CHILD_ARG_BOTTOM_ATTACH,
+ CHILD_ARG_X_OPTIONS,
+ CHILD_ARG_Y_OPTIONS,
+ CHILD_ARG_X_PADDING,
+ CHILD_ARG_Y_PADDING
+};
+
static void gtk_table_class_init (GtkTableClass *klass);
-static void gtk_table_init (GtkTable *table);
-static void gtk_table_finalize (GtkObject *object);
-static void gtk_table_map (GtkWidget *widget);
-static void gtk_table_unmap (GtkWidget *widget);
-static void gtk_table_draw (GtkWidget *widget,
+static void gtk_table_init (GtkTable *table);
+static void gtk_table_finalize (GtkObject *object);
+static void gtk_table_map (GtkWidget *widget);
+static void gtk_table_unmap (GtkWidget *widget);
+static void gtk_table_draw (GtkWidget *widget,
GdkRectangle *area);
-static gint gtk_table_expose (GtkWidget *widget,
+static gint gtk_table_expose (GtkWidget *widget,
GdkEventExpose *event);
-static void gtk_table_size_request (GtkWidget *widget,
+static void gtk_table_size_request (GtkWidget *widget,
GtkRequisition *requisition);
-static void gtk_table_size_allocate (GtkWidget *widget,
+static void gtk_table_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static void gtk_table_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_foreach (GtkContainer *container,
+static void gtk_table_add (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_table_remove (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_table_foreach (GtkContainer *container,
GtkCallback callback,
- gpointer callback_data);
-
-static void gtk_table_size_request_init (GtkTable *table);
+ gpointer callback_data);
+static void gtk_table_get_arg (GtkObject *object,
+ GtkArg *arg,
+ guint arg_id);
+static void gtk_table_set_arg (GtkObject *object,
+ GtkArg *arg,
+ guint arg_id);
+static void gtk_table_set_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
+static void gtk_table_get_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id);
+static GtkType gtk_table_child_type (GtkContainer *container);
+
+
+static void gtk_table_size_request_init (GtkTable *table);
static void gtk_table_size_request_pass1 (GtkTable *table);
static void gtk_table_size_request_pass2 (GtkTable *table);
static void gtk_table_size_request_pass3 (GtkTable *table);
@@ -53,11 +92,11 @@ static void gtk_table_size_allocate_pass2 (GtkTable *table);
static GtkContainerClass *parent_class = NULL;
-guint
+GtkType
gtk_table_get_type (void)
{
- static guint table_type = 0;
-
+ static GtkType table_type = 0;
+
if (!table_type)
{
GtkTypeInfo table_info =
@@ -67,13 +106,13 @@ gtk_table_get_type (void)
sizeof (GtkTableClass),
(GtkClassInitFunc) gtk_table_class_init,
(GtkObjectInitFunc) gtk_table_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
+ gtk_table_set_arg,
+ gtk_table_get_arg,
};
-
+
table_type = gtk_type_unique (gtk_container_get_type (), &table_info);
}
-
+
return table_type;
}
@@ -83,145 +122,371 @@ gtk_table_class_init (GtkTableClass *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 (gtk_container_get_type ());
+
+ gtk_object_add_arg_type ("GtkTable::n_rows", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_ROWS);
+ gtk_object_add_arg_type ("GtkTable::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_COLUMNS);
+ gtk_object_add_arg_type ("GtkTable::row_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_ROW_SPACING);
+ gtk_object_add_arg_type ("GtkTable::column_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_COLUMN_SPACING);
+ gtk_object_add_arg_type ("GtkTable::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
+ gtk_container_add_child_arg_type ("GtkTable::left_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_LEFT_ATTACH);
+ gtk_container_add_child_arg_type ("GtkTable::right_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_RIGHT_ATTACH);
+ gtk_container_add_child_arg_type ("GtkTable::top_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_TOP_ATTACH);
+ gtk_container_add_child_arg_type ("GtkTable::bottom_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_BOTTOM_ATTACH);
+ gtk_container_add_child_arg_type ("GtkTable::x_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_X_OPTIONS);
+ gtk_container_add_child_arg_type ("GtkTable::y_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_Y_OPTIONS);
+ gtk_container_add_child_arg_type ("GtkTable::x_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_X_PADDING);
+ gtk_container_add_child_arg_type ("GtkTable::y_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_Y_PADDING);
object_class->finalize = gtk_table_finalize;
-
+
widget_class->map = gtk_table_map;
widget_class->unmap = gtk_table_unmap;
widget_class->draw = gtk_table_draw;
widget_class->expose_event = gtk_table_expose;
widget_class->size_request = gtk_table_size_request;
widget_class->size_allocate = gtk_table_size_allocate;
-
+
container_class->add = gtk_table_add;
container_class->remove = gtk_table_remove;
container_class->foreach = gtk_table_foreach;
+ container_class->child_type = gtk_table_child_type;
+ container_class->set_child_arg = gtk_table_set_child_arg;
+ container_class->get_child_arg = gtk_table_get_child_arg;
+}
+
+static GtkType
+gtk_table_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_WIDGET;
}
static void
-gtk_table_init (GtkTable *table)
+gtk_table_get_arg (GtkObject *object,
+ GtkArg *arg,
+ guint arg_id)
{
- GTK_WIDGET_SET_FLAGS (table, GTK_NO_WINDOW | GTK_BASIC);
+ GtkTable *table;
- table->children = NULL;
- table->rows = NULL;
- table->cols = NULL;
- table->nrows = 0;
- table->ncols = 0;
- table->homogeneous = FALSE;
+ table = GTK_TABLE (object);
+
+ switch (arg_id)
+ {
+ case ARG_N_ROWS:
+ GTK_VALUE_UINT (*arg) = table->nrows;
+ break;
+ case ARG_N_COLUMNS:
+ GTK_VALUE_UINT (*arg) = table->ncols;
+ break;
+ case ARG_ROW_SPACING:
+ GTK_VALUE_UINT (*arg) = table->row_spacing;
+ break;
+ case ARG_COLUMN_SPACING:
+ GTK_VALUE_UINT (*arg) = table->column_spacing;
+ break;
+ case ARG_HOMOGENEOUS:
+ GTK_VALUE_BOOL (*arg) = table->homogeneous;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
}
static void
-gtk_table_init_rows (GtkTable *table, int start, int end)
+gtk_table_set_arg (GtkObject *object,
+ GtkArg *arg,
+ guint arg_id)
{
- const int spacing = table->row_spacing;
- int row;
+ GtkTable *table;
+
+ table = GTK_TABLE (object);
- for (row = start; row < end; row++)
+ switch (arg_id)
{
- table->rows[row].requisition = 0;
- table->rows[row].allocation = 0;
- table->rows[row].spacing = spacing;
- table->rows[row].need_expand = 0;
- table->rows[row].need_shrink = 0;
- table->rows[row].expand = 0;
- table->rows[row].shrink = 0;
+ case ARG_N_ROWS:
+ gtk_table_resize (table, GTK_VALUE_UINT (*arg), table->ncols);
+ break;
+ case ARG_N_COLUMNS:
+ gtk_table_resize (table, table->nrows, GTK_VALUE_UINT (*arg));
+ break;
+ case ARG_ROW_SPACING:
+ gtk_table_set_row_spacings (table, GTK_VALUE_UINT (*arg));
+ break;
+ case ARG_COLUMN_SPACING:
+ gtk_table_set_col_spacings (table, GTK_VALUE_UINT (*arg));
+ break;
+ case ARG_HOMOGENEOUS:
+ gtk_table_set_homogeneous (table, GTK_VALUE_BOOL (*arg));
+ break;
+ default:
+ break;
}
}
static void
-gtk_table_init_cols (GtkTable *table, int start, int end)
+gtk_table_set_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id)
{
- const int spacing = table->column_spacing;
- int col;
-
- for (col = start; col < end; col++)
+ GtkTable *table;
+ GtkTableChild *table_child;
+ GList *list;
+
+ table = GTK_TABLE (container);
+ table_child = NULL;
+ for (list = table->children; list; list = list->next)
+ {
+ table_child = list->data;
+
+ if (table_child->widget == child)
+ break;
+ }
+ if (!list)
+ return;
+
+ switch (arg_id)
{
- table->cols[col].requisition = 0;
- table->cols[col].allocation = 0;
- table->cols[col].spacing = spacing;
- table->cols[col].need_expand = 0;
- table->cols[col].need_shrink = 0;
- table->cols[col].expand = 0;
- table->cols[col].shrink = 0;
+ case CHILD_ARG_LEFT_ATTACH:
+ if (GTK_VALUE_UINT (*arg) < table_child->right_attach)
+ table_child->left_attach = GTK_VALUE_UINT (*arg);
+ break;
+ case CHILD_ARG_RIGHT_ATTACH:
+ if (GTK_VALUE_UINT (*arg) > table_child->left_attach)
+ table_child->right_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->right_attach >= table->ncols)
+ gtk_table_resize (table, table->ncols, table_child->right_attach + 1);
+ break;
+ case CHILD_ARG_TOP_ATTACH:
+ if (GTK_VALUE_UINT (*arg) < table_child->bottom_attach)
+ table_child->top_attach = GTK_VALUE_UINT (*arg);
+ break;
+ case CHILD_ARG_BOTTOM_ATTACH:
+ if (GTK_VALUE_UINT (*arg) > table_child->top_attach)
+ table_child->bottom_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->bottom_attach >= table->nrows)
+ gtk_table_resize (table, table_child->bottom_attach + 1, table->ncols);
+ break;
+ case CHILD_ARG_X_OPTIONS:
+ table_child->xexpand = (GTK_VALUE_FLAGS (*arg) & GTK_EXPAND) != 0;
+ table_child->xshrink = (GTK_VALUE_FLAGS (*arg) & GTK_SHRINK) != 0;
+ table_child->xfill = (GTK_VALUE_FLAGS (*arg) & GTK_FILL) != 0;
+ break;
+ case CHILD_ARG_Y_OPTIONS:
+ table_child->yexpand = (GTK_VALUE_FLAGS (*arg) & GTK_EXPAND) != 0;
+ table_child->yshrink = (GTK_VALUE_FLAGS (*arg) & GTK_SHRINK) != 0;
+ table_child->yfill = (GTK_VALUE_FLAGS (*arg) & GTK_FILL) != 0;
+ break;
+ case CHILD_ARG_X_PADDING:
+ table_child->xpadding = GTK_VALUE_UINT (*arg);
+ break;
+ case CHILD_ARG_Y_PADDING:
+ table_child->ypadding = GTK_VALUE_UINT (*arg);
+ break;
+ default:
+ break;
}
+ if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
}
-GtkWidget*
-gtk_table_new (gint rows,
- gint columns,
- gint homogeneous)
+static void
+gtk_table_get_child_arg (GtkContainer *container,
+ GtkWidget *child,
+ GtkArg *arg,
+ guint arg_id)
{
GtkTable *table;
+ GtkTableChild *table_child;
+ GList *list;
- table = gtk_type_new (gtk_table_get_type ());
+ table = GTK_TABLE (container);
+ table_child = NULL;
+ for (list = table->children; list; list = list->next)
+ {
+ table_child = list->data;
- table->nrows = rows;
- table->ncols = columns;
- table->homogeneous = (homogeneous ? TRUE : FALSE);
+ if (table_child->widget == child)
+ break;
+ }
+ if (!list)
+ return;
+
+ switch (arg_id)
+ {
+ case CHILD_ARG_LEFT_ATTACH:
+ GTK_VALUE_UINT (*arg) = table_child->left_attach;
+ break;
+ case CHILD_ARG_RIGHT_ATTACH:
+ GTK_VALUE_UINT (*arg) = table_child->right_attach;
+ break;
+ case CHILD_ARG_TOP_ATTACH:
+ GTK_VALUE_UINT (*arg) = table_child->top_attach;
+ break;
+ case CHILD_ARG_BOTTOM_ATTACH:
+ GTK_VALUE_UINT (*arg) = table_child->bottom_attach;
+ break;
+ case CHILD_ARG_X_OPTIONS:
+ GTK_VALUE_FLAGS (*arg) = (table_child->xexpand * GTK_EXPAND |
+ table_child->xshrink * GTK_SHRINK |
+ table_child->xfill * GTK_FILL);
+ break;
+ case CHILD_ARG_Y_OPTIONS:
+ GTK_VALUE_FLAGS (*arg) = (table_child->yexpand * GTK_EXPAND |
+ table_child->yshrink * GTK_SHRINK |
+ table_child->yfill * GTK_FILL);
+ break;
+ case CHILD_ARG_X_PADDING:
+ GTK_VALUE_UINT (*arg) = table_child->xpadding;
+ break;
+ case CHILD_ARG_Y_PADDING:
+ GTK_VALUE_UINT (*arg) = table_child->ypadding;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+static void
+gtk_table_init (GtkTable *table)
+{
+ GTK_WIDGET_SET_FLAGS (table, GTK_NO_WINDOW | GTK_BASIC);
+
+ table->children = NULL;
+ table->rows = NULL;
+ table->cols = NULL;
+ table->nrows = 0;
+ table->ncols = 0;
table->column_spacing = 0;
table->row_spacing = 0;
-
- table->rows = g_new (GtkTableRowCol, table->nrows);
- table->cols = g_new (GtkTableRowCol, table->ncols);
+ table->homogeneous = FALSE;
+}
+
+GtkWidget*
+gtk_table_new (guint rows,
+ guint columns,
+ gboolean homogeneous)
+{
+ GtkTable *table;
- gtk_table_init_rows (table, 0, table->nrows);
- gtk_table_init_cols (table, 0, table->ncols);
+ g_return_val_if_fail (rows >= 1, NULL);
+ g_return_val_if_fail (columns >= 1, NULL);
+
+ table = gtk_type_new (gtk_table_get_type ());
+
+ table->homogeneous = (homogeneous ? TRUE : FALSE);
+ gtk_table_resize (table, rows, columns);
+
return GTK_WIDGET (table);
}
-static void
-gtk_table_expand_cols (GtkTable *table, int new_max)
+void
+gtk_table_resize (GtkTable *table,
+ guint n_rows,
+ guint n_cols)
{
- table->cols = g_realloc (table->cols, new_max * sizeof (GtkTableRowCol));
- gtk_table_init_cols (table, table->ncols, new_max);
- table->ncols = new_max;
-}
+ g_return_if_fail (table != NULL);
+ g_return_if_fail (GTK_IS_TABLE (table));
-static void
-gtk_table_expand_rows (GtkTable *table, int new_max)
-{
- table->rows = g_realloc (table->rows, new_max * sizeof (GtkTableRowCol));
- gtk_table_init_rows (table, table->nrows, new_max);
- table->nrows = new_max;
+ n_rows = MAX (n_rows, 1);
+ n_cols = MAX (n_cols, 1);
+
+ if (n_rows != table->nrows ||
+ n_cols != table->ncols)
+ {
+ GList *list;
+
+ for (list = table->children; list; list = list->next)
+ {
+ GtkTableChild *child;
+
+ child = list->data;
+
+ n_rows = MAX (n_rows, child->bottom_attach + 1);
+ n_cols = MAX (n_cols, child->right_attach + 1);
+ }
+
+ if (n_rows != table->nrows)
+ {
+ guint i;
+
+ i = table->nrows;
+ table->nrows = n_rows;
+ table->rows = g_realloc (table->rows, table->nrows * sizeof (GtkTableRowCol));
+
+ for (; i < table->nrows; i++)
+ {
+ table->rows[i].requisition = 0;
+ table->rows[i].allocation = 0;
+ table->rows[i].spacing = table->row_spacing;
+ table->rows[i].need_expand = 0;
+ table->rows[i].need_shrink = 0;
+ table->rows[i].expand = 0;
+ table->rows[i].shrink = 0;
+ }
+ }
+
+ if (n_cols != table->ncols)
+ {
+ guint i;
+
+ i = table->ncols;
+ table->ncols = n_cols;
+ table->cols = g_realloc (table->cols, table->ncols * sizeof (GtkTableRowCol));
+
+ for (; i < table->ncols; i++)
+ {
+ table->cols[i].requisition = 0;
+ table->cols[i].allocation = 0;
+ table->cols[i].spacing = table->column_spacing;
+ table->cols[i].need_expand = 0;
+ table->cols[i].need_shrink = 0;
+ table->cols[i].expand = 0;
+ table->cols[i].shrink = 0;
+ }
+ }
+ }
}
void
-gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach,
- gint xoptions,
- gint yoptions,
- gint xpadding,
- gint ypadding)
+gtk_table_attach (GtkTable *table,
+ GtkWidget *child,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach,
+ GtkAttachOptions xoptions,
+ GtkAttachOptions yoptions,
+ guint xpadding,
+ guint ypadding)
{
GtkTableChild *table_child;
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
g_return_if_fail (child != NULL);
-
- g_return_if_fail (left_attach >= 0);
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (child->parent == NULL);
+
+ /* g_return_if_fail (left_attach >= 0); */
g_return_if_fail (left_attach < right_attach);
- g_return_if_fail (top_attach >= 0);
+ /* g_return_if_fail (top_attach >= 0); */
g_return_if_fail (top_attach < bottom_attach);
-
+
if (right_attach >= table->ncols)
- gtk_table_expand_cols (table, right_attach);
-
+ gtk_table_resize (table, table->nrows, right_attach + 1);
+
if (bottom_attach >= table->nrows)
- gtk_table_expand_rows (table, bottom_attach);
-
+ gtk_table_resize (table, bottom_attach + 1, table->ncols);
+
table_child = g_new (GtkTableChild, 1);
table_child->widget = child;
table_child->left_attach = left_attach;
@@ -236,11 +501,11 @@ gtk_table_attach (GtkTable *table,
table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
table_child->yfill = (yoptions & GTK_FILL) != 0;
table_child->ypadding = ypadding;
-
+
table->children = g_list_prepend (table->children, table_child);
-
+
gtk_widget_set_parent (child, GTK_WIDGET (table));
-
+
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (table)))
{
if (GTK_WIDGET_REALIZED (GTK_WIDGET (table)) &&
@@ -251,18 +516,18 @@ gtk_table_attach (GtkTable *table,
!GTK_WIDGET_MAPPED (child))
gtk_widget_map (child);
}
-
+
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (child);
+ gtk_widget_queue_resize (GTK_WIDGET (table));
}
void
gtk_table_attach_defaults (GtkTable *table,
GtkWidget *widget,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach)
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach)
{
gtk_table_attach (table, widget,
left_attach, right_attach,
@@ -274,17 +539,18 @@ gtk_table_attach_defaults (GtkTable *table,
void
gtk_table_set_row_spacing (GtkTable *table,
- gint row,
- gint spacing)
+ guint row,
+ guint spacing)
{
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail ((row >= 0) && (row < (table->nrows - 1)));
-
+ /* g_return_if_fail ((row >= 0) && (row < (table->nrows - 1))); */
+ g_return_if_fail (row < table->nrows - 1);
+
if (table->rows[row].spacing != spacing)
{
table->rows[row].spacing = spacing;
-
+
if (GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
}
@@ -292,17 +558,18 @@ gtk_table_set_row_spacing (GtkTable *table,
void
gtk_table_set_col_spacing (GtkTable *table,
- gint column,
- gint spacing)
+ guint column,
+ guint spacing)
{
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail ((column >= 0) && (column < (table->ncols - 1)));
-
+ /* g_return_if_fail ((column >= 0) && (column < (table->ncols - 1))); */
+ g_return_if_fail (column < table->ncols - 1);
+
if (table->cols[column].spacing != spacing)
{
table->cols[column].spacing = spacing;
-
+
if (GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
}
@@ -310,65 +577,68 @@ gtk_table_set_col_spacing (GtkTable *table,
void
gtk_table_set_row_spacings (GtkTable *table,
- gint spacing)
+ guint spacing)
{
- gint row;
-
+ guint row;
+
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
-
+
table->row_spacing = spacing;
for (row = 0; row < table->nrows - 1; row++)
table->rows[row].spacing = spacing;
-
+
if (GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
}
void
gtk_table_set_col_spacings (GtkTable *table,
- gint spacing)
+ guint spacing)
{
- gint col;
-
+ guint col;
+
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
-
+
table->column_spacing = spacing;
for (col = 0; col < table->ncols - 1; col++)
table->cols[col].spacing = spacing;
-
+
if (GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
}
void
gtk_table_set_homogeneous (GtkTable *table,
- gint homogeneous)
+ gboolean homogeneous)
{
g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table));
- table->homogeneous = (homogeneous != 0);
-
- if (GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (GTK_WIDGET (table));
+ homogeneous = (homogeneous != 0);
+ if (homogeneous != table->homogeneous)
+ {
+ table->homogeneous = homogeneous;
+
+ if (GTK_WIDGET_VISIBLE (table))
+ gtk_widget_queue_resize (GTK_WIDGET (table));
+ }
}
-
static void
gtk_table_finalize (GtkObject *object)
{
GtkTable *table;
-
+
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_TABLE (object));
-
+
table = GTK_TABLE (object);
-
+
g_free (table->rows);
g_free (table->cols);
-
+
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -378,22 +648,22 @@ gtk_table_map (GtkWidget *widget)
GtkTable *table;
GtkTableChild *child;
GList *children;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TABLE (widget));
-
+
table = GTK_TABLE (widget);
GTK_WIDGET_SET_FLAGS (table, GTK_MAPPED);
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
+ !GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
}
}
@@ -403,22 +673,22 @@ gtk_table_unmap (GtkWidget *widget)
GtkTable *table;
GtkTableChild *child;
GList *children;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TABLE (widget));
-
+
table = GTK_TABLE (widget);
GTK_WIDGET_UNSET_FLAGS (table, GTK_MAPPED);
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget) &&
- GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
+ GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_unmap (child->widget);
}
}
@@ -430,20 +700,20 @@ gtk_table_draw (GtkWidget *widget,
GtkTableChild *child;
GList *children;
GdkRectangle child_area;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TABLE (widget));
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
{
table = GTK_TABLE (widget);
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (gtk_widget_intersect (child->widget, area, &child_area))
gtk_widget_draw (child->widget, &child_area);
}
@@ -451,35 +721,35 @@ gtk_table_draw (GtkWidget *widget,
}
static gint
-gtk_table_expose (GtkWidget *widget,
+gtk_table_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkTable *table;
GtkTableChild *child;
GList *children;
GdkEventExpose child_event;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TABLE (widget), FALSE);
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
{
table = GTK_TABLE (widget);
-
+
child_event = *event;
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
-
+
return FALSE;
}
@@ -489,32 +759,32 @@ gtk_table_size_request (GtkWidget *widget,
{
GtkTable *table;
gint row, col;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TABLE (widget));
g_return_if_fail (requisition != NULL);
-
+
table = GTK_TABLE (widget);
-
+
requisition->width = 0;
requisition->height = 0;
-
+
gtk_table_size_request_init (table);
gtk_table_size_request_pass1 (table);
gtk_table_size_request_pass2 (table);
gtk_table_size_request_pass3 (table);
gtk_table_size_request_pass2 (table);
-
+
for (col = 0; col < table->ncols; col++)
requisition->width += table->cols[col].requisition;
for (col = 0; col < table->ncols - 1; col++)
requisition->width += table->cols[col].spacing;
-
+
for (row = 0; row < table->nrows; row++)
requisition->height += table->rows[row].requisition;
for (row = 0; row < table->nrows - 1; row++)
requisition->height += table->rows[row].spacing;
-
+
requisition->width += GTK_CONTAINER (table)->border_width * 2;
requisition->height += GTK_CONTAINER (table)->border_width * 2;
}
@@ -524,14 +794,14 @@ gtk_table_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkTable *table;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TABLE (widget));
g_return_if_fail (allocation != NULL);
-
+
widget->allocation = *allocation;
table = GTK_TABLE (widget);
-
+
gtk_table_size_allocate_init (table);
gtk_table_size_allocate_pass1 (table);
gtk_table_size_allocate_pass2 (table);
@@ -544,7 +814,7 @@ gtk_table_add (GtkContainer *container,
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (widget != NULL);
-
+
gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
}
@@ -555,56 +825,56 @@ gtk_table_remove (GtkContainer *container,
GtkTable *table;
GtkTableChild *child;
GList *children;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (widget != NULL);
-
+
table = GTK_TABLE (container);
children = table->children;
-
+
while (children)
{
child = children->data;
children = children->next;
-
+
if (child->widget == widget)
- {
+ {
gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
gtk_widget_unparent (widget);
-
- table->children = g_list_remove (table->children, child);
- g_free (child);
-
- if (was_visible && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- break;
- }
+
+ table->children = g_list_remove (table->children, child);
+ g_free (child);
+
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ break;
+ }
}
}
static void
gtk_table_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkTable *table;
GtkTableChild *child;
GList *children;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (callback != NULL);
-
+
table = GTK_TABLE (container);
children = table->children;
-
+
while (children)
{
child = children->data;
children = children->next;
-
+
(* callback) (child->widget, callback_data);
}
}
@@ -615,18 +885,18 @@ gtk_table_size_request_init (GtkTable *table)
GtkTableChild *child;
GList *children;
gint row, col;
-
+
for (row = 0; row < table->nrows; row++)
table->rows[row].requisition = 0;
for (col = 0; col < table->ncols; col++)
table->cols[col].requisition = 0;
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
gtk_widget_size_request (child->widget, &child->widget->requisition);
}
@@ -639,31 +909,31 @@ gtk_table_size_request_pass1 (GtkTable *table)
GList *children;
gint width;
gint height;
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
- {
- /* Child spans a single column.
- */
- if (child->left_attach == (child->right_attach - 1))
- {
- width = child->widget->requisition.width + child->xpadding * 2;
- table->cols[child->left_attach].requisition = MAX (table->cols[child->left_attach].requisition, width);
- }
-
- /* Child spans a single row.
- */
- if (child->top_attach == (child->bottom_attach - 1))
- {
- height = child->widget->requisition.height + child->ypadding * 2;
- table->rows[child->top_attach].requisition = MAX (table->rows[child->top_attach].requisition, height);
- }
- }
+ {
+ /* Child spans a single column.
+ */
+ if (child->left_attach == (child->right_attach - 1))
+ {
+ width = child->widget->requisition.width + child->xpadding * 2;
+ table->cols[child->left_attach].requisition = MAX (table->cols[child->left_attach].requisition, width);
+ }
+
+ /* Child spans a single row.
+ */
+ if (child->top_attach == (child->bottom_attach - 1))
+ {
+ height = child->widget->requisition.height + child->ypadding * 2;
+ table->rows[child->top_attach].requisition = MAX (table->rows[child->top_attach].requisition, height);
+ }
+ }
}
}
@@ -673,21 +943,21 @@ gtk_table_size_request_pass2 (GtkTable *table)
gint max_width;
gint max_height;
gint row, col;
-
+
if (table->homogeneous)
{
max_width = 0;
max_height = 0;
-
+
for (col = 0; col < table->ncols; col++)
- max_width = MAX (max_width, table->cols[col].requisition);
+ max_width = MAX (max_width, table->cols[col].requisition);
for (row = 0; row < table->nrows; row++)
- max_height = MAX (max_height, table->rows[row].requisition);
-
+ max_height = MAX (max_height, table->rows[row].requisition);
+
for (col = 0; col < table->ncols; col++)
- table->cols[col].requisition = max_width;
+ table->cols[col].requisition = max_width;
for (row = 0; row < table->nrows; row++)
- table->rows[row].requisition = max_height;
+ table->rows[row].requisition = max_height;
}
}
@@ -699,79 +969,79 @@ gtk_table_size_request_pass3 (GtkTable *table)
gint width, height;
gint row, col;
gint extra;
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
- {
- /* Child spans multiple columns.
- */
- if (child->left_attach != (child->right_attach - 1))
- {
- /* Check and see if there is already enough space
- * for the child.
- */
- width = 0;
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- width += table->cols[col].requisition;
- if ((col + 1) < child->right_attach)
- width += table->cols[col].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space evenly
- * amongst the columns it spans.
- */
- if (width < child->widget->requisition.width + child->xpadding * 2)
- {
- width = child->widget->requisition.width + child->xpadding * 2 - width;
-
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- extra = width / (child->right_attach - col);
+ {
+ /* Child spans multiple columns.
+ */
+ if (child->left_attach != (child->right_attach - 1))
+ {
+ /* Check and see if there is already enough space
+ * for the child.
+ */
+ width = 0;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ {
+ width += table->cols[col].requisition;
+ if ((col + 1) < child->right_attach)
+ width += table->cols[col].spacing;
+ }
+
+ /* If we need to request more space for this child to fill
+ * its requisition, then divide up the needed space evenly
+ * amongst the columns it spans.
+ */
+ if (width < child->widget->requisition.width + child->xpadding * 2)
+ {
+ width = child->widget->requisition.width + child->xpadding * 2 - width;
+
+ for (col = child->left_attach; col < child->right_attach; col++)
+ {
+ extra = width / (child->right_attach - col);
table->cols[col].requisition += extra;
- width -= extra;
- }
- }
- }
-
- /* Child spans multiple rows.
- */
- if (child->top_attach != (child->bottom_attach - 1))
- {
- /* Check and see if there is already enough space
- * for the child.
- */
- height = 0;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- height += table->rows[row].requisition;
- if ((row + 1) < child->bottom_attach)
- height += table->rows[row].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space evenly
- * amongst the columns it spans.
- */
- if (height < child->widget->requisition.height + child->ypadding * 2)
- {
- height = child->widget->requisition.height + child->ypadding * 2 - height;
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- extra = height / (child->bottom_attach - row);
+ width -= extra;
+ }
+ }
+ }
+
+ /* Child spans multiple rows.
+ */
+ if (child->top_attach != (child->bottom_attach - 1))
+ {
+ /* Check and see if there is already enough space
+ * for the child.
+ */
+ height = 0;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ height += table->rows[row].requisition;
+ if ((row + 1) < child->bottom_attach)
+ height += table->rows[row].spacing;
+ }
+
+ /* If we need to request more space for this child to fill
+ * its requisition, then divide up the needed space evenly
+ * amongst the columns it spans.
+ */
+ if (height < child->widget->requisition.height + child->ypadding * 2)
+ {
+ height = child->widget->requisition.height + child->ypadding * 2 - height;
+
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ extra = height / (child->bottom_attach - row);
table->rows[row].requisition += extra;
- height -= extra;
- }
- }
- }
- }
+ height -= extra;
+ }
+ }
+ }
+ }
}
}
@@ -783,7 +1053,7 @@ gtk_table_size_allocate_init (GtkTable *table)
gint row, col;
gint has_expand;
gint has_shrink;
-
+
/* Initialize the rows and cols.
* By default, rows and cols do not expand and do shrink.
* Those values are modified by the children that occupy
@@ -805,7 +1075,7 @@ gtk_table_size_allocate_init (GtkTable *table)
table->rows[row].expand = FALSE;
table->rows[row].shrink = TRUE;
}
-
+
/* Loop over all the children and adjust the row and col values
* based on whether the children want to be allowed to expand
* or shrink. This loop handles children that occupy a single
@@ -816,29 +1086,29 @@ gtk_table_size_allocate_init (GtkTable *table)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
- {
- if (child->left_attach == (child->right_attach - 1))
- {
- if (child->xexpand)
- table->cols[child->left_attach].expand = TRUE;
-
- if (!child->xshrink)
- table->cols[child->left_attach].shrink = FALSE;
- }
-
- if (child->top_attach == (child->bottom_attach - 1))
- {
- if (child->yexpand)
- table->rows[child->top_attach].expand = TRUE;
-
- if (!child->yshrink)
- table->rows[child->top_attach].shrink = FALSE;
- }
- }
+ {
+ if (child->left_attach == (child->right_attach - 1))
+ {
+ if (child->xexpand)
+ table->cols[child->left_attach].expand = TRUE;
+
+ if (!child->xshrink)
+ table->cols[child->left_attach].shrink = FALSE;
+ }
+
+ if (child->top_attach == (child->bottom_attach - 1))
+ {
+ if (child->yexpand)
+ table->rows[child->top_attach].expand = TRUE;
+
+ if (!child->yshrink)
+ table->rows[child->top_attach].shrink = FALSE;
+ }
+ }
}
-
+
/* Loop over all the children again and this time handle children
* which span multiple rows or columns.
*/
@@ -847,97 +1117,97 @@ gtk_table_size_allocate_init (GtkTable *table)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
- {
- if (child->left_attach != (child->right_attach - 1))
- {
- if (child->xexpand)
- {
- has_expand = FALSE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (table->cols[col].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (col = child->left_attach; col < child->right_attach; col++)
- table->cols[col].need_expand = TRUE;
- }
-
- if (!child->xshrink)
- {
- has_shrink = TRUE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (!table->cols[col].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (col = child->left_attach; col < child->right_attach; col++)
- table->cols[col].need_shrink = FALSE;
- }
- }
-
- if (child->top_attach != (child->bottom_attach - 1))
- {
- if (child->yexpand)
- {
- has_expand = FALSE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (table->rows[row].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- table->rows[row].need_expand = TRUE;
- }
-
- if (!child->yshrink)
- {
- has_shrink = TRUE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (!table->rows[row].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- table->rows[row].need_shrink = FALSE;
- }
- }
- }
+ {
+ if (child->left_attach != (child->right_attach - 1))
+ {
+ if (child->xexpand)
+ {
+ has_expand = FALSE;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (table->cols[col].expand)
+ {
+ has_expand = TRUE;
+ break;
+ }
+
+ if (!has_expand)
+ for (col = child->left_attach; col < child->right_attach; col++)
+ table->cols[col].need_expand = TRUE;
+ }
+
+ if (!child->xshrink)
+ {
+ has_shrink = TRUE;
+ for (col = child->left_attach; col < child->right_attach; col++)
+ if (!table->cols[col].shrink)
+ {
+ has_shrink = FALSE;
+ break;
+ }
+
+ if (has_shrink)
+ for (col = child->left_attach; col < child->right_attach; col++)
+ table->cols[col].need_shrink = FALSE;
+ }
+ }
+
+ if (child->top_attach != (child->bottom_attach - 1))
+ {
+ if (child->yexpand)
+ {
+ has_expand = FALSE;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ if (table->rows[row].expand)
+ {
+ has_expand = TRUE;
+ break;
+ }
+
+ if (!has_expand)
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ table->rows[row].need_expand = TRUE;
+ }
+
+ if (!child->yshrink)
+ {
+ has_shrink = TRUE;
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ if (!table->rows[row].shrink)
+ {
+ has_shrink = FALSE;
+ break;
+ }
+
+ if (has_shrink)
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ table->rows[row].need_shrink = FALSE;
+ }
+ }
+ }
}
-
+
/* Loop over the columns and set the expand and shrink values
* if the column can be expanded or shrunk.
*/
for (col = 0; col < table->ncols; col++)
{
if (table->cols[col].need_expand)
- table->cols[col].expand = TRUE;
+ table->cols[col].expand = TRUE;
if (!table->cols[col].need_shrink)
- table->cols[col].shrink = FALSE;
+ table->cols[col].shrink = FALSE;
}
-
+
/* Loop over the rows and set the expand and shrink values
* if the row can be expanded or shrunk.
*/
for (row = 0; row < table->nrows; row++)
{
if (table->rows[row].need_expand)
- table->rows[row].expand = TRUE;
+ table->rows[row].expand = TRUE;
if (!table->rows[row].need_shrink)
- table->rows[row].shrink = FALSE;
+ table->rows[row].shrink = FALSE;
}
}
@@ -951,168 +1221,168 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
gint nexpand;
gint nshrink;
gint extra;
-
+
/* If we were allocated more space than we requested
* then we have to expand any expandable rows and columns
* to fill in the extra space.
*/
-
+
real_width = GTK_WIDGET (table)->allocation.width - GTK_CONTAINER (table)->border_width * 2;
real_height = GTK_WIDGET (table)->allocation.height - GTK_CONTAINER (table)->border_width * 2;
-
+
if (table->homogeneous)
{
nexpand = 0;
for (col = 0; col < table->ncols; col++)
- if (table->cols[col].expand)
- {
- nexpand += 1;
- break;
- }
-
+ if (table->cols[col].expand)
+ {
+ nexpand += 1;
+ break;
+ }
+
if (nexpand > 0)
- {
- width = real_width;
-
- for (col = 0; col < table->ncols - 1; col++)
- width -= table->cols[col].spacing;
-
- for (col = 0; col < table->ncols; col++)
- {
- extra = width / (table->ncols - col);
+ {
+ width = real_width;
+
+ for (col = 0; col < table->ncols - 1; col++)
+ width -= table->cols[col].spacing;
+
+ for (col = 0; col < table->ncols; col++)
+ {
+ extra = width / (table->ncols - col);
table->cols[col].allocation = MAX (1, extra);
- width -= extra;
- }
- }
+ width -= extra;
+ }
+ }
}
else
{
width = 0;
nexpand = 0;
nshrink = 0;
-
+
for (col = 0; col < table->ncols; col++)
- {
- width += table->cols[col].requisition;
- if (table->cols[col].expand)
- nexpand += 1;
- if (table->cols[col].shrink)
- nshrink += 1;
- }
+ {
+ width += table->cols[col].requisition;
+ if (table->cols[col].expand)
+ nexpand += 1;
+ if (table->cols[col].shrink)
+ nshrink += 1;
+ }
for (col = 0; col < table->ncols - 1; col++)
- width += table->cols[col].spacing;
-
+ width += table->cols[col].spacing;
+
/* Check to see if we were allocated more width than we requested.
*/
if ((width < real_width) && (nexpand >= 1))
- {
- width = real_width - width;
-
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].expand)
- {
- extra = width / nexpand;
+ {
+ width = real_width - width;
+
+ for (col = 0; col < table->ncols; col++)
+ if (table->cols[col].expand)
+ {
+ extra = width / nexpand;
table->cols[col].allocation += extra;
-
- width -= extra;
- nexpand -= 1;
- }
- }
-
+
+ width -= extra;
+ nexpand -= 1;
+ }
+ }
+
/* Check to see if we were allocated less width than we requested.
*/
if ((width > real_width) && (nshrink >= 1))
- {
- width = width - real_width;
-
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].shrink)
- {
- extra = width / nshrink;
+ {
+ width = width - real_width;
+
+ for (col = 0; col < table->ncols; col++)
+ if (table->cols[col].shrink)
+ {
+ extra = width / nshrink;
table->cols[col].allocation = MAX (1, table->cols[col].allocation - extra);
-
- width -= extra;
- nshrink -= 1;
- }
- }
+
+ width -= extra;
+ nshrink -= 1;
+ }
+ }
}
-
+
if (table->homogeneous)
{
nexpand = 0;
for (row = 0; row < table->nrows; row++)
- if (table->rows[row].expand)
- {
- nexpand += 1;
- break;
- }
-
+ if (table->rows[row].expand)
+ {
+ nexpand += 1;
+ break;
+ }
+
if (nexpand > 0)
- {
- height = real_height;
-
- for (row = 0; row < table->nrows - 1; row++)
- height -= table->rows[row].spacing;
-
-
- for (row = 0; row < table->nrows; row++)
- {
- extra = height / (table->nrows - row);
+ {
+ height = real_height;
+
+ for (row = 0; row < table->nrows - 1; row++)
+ height -= table->rows[row].spacing;
+
+
+ for (row = 0; row < table->nrows; row++)
+ {
+ extra = height / (table->nrows - row);
table->rows[row].allocation = MAX (1, extra);
- height -= extra;
- }
- }
+ height -= extra;
+ }
+ }
}
else
{
height = 0;
nexpand = 0;
nshrink = 0;
-
+
for (row = 0; row < table->nrows; row++)
- {
- height += table->rows[row].requisition;
- if (table->rows[row].expand)
- nexpand += 1;
- if (table->rows[row].shrink)
- nshrink += 1;
- }
+ {
+ height += table->rows[row].requisition;
+ if (table->rows[row].expand)
+ nexpand += 1;
+ if (table->rows[row].shrink)
+ nshrink += 1;
+ }
for (row = 0; row < table->nrows - 1; row++)
- height += table->rows[row].spacing;
-
+ height += table->rows[row].spacing;
+
/* Check to see if we were allocated more height than we requested.
*/
if ((height < real_height) && (nexpand >= 1))
- {
- height = real_height - height;
-
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].expand)
- {
- extra = height / nexpand;
+ {
+ height = real_height - height;
+
+ for (row = 0; row < table->nrows; row++)
+ if (table->rows[row].expand)
+ {
+ extra = height / nexpand;
table->rows[row].allocation += extra;
-
- height -= extra;
- nexpand -= 1;
- }
- }
-
+
+ height -= extra;
+ nexpand -= 1;
+ }
+ }
+
/* Check to see if we were allocated less height than we requested.
*/
if ((height > real_height) && (nshrink >= 1))
- {
- height = height - real_height;
-
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].shrink)
- {
- extra = height / nshrink;
+ {
+ height = height - real_height;
+
+ for (row = 0; row < table->nrows; row++)
+ if (table->rows[row].shrink)
+ {
+ extra = height / nshrink;
table->rows[row].allocation = MAX (1, table->rows[row].allocation - extra);
-
- height -= extra;
- nshrink -= 1;
- }
- }
+
+ height -= extra;
+ nshrink -= 1;
+ }
+ }
}
}
@@ -1126,70 +1396,69 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
gint x, y;
gint row, col;
GtkAllocation allocation;
-
+
children = table->children;
while (children)
{
child = children->data;
children = children->next;
-
+
if (GTK_WIDGET_VISIBLE (child->widget))
- {
- x = GTK_WIDGET (table)->allocation.x + GTK_CONTAINER (table)->border_width;
- y = GTK_WIDGET (table)->allocation.y + GTK_CONTAINER (table)->border_width;
- max_width = 0;
- max_height = 0;
-
- for (col = 0; col < child->left_attach; col++)
- {
- x += table->cols[col].allocation;
- x += table->cols[col].spacing;
- }
-
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- max_width += table->cols[col].allocation;
- if ((col + 1) < child->right_attach)
- max_width += table->cols[col].spacing;
- }
-
- for (row = 0; row < child->top_attach; row++)
- {
- y += table->rows[row].allocation;
- y += table->rows[row].spacing;
- }
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- max_height += table->rows[row].allocation;
- if ((row + 1) < child->bottom_attach)
- max_height += table->rows[row].spacing;
- }
-
- if (child->xfill)
- {
- allocation.width = MAX (1, max_width - child->xpadding * 2);
- allocation.x = x + (max_width - allocation.width) / 2;
- }
- else
- {
- allocation.width = child->widget->requisition.width;
- allocation.x = x + (max_width - allocation.width) / 2;
- }
-
- if (child->yfill)
- {
- allocation.height = MAX (1, max_height - child->ypadding * 2);
- allocation.y = y + (max_height - allocation.height) / 2;
- }
- else
- {
- allocation.height = child->widget->requisition.height;
- allocation.y = y + (max_height - allocation.height) / 2;
- }
-
+ {
+ x = GTK_WIDGET (table)->allocation.x + GTK_CONTAINER (table)->border_width;
+ y = GTK_WIDGET (table)->allocation.y + GTK_CONTAINER (table)->border_width;
+ max_width = 0;
+ max_height = 0;
+
+ for (col = 0; col < child->left_attach; col++)
+ {
+ x += table->cols[col].allocation;
+ x += table->cols[col].spacing;
+ }
+
+ for (col = child->left_attach; col < child->right_attach; col++)
+ {
+ max_width += table->cols[col].allocation;
+ if ((col + 1) < child->right_attach)
+ max_width += table->cols[col].spacing;
+ }
+
+ for (row = 0; row < child->top_attach; row++)
+ {
+ y += table->rows[row].allocation;
+ y += table->rows[row].spacing;
+ }
+
+ for (row = child->top_attach; row < child->bottom_attach; row++)
+ {
+ max_height += table->rows[row].allocation;
+ if ((row + 1) < child->bottom_attach)
+ max_height += table->rows[row].spacing;
+ }
+
+ if (child->xfill)
+ {
+ allocation.width = MAX (1, max_width - child->xpadding * 2);
+ allocation.x = x + (max_width - allocation.width) / 2;
+ }
+ else
+ {
+ allocation.width = child->widget->requisition.width;
+ allocation.x = x + (max_width - allocation.width) / 2;
+ }
+
+ if (child->yfill)
+ {
+ allocation.height = MAX (1, max_height - child->ypadding * 2);
+ allocation.y = y + (max_height - allocation.height) / 2;
+ }
+ else
+ {
+ allocation.height = child->widget->requisition.height;
+ allocation.y = y + (max_height - allocation.height) / 2;
+ }
+
gtk_widget_size_allocate (child->widget, &allocation);
- }
+ }
}
}
-
diff --git a/gtk/gtktable.h b/gtk/gtktable.h
index 280e94347..2c3d90591 100644
--- a/gtk/gtktable.h
+++ b/gtk/gtktable.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,23 +26,26 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_TABLE(obj) GTK_CHECK_CAST (obj, gtk_table_get_type (), GtkTable)
-#define GTK_TABLE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_table_get_type (), GtkTableClass)
-#define GTK_IS_TABLE(obj) GTK_CHECK_TYPE (obj, gtk_table_get_type ())
+#define GTK_TYPE_TABLE (gtk_table_get_type ())
+#define GTK_TABLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TABLE, GtkTable))
+#define GTK_TABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TABLE, GtkTableClass))
+#define GTK_IS_TABLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TABLE))
+#define GTK_IS_TABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TABLE))
-typedef struct _GtkTable GtkTable;
-typedef struct _GtkTableClass GtkTableClass;
-typedef struct _GtkTableChild GtkTableChild;
-typedef struct _GtkTableRowCol GtkTableRowCol;
+typedef struct _GtkTable GtkTable;
+typedef struct _GtkTableClass GtkTableClass;
+typedef struct _GtkTableChild GtkTableChild;
+typedef struct _GtkTableRowCol GtkTableRowCol;
struct _GtkTable
{
GtkContainer container;
-
+
GList *children;
GtkTableRowCol *rows;
GtkTableRowCol *cols;
@@ -87,39 +90,41 @@ struct _GtkTableRowCol
};
-guint gtk_table_get_type (void);
-GtkWidget* gtk_table_new (gint rows,
- gint columns,
- gint homogeneous);
-
-void gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach,
- gint xoptions,
- gint yoptions,
- gint xpadding,
- gint ypadding);
-void gtk_table_attach_defaults (GtkTable *table,
- GtkWidget *widget,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach);
-void gtk_table_set_row_spacing (GtkTable *table,
- gint row,
- gint spacing);
-void gtk_table_set_col_spacing (GtkTable *table,
- gint column,
- gint spacing);
-void gtk_table_set_row_spacings (GtkTable *table,
- gint spacing);
-void gtk_table_set_col_spacings (GtkTable *table,
- gint spacing);
-void gtk_table_set_homogeneous (GtkTable *table,
- gint homogeneous);
+GtkType gtk_table_get_type (void);
+GtkWidget* gtk_table_new (guint rows,
+ guint columns,
+ gboolean homogeneous);
+void gtk_table_resize (GtkTable *table,
+ guint rows,
+ guint columns);
+void gtk_table_attach (GtkTable *table,
+ GtkWidget *child,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach,
+ GtkAttachOptions xoptions,
+ GtkAttachOptions yoptions,
+ guint xpadding,
+ guint ypadding);
+void gtk_table_attach_defaults (GtkTable *table,
+ GtkWidget *widget,
+ guint left_attach,
+ guint right_attach,
+ guint top_attach,
+ guint bottom_attach);
+void gtk_table_set_row_spacing (GtkTable *table,
+ guint row,
+ guint spacing);
+void gtk_table_set_col_spacing (GtkTable *table,
+ guint column,
+ guint spacing);
+void gtk_table_set_row_spacings (GtkTable *table,
+ guint spacing);
+void gtk_table_set_col_spacings (GtkTable *table,
+ guint spacing);
+void gtk_table_set_homogeneous (GtkTable *table,
+ gboolean homogeneous);
#ifdef __cplusplus
diff --git a/gtk/gtktipsquery.c b/gtk/gtktipsquery.c
index 5a6ddaa55..6a1927816 100644
--- a/gtk/gtktipsquery.c
+++ b/gtk/gtktipsquery.c
@@ -238,7 +238,6 @@ gtk_tips_query_set_arg (GtkTipsQuery *tips_query,
gtk_tips_query_set_labels (tips_query, tips_query->label_inactive, GTK_VALUE_STRING (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index fc5e1f8e9..23ff9ed07 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -45,10 +45,10 @@ static void gtk_toggle_button_leave (GtkButton *button);
static guint toggle_button_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_toggle_button_get_type (void)
{
- static guint toggle_button_type = 0;
+ static GtkType toggle_button_type = 0;
if (!toggle_button_type)
{
diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h
index 424047eec..56dd1c363 100644
--- a/gtk/gtktogglebutton.h
+++ b/gtk/gtktogglebutton.h
@@ -29,9 +29,11 @@ extern "C" {
#endif /* __cplusplus */
-#define GTK_TOGGLE_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_toggle_button_get_type (), GtkToggleButton)
-#define GTK_TOGGLE_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_toggle_button_get_type (), GtkToggleButtonClass)
-#define GTK_IS_TOGGLE_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_toggle_button_get_type ())
+#define GTK_TYPE_TOGGLE_BUTTON (gtk_toggle_button_get_type ())
+#define GTK_TOGGLE_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButton))
+#define GTK_TOGGLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButtonClass))
+#define GTK_IS_TOGGLE_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOGGLE_BUTTON))
+#define GTK_IS_TOGGLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_BUTTON))
typedef struct _GtkToggleButton GtkToggleButton;
@@ -53,7 +55,7 @@ struct _GtkToggleButtonClass
};
-guint gtk_toggle_button_get_type (void);
+GtkType gtk_toggle_button_get_type (void);
GtkWidget* gtk_toggle_button_new (void);
GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);
void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index f91a826bf..b60c63211 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -105,7 +105,7 @@ gtk_tooltips_new (void)
return gtk_type_new (gtk_tooltips_get_type ());
}
-void
+static void
gtk_tooltips_free_string (gpointer data, gpointer user_data)
{
if (data)
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
index ad14599b5..bbb1f9cae 100644
--- a/gtk/gtktree.c
+++ b/gtk/gtktree.c
@@ -69,14 +69,15 @@ static void gtk_tree_marshal_signal (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
+static GtkType gtk_tree_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
static guint tree_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_tree_get_type (void)
{
- static guint tree_type = 0;
+ static GtkType tree_type = 0;
if (!tree_type)
{
@@ -153,12 +154,19 @@ gtk_tree_class_init (GtkTreeClass *class)
container_class->remove =
(void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item;
container_class->foreach = gtk_tree_foreach;
+ container_class->child_type = gtk_tree_child_type;
class->selection_changed = NULL;
class->select_child = gtk_real_tree_select_child;
class->unselect_child = gtk_real_tree_unselect_child;
}
+static GtkType
+gtk_tree_child_type (GtkContainer *container)
+{
+ return GTK_TYPE_TREE_ITEM;
+}
+
static void
gtk_tree_init (GtkTree *tree)
{
diff --git a/gtk/gtktree.h b/gtk/gtktree.h
index c4671109e..63c55c78b 100644
--- a/gtk/gtktree.h
+++ b/gtk/gtktree.h
@@ -28,12 +28,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_TREE(obj) GTK_CHECK_CAST (obj, gtk_tree_get_type (), GtkTree)
-#define GTK_TREE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tree_get_type (), GtkTreeClass)
-#define GTK_IS_TREE(obj) GTK_CHECK_TYPE (obj, gtk_tree_get_type ())
+#define GTK_TYPE_TREE (gtk_tree_get_type ())
+#define GTK_TREE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE, GtkTree))
+#define GTK_TREE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE, GtkTreeClass))
+#define GTK_IS_TREE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE))
+#define GTK_IS_TREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE))
#define GTK_IS_ROOT_TREE(obj) ((GtkObject*) GTK_TREE(obj)->root_tree == (GtkObject*)obj)
#define GTK_TREE_ROOT_TREE(obj) (GTK_TREE(obj)->root_tree ? GTK_TREE(obj)->root_tree : GTK_TREE(obj))
@@ -51,7 +54,7 @@ typedef struct _GtkTreeClass GtkTreeClass;
struct _GtkTree
{
GtkContainer container;
-
+
GList *children;
GtkTree* root_tree; /* owner of selection list */
@@ -68,7 +71,7 @@ struct _GtkTree
struct _GtkTreeClass
{
GtkContainerClass parent_class;
-
+
void (* selection_changed) (GtkTree *tree);
void (* select_child) (GtkTree *tree,
GtkWidget *child);
@@ -77,7 +80,7 @@ struct _GtkTreeClass
};
-guint gtk_tree_get_type (void);
+GtkType gtk_tree_get_type (void);
GtkWidget* gtk_tree_new (void);
void gtk_tree_append (GtkTree *tree,
GtkWidget *tree_item);
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index d4bffcd86..ba6fd074d 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -92,10 +92,10 @@ static GtkItemClass *parent_class = NULL;
static GtkContainerClass *container_class = NULL;
static guint tree_item_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_tree_item_get_type (void)
{
- static guint tree_item_type = 0;
+ static GtkType tree_item_type = 0;
if (!tree_item_type)
{
diff --git a/gtk/gtktreeitem.h b/gtk/gtktreeitem.h
index 05c6ebf78..8a2f2d681 100644
--- a/gtk/gtktreeitem.h
+++ b/gtk/gtktreeitem.h
@@ -26,14 +26,18 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_TREE_ITEM(obj) GTK_CHECK_CAST (obj, gtk_tree_item_get_type (), GtkTreeItem)
-#define GTK_TREE_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tree_item_get_type (), GtkTreeItemClass)
-#define GTK_IS_TREE_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_tree_item_get_type ())
+#define GTK_TYPE_TREE_ITEM (gtk_tree_item_get_type ())
+#define GTK_TREE_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE_ITEM, GtkTreeItem))
+#define GTK_TREE_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_ITEM, GtkTreeItemClass))
+#define GTK_IS_TREE_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE_ITEM))
+#define GTK_IS_TREE_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_ITEM))
+
+#define GTK_TREE_ITEM_SUBTREE(obj) (GTK_TREE_ITEM(obj)->subtree)
-#define GTK_TREE_ITEM_SUBTREE(obj) GTK_TREE_ITEM(obj)->subtree
typedef struct _GtkTreeItem GtkTreeItem;
typedef struct _GtkTreeItemClass GtkTreeItemClass;
@@ -60,7 +64,7 @@ struct _GtkTreeItemClass
};
-guint gtk_tree_item_get_type (void);
+GtkType gtk_tree_item_get_type (void);
GtkWidget* gtk_tree_item_new (void);
GtkWidget* gtk_tree_item_new_with_label (gchar *label);
void gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
diff --git a/gtk/gtktypebuiltins_evals.c b/gtk/gtktypebuiltins_evals.c
index ce0f99df4..11c4e722e 100644
--- a/gtk/gtktypebuiltins_evals.c
+++ b/gtk/gtktypebuiltins_evals.c
@@ -249,6 +249,7 @@ static GtkEnumValue _gtk_arg_flags_values[] = {
{ GTK_ARG_READABLE, "GTK_ARG_READABLE", "readable" },
{ GTK_ARG_WRITABLE, "GTK_ARG_WRITABLE", "writable" },
{ GTK_ARG_CONSTRUCT, "GTK_ARG_CONSTRUCT", "construct" },
+ { GTK_ARG_CHILD_ARG, "GTK_ARG_CHILD_ARG", "child-arg" },
{ GTK_ARG_MASK, "GTK_ARG_MASK", "mask" },
{ GTK_ARG_READWRITE, "GTK_ARG_READWRITE", "readwrite" },
{ 0, NULL, NULL }
@@ -268,6 +269,14 @@ static GtkEnumValue _gtk_side_type_values[] = {
};
static GtkEnumValue _gtk_anchor_type_values[] = {
{ GTK_ANCHOR_CENTER, "GTK_ANCHOR_CENTER", "center" },
+ { GTK_ANCHOR_NORTH, "GTK_ANCHOR_NORTH", "north" },
+ { GTK_ANCHOR_NORTH_WEST, "GTK_ANCHOR_NORTH_WEST", "north-west" },
+ { GTK_ANCHOR_NORTH_EAST, "GTK_ANCHOR_NORTH_EAST", "north-east" },
+ { GTK_ANCHOR_SOUTH, "GTK_ANCHOR_SOUTH", "south" },
+ { GTK_ANCHOR_SOUTH_WEST, "GTK_ANCHOR_SOUTH_WEST", "south-west" },
+ { GTK_ANCHOR_SOUTH_EAST, "GTK_ANCHOR_SOUTH_EAST", "south-east" },
+ { GTK_ANCHOR_WEST, "GTK_ANCHOR_WEST", "west" },
+ { GTK_ANCHOR_EAST, "GTK_ANCHOR_EAST", "east" },
{ GTK_ANCHOR_N, "GTK_ANCHOR_N", "n" },
{ GTK_ANCHOR_NW, "GTK_ANCHOR_NW", "nw" },
{ GTK_ANCHOR_NE, "GTK_ANCHOR_NE", "ne" },
diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c
index 3a5809b30..30a0d0d65 100644
--- a/gtk/gtktypeutils.c
+++ b/gtk/gtktypeutils.c
@@ -524,7 +524,7 @@ gtk_arg_copy (GtkArg *src_arg,
dest_arg->d = src_arg->d;
if (src_arg->type == GTK_TYPE_STRING)
- dest_arg->d.pointer_data = g_strdup (src_arg->d.pointer_data);
+ dest_arg->d.string_data = g_strdup (src_arg->d.string_data);
return dest_arg;
}
diff --git a/gtk/gtktypeutils.h b/gtk/gtktypeutils.h
index 8f8701b08..325409442 100644
--- a/gtk/gtktypeutils.h
+++ b/gtk/gtktypeutils.h
@@ -105,7 +105,9 @@ struct _GtkArg
gulong ulong_data;
gfloat float_data;
gdouble double_data;
+ gchar *string_data;
gpointer pointer_data;
+ GtkObject *object_data;
struct {
GtkCallbackMarshal marshal;
gpointer data;
@@ -138,7 +140,7 @@ struct _GtkArg
#define GTK_VALUE_ULONG(a) ((a).d.ulong_data)
#define GTK_VALUE_FLOAT(a) ((a).d.float_data)
#define GTK_VALUE_DOUBLE(a) ((a).d.double_data)
-#define GTK_VALUE_STRING(a) ((a).d.pointer_data)
+#define GTK_VALUE_STRING(a) ((a).d.string_data)
#define GTK_VALUE_ENUM(a) ((a).d.int_data)
#define GTK_VALUE_FLAGS(a) ((a).d.int_data)
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 675d23a64..0737c2067 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -831,7 +831,6 @@ gtk_widget_set_arg (GtkWidget *widget,
gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 16fb06943..6a5c89dfc 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -261,7 +261,6 @@ gtk_window_set_arg (GtkWindow *window,
gtk_window_position (window, GTK_VALUE_ENUM (*arg));
break;
default:
- arg->type = GTK_TYPE_INVALID;
break;
}
}
diff --git a/gtk/makeenums.pl b/gtk/makeenums.pl
index d070d3da6..986e934e9 100755
--- a/gtk/makeenums.pl
+++ b/gtk/makeenums.pl
@@ -108,7 +108,7 @@ if (@ARGV) {
}
if ($gen_defs) {
- print ";; generated by makeenums.awk ; -*- scheme -*-\n\n";
+ print ";; generated by makeenums.pl ; -*- scheme -*-\n\n";
} else {
print "/* Generated by makeenums.pl */\n\n";
}