2008-07-01 22:57:50 +00:00
|
|
|
|
/* GTK - The GIMP Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2010-09-14 01:33:06 +00:00
|
|
|
|
|
2011-06-05 23:31:59 +00:00
|
|
|
|
#include "gtkcontainerprivate.h"
|
2010-09-14 01:33:06 +00:00
|
|
|
|
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkadjustment.h"
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
#include "gtkbuildable.h"
|
2008-12-08 03:57:16 +00:00
|
|
|
|
#include "gtkbuilderprivate.h"
|
2018-02-08 23:42:38 +00:00
|
|
|
|
#include "gtkintl.h"
|
GTK_RESIZE_NEEDED is a private flag now.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
(gtk_container_register_toplevel): new function.
(gtk_container_unregister_toplevel): new function.
* gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.
* gtk/gtkmenu.c: call gtk_container_register_toplevel in
gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
hack. new default handler gtk_menu_destroy for calling
gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.
* gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.
* gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
(object).
* gtk/gtkprivate.h: new file that will not be automatically included.
it holds the private flags for GtkWidget along with it's SET/UNSET
and examination macros.
* gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
removed the gtk_widget_set_parent(, NULL) hack for toplevels.
upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.
* gtk/gtkwidget.h: split up the widget flags into a public and a private
portion. added an extra field private_flags to GtkWidget without making
it bigger by using an alignment gap of 16 bit. macro cleanups.
* gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
for calling gtk_container_unregister_toplevel. removed the
gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.
* gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
removal that cut off the handler list -> living_objects == 0
with testgtk. made some warnings more descriptive.
new function gtk_signal_connect_object_while_alive, which
will automatically destroy the connection once one of the objects
is destroyed. didn't include this before removal of the above
mentioned bug.
* reflected refcounting revolution in ChangeLog
1998-02-02 04:54:25 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2010-09-14 01:33:06 +00:00
|
|
|
|
#include "gtksizerequest.h"
|
2018-02-08 23:42:38 +00:00
|
|
|
|
#include "gtkstylecontextprivate.h"
|
|
|
|
|
#include "gtktypebuiltins.h"
|
2010-10-19 17:14:46 +00:00
|
|
|
|
#include "gtkwidgetprivate.h"
|
2019-04-05 04:02:53 +00:00
|
|
|
|
//#include "gtkwindowprivate.h"
|
2018-02-08 23:42:38 +00:00
|
|
|
|
|
2014-03-07 20:45:18 +00:00
|
|
|
|
#include "a11y/gtkcontaineraccessibleprivate.h"
|
2010-10-11 02:21:36 +00:00
|
|
|
|
|
2018-02-08 23:42:38 +00:00
|
|
|
|
#include <gobject/gobjectnotifyqueue.c>
|
|
|
|
|
#include <gobject/gvaluecollector.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2016-07-27 08:40:29 +00:00
|
|
|
|
|
2010-10-11 02:21:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkcontainer
|
|
|
|
|
* @Short_description: Base class for widgets which contain other widgets
|
|
|
|
|
* @Title: GtkContainer
|
|
|
|
|
*
|
2019-04-05 04:43:36 +00:00
|
|
|
|
* A GTK user interface is constructed by nesting widgets inside widgets.
|
2010-10-11 02:21:36 +00:00
|
|
|
|
* Container widgets are the inner nodes in the resulting tree of widgets:
|
|
|
|
|
* they contain other widgets. So, for example, you might have a #GtkWindow
|
|
|
|
|
* containing a #GtkFrame containing a #GtkLabel. If you wanted an image instead
|
|
|
|
|
* of a textual label inside the frame, you might replace the #GtkLabel widget
|
|
|
|
|
* with a #GtkImage widget.
|
|
|
|
|
*
|
2019-04-05 04:43:36 +00:00
|
|
|
|
* There are two major kinds of container widgets in GTK. Both are subclasses
|
2010-10-11 02:21:36 +00:00
|
|
|
|
* of the abstract GtkContainer base class.
|
|
|
|
|
*
|
|
|
|
|
* The first type of container widget has a single child widget and derives
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* from #GtkBin. These containers are decorators, which
|
2010-10-11 02:21:36 +00:00
|
|
|
|
* add some kind of functionality to the child. For example, a #GtkButton makes
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* its child into a clickable button; a #GtkFrame draws a frame around its child
|
|
|
|
|
* and a #GtkWindow places its child widget inside a top-level window.
|
2010-10-11 02:21:36 +00:00
|
|
|
|
*
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* The second type of container can have more than one child; its purpose is to
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* manage layout. This means that these containers assign
|
2016-10-03 17:52:23 +00:00
|
|
|
|
* sizes and positions to their children. For example, a horizontal #GtkBox arranges its
|
2011-09-29 11:36:39 +00:00
|
|
|
|
* children in a horizontal row, and a #GtkGrid arranges the widgets it contains
|
2010-10-11 02:21:36 +00:00
|
|
|
|
* in a two-dimensional grid.
|
|
|
|
|
*
|
2015-11-11 10:37:28 +00:00
|
|
|
|
* For implementations of #GtkContainer the virtual method #GtkContainerClass.forall()
|
|
|
|
|
* is always required, since it's used for drawing and other internal operations
|
|
|
|
|
* on the children.
|
|
|
|
|
* If the #GtkContainer implementation expect to have non internal children
|
|
|
|
|
* it's needed to implement both #GtkContainerClass.add() and #GtkContainerClass.remove().
|
|
|
|
|
* If the GtkContainer implementation has internal children, they should be added
|
|
|
|
|
* with gtk_widget_set_parent() on init() and removed with gtk_widget_unparent()
|
|
|
|
|
* in the #GtkWidgetClass.destroy() implementation.
|
2019-04-05 04:43:36 +00:00
|
|
|
|
*
|
2015-11-11 10:37:28 +00:00
|
|
|
|
* See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgets
|
2010-10-11 02:21:36 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2015-09-12 19:27:10 +00:00
|
|
|
|
|
|
|
|
|
struct _GtkContainerPrivate
|
|
|
|
|
{
|
|
|
|
|
guint resize_handler;
|
|
|
|
|
|
|
|
|
|
guint restyle_pending : 1;
|
|
|
|
|
};
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
enum {
|
|
|
|
|
ADD,
|
|
|
|
|
REMOVE,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
2001-03-22 20:59:37 +00:00
|
|
|
|
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
/* --- prototypes --- */
|
2010-09-18 23:55:42 +00:00
|
|
|
|
static void gtk_container_destroy (GtkWidget *widget);
|
2000-12-11 17:47:24 +00:00
|
|
|
|
static void gtk_container_add_unimplemented (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *widget);
|
2000-12-11 17:47:24 +00:00
|
|
|
|
static void gtk_container_remove_unimplemented (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *widget);
|
2010-09-06 16:26:32 +00:00
|
|
|
|
static void gtk_container_compute_expand (GtkWidget *widget,
|
|
|
|
|
gboolean *hexpand_p,
|
|
|
|
|
gboolean *vexpand_p);
|
2000-12-11 17:47:24 +00:00
|
|
|
|
static void gtk_container_real_set_focus_child (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *widget);
|
2000-12-11 17:47:24 +00:00
|
|
|
|
static void gtk_container_children_callback (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gpointer client_data);
|
2011-03-05 08:49:49 +00:00
|
|
|
|
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
|
2001-07-19 14:57:15 +00:00
|
|
|
|
|
2010-10-10 22:23:40 +00:00
|
|
|
|
static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container,
|
|
|
|
|
GtkWidget *child);
|
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
/* GtkBuildable */
|
|
|
|
|
static void gtk_container_buildable_init (GtkBuildableIface *iface);
|
2019-04-05 04:43:36 +00:00
|
|
|
|
static GtkBuildableIface *parent_buildable_iface;
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
|
2015-09-20 06:10:11 +00:00
|
|
|
|
static GQuark vadjustment_key_id;
|
|
|
|
|
static GQuark hadjustment_key_id;
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
static guint container_signals[LAST_SIGNAL] = { 0 };
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkContainer, gtk_container, GTK_TYPE_WIDGET,
|
|
|
|
|
G_ADD_PRIVATE (GtkContainer)
|
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
|
|
|
gtk_container_buildable_init))
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_container_class_init (GtkContainerClass *class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
1998-05-01 04:23:59 +00:00
|
|
|
|
|
2015-09-20 06:10:11 +00:00
|
|
|
|
vadjustment_key_id = g_quark_from_static_string ("gtk-vadjustment");
|
|
|
|
|
hadjustment_key_id = g_quark_from_static_string ("gtk-hadjustment");
|
2010-11-04 15:30:48 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
widget_class->destroy = gtk_container_destroy;
|
2010-09-06 16:26:32 +00:00
|
|
|
|
widget_class->compute_expand = gtk_container_compute_expand;
|
2011-03-05 08:49:49 +00:00
|
|
|
|
widget_class->get_request_mode = gtk_container_get_request_mode;
|
2010-09-05 06:12:10 +00:00
|
|
|
|
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
class->add = gtk_container_add_unimplemented;
|
|
|
|
|
class->remove = gtk_container_remove_unimplemented;
|
|
|
|
|
class->forall = NULL;
|
|
|
|
|
class->set_focus_child = gtk_container_real_set_focus_child;
|
|
|
|
|
class->child_type = NULL;
|
2010-10-10 22:23:40 +00:00
|
|
|
|
class->get_path_for_child = gtk_container_real_get_path_for_child;
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
container_signals[ADD] =
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_signal_new (I_("add"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkContainerClass, add),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_WIDGET);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
container_signals[REMOVE] =
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_signal_new (I_("remove"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkContainerClass, remove),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_WIDGET);
|
2010-06-03 02:11:46 +00:00
|
|
|
|
|
2011-07-02 03:29:06 +00:00
|
|
|
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CONTAINER_ACCESSIBLE);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
static void
|
2007-06-19 12:23:36 +00:00
|
|
|
|
gtk_container_buildable_add_child (GtkBuildable *buildable,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *type)
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
{
|
2018-03-08 02:13:57 +00:00
|
|
|
|
if (GTK_IS_WIDGET (child) &&
|
|
|
|
|
_gtk_widget_get_parent (GTK_WIDGET (child)) == NULL)
|
2008-11-06 17:34:30 +00:00
|
|
|
|
{
|
2018-03-08 02:13:57 +00:00
|
|
|
|
if (type)
|
2019-04-05 04:43:36 +00:00
|
|
|
|
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
2018-03-08 02:13:57 +00:00
|
|
|
|
else
|
2019-04-05 04:43:36 +00:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
2008-11-06 17:34:30 +00:00
|
|
|
|
}
|
2018-03-08 02:13:57 +00:00
|
|
|
|
else
|
2008-11-06 17:34:30 +00:00
|
|
|
|
{
|
2018-03-08 02:13:57 +00:00
|
|
|
|
parent_buildable_iface->add_child (buildable, builder, child, type);
|
2008-11-06 17:34:30 +00:00
|
|
|
|
}
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_container_buildable_init (GtkBuildableIface *iface)
|
|
|
|
|
{
|
|
|
|
|
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
|
|
|
|
iface->add_child = gtk_container_buildable_add_child;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 21:34:39 +00:00
|
|
|
|
/**
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* gtk_container_child_type:
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* @container: a #GtkContainer
|
2001-12-09 21:34:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the type of the children supported by the container.
|
|
|
|
|
*
|
2002-10-07 04:29:52 +00:00
|
|
|
|
* Note that this may return %G_TYPE_NONE to indicate that no more
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* children can be added, e.g. for a #GtkPaned which already has two
|
2001-12-09 21:34:39 +00:00
|
|
|
|
* children.
|
|
|
|
|
*
|
2019-04-05 04:43:36 +00:00
|
|
|
|
* Returns: a #GType
|
2001-12-10 21:50:36 +00:00
|
|
|
|
**/
|
2002-10-07 04:29:52 +00:00
|
|
|
|
GType
|
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
2001-06-19 12:54:10 +00:00
|
|
|
|
gtk_container_child_type (GtkContainer *container)
|
1998-06-16 05:20:05 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
|
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
if (GTK_CONTAINER_GET_CLASS (container)->child_type)
|
|
|
|
|
return GTK_CONTAINER_GET_CLASS (container)->child_type (container);
|
1998-06-28 07:46:10 +00:00
|
|
|
|
else
|
2019-04-05 04:43:36 +00:00
|
|
|
|
return G_TYPE_NONE;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-03-23 03:31:11 +00:00
|
|
|
|
static void
|
2019-04-05 04:43:36 +00:00
|
|
|
|
gtk_container_add_unimplemented (GtkContainer *container,
|
|
|
|
|
GtkWidget *widget)
|
1998-03-23 03:31:11 +00:00
|
|
|
|
{
|
2019-04-05 04:43:36 +00:00
|
|
|
|
g_warning ("GtkContainerClass::add not implemented for '%s'", G_OBJECT_TYPE_NAME (container));
|
1998-03-23 03:31:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-04-05 04:43:36 +00:00
|
|
|
|
gtk_container_remove_unimplemented (GtkContainer *container,
|
|
|
|
|
GtkWidget *widget)
|
1998-03-23 03:31:11 +00:00
|
|
|
|
{
|
2019-04-05 04:43:36 +00:00
|
|
|
|
g_warning ("GtkContainerClass::remove not implemented for '%s'", G_OBJECT_TYPE_NAME (container));
|
1998-03-23 03:31:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_container_init (GtkContainer *container)
|
|
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-09-18 23:55:42 +00:00
|
|
|
|
gtk_container_destroy (GtkWidget *widget)
|
1998-01-30 23:47:09 +00:00
|
|
|
|
{
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GtkContainer *container = GTK_CONTAINER (widget);
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
2008-08-07 14:12:32 +00:00
|
|
|
|
|
2012-04-13 15:27:47 +00:00
|
|
|
|
if (priv->restyle_pending)
|
2012-09-18 13:00:57 +00:00
|
|
|
|
priv->restyle_pending = FALSE;
|
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
|
2008-08-07 14:12:32 +00:00
|
|
|
|
|
2018-03-17 08:53:35 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_container_parent_class)->destroy (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_add:
|
|
|
|
|
* @container: a #GtkContainer
|
|
|
|
|
* @widget: a widget to be placed inside @container
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* Adds @widget to @container. Typically used for simple containers
|
|
|
|
|
* such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated
|
2018-12-26 07:20:34 +00:00
|
|
|
|
* layout containers such #GtkGrid, this function will
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* pick default packing parameters that may not be correct. So
|
2018-12-26 07:20:34 +00:00
|
|
|
|
* consider functions such as gtk_grid_attach() as an alternative
|
|
|
|
|
* to gtk_container_add() in those cases. A widget may be added to
|
|
|
|
|
* only one container at a time; you can’t place the same widget
|
|
|
|
|
* inside two different containers.
|
2013-10-01 00:53:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that some containers, such as #GtkScrolledWindow or #GtkListBox,
|
|
|
|
|
* may add intermediate children between the added widget and the
|
|
|
|
|
* container.
|
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_add (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *widget)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-08-11 21:14:16 +00:00
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
1998-03-11 04:05:15 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
2001-02-03 01:09:41 +00:00
|
|
|
|
|
2015-09-06 23:58:03 +00:00
|
|
|
|
parent = _gtk_widget_get_parent (widget);
|
2010-08-11 21:14:16 +00:00
|
|
|
|
|
|
|
|
|
if (parent != NULL)
|
2001-02-03 01:09:41 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning ("Attempting to add a widget with type %s to a container of "
|
2001-08-29 02:20:02 +00:00
|
|
|
|
"type %s, but the widget is already inside a container of type %s, "
|
2015-07-04 18:30:22 +00:00
|
|
|
|
"please remove the widget from its existing container first." ,
|
2019-04-05 04:43:36 +00:00
|
|
|
|
G_OBJECT_TYPE_NAME (widget),
|
|
|
|
|
G_OBJECT_TYPE_NAME (container),
|
|
|
|
|
G_OBJECT_TYPE_NAME (parent));
|
2001-02-03 01:09:41 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
1998-03-11 04:05:15 +00:00
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_signal_emit (container, container_signals[ADD], 0, widget);
|
2014-03-07 20:45:18 +00:00
|
|
|
|
|
|
|
|
|
_gtk_container_accessible_add (GTK_WIDGET (container), widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_remove:
|
|
|
|
|
* @container: a #GtkContainer
|
|
|
|
|
* @widget: a current child of @container
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* Removes @widget from @container. @widget must be inside @container.
|
|
|
|
|
* Note that @container will own a reference to @widget, and that this
|
|
|
|
|
* may be the last reference held; so removing a widget from its
|
|
|
|
|
* container can destroy that widget. If you want to use @widget
|
2015-11-09 12:40:44 +00:00
|
|
|
|
* again, you need to add a reference to it before removing it from
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* a container, using g_object_ref(). If you don’t want to use @widget
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* again it’s usually more efficient to simply destroy it directly
|
2003-07-08 21:31:09 +00:00
|
|
|
|
* using gtk_widget_destroy() since this will remove it from the
|
|
|
|
|
* container and help break any circular reference count cycles.
|
2001-02-03 01:09:41 +00:00
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_remove (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *widget)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
1998-03-11 04:05:15 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
2010-08-11 21:14:16 +00:00
|
|
|
|
|
2014-03-19 12:23:38 +00:00
|
|
|
|
g_object_ref (container);
|
2014-03-07 20:45:18 +00:00
|
|
|
|
g_object_ref (widget);
|
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_signal_emit (container, container_signals[REMOVE], 0, widget);
|
2014-03-07 20:45:18 +00:00
|
|
|
|
|
|
|
|
|
_gtk_container_accessible_remove (GTK_WIDGET (container), widget);
|
|
|
|
|
|
|
|
|
|
g_object_unref (widget);
|
2014-03-19 12:23:38 +00:00
|
|
|
|
g_object_unref (container);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-22 20:38:03 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_container_needs_idle_sizer (GtkContainer *container)
|
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
2016-02-22 20:38:03 +00:00
|
|
|
|
|
2016-10-09 01:14:32 +00:00
|
|
|
|
if (priv->restyle_pending)
|
2016-02-22 20:38:03 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
return gtk_widget_needs_allocate (GTK_WIDGET (container));
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 13:00:57 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_container_idle_sizer (GdkFrameClock *clock,
|
|
|
|
|
GtkContainer *container)
|
1998-06-24 06:25:14 +00:00
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
|
|
|
|
|
2012-03-23 02:01:16 +00:00
|
|
|
|
/* We validate the style contexts in a single loop before even trying
|
|
|
|
|
* to handle resizes instead of doing validations inline.
|
|
|
|
|
* This is mostly necessary for compatibility reasons with old code,
|
2012-04-13 15:27:47 +00:00
|
|
|
|
* because both style_updated and size_allocate functions often change
|
|
|
|
|
* styles and so could cause infinite loops in this function.
|
|
|
|
|
*
|
|
|
|
|
* It's important to note that even an invalid style context returns
|
|
|
|
|
* sane values. So the result of an invalid style context will never be
|
|
|
|
|
* a program crash, but only a wrong layout or rendering.
|
2012-03-23 02:01:16 +00:00
|
|
|
|
*/
|
2017-09-02 12:25:29 +00:00
|
|
|
|
if (priv->restyle_pending)
|
2012-03-23 02:01:16 +00:00
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
priv->restyle_pending = FALSE;
|
2015-02-20 16:28:23 +00:00
|
|
|
|
gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)));
|
2012-03-23 02:01:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-13 15:27:47 +00:00
|
|
|
|
/* we may be invoked with a container_resize_queue of NULL, because
|
|
|
|
|
* queue_resize could have been adding an extra idle function while
|
|
|
|
|
* the queue still got processed. we better just ignore such case
|
2014-01-17 15:25:30 +00:00
|
|
|
|
* than trying to explicitly work around them with some extra flags,
|
2012-04-13 15:27:47 +00:00
|
|
|
|
* since it doesn't cause any actual harm.
|
|
|
|
|
*/
|
2015-10-08 11:41:50 +00:00
|
|
|
|
if (gtk_widget_needs_allocate (GTK_WIDGET (container)))
|
1998-06-24 06:25:14 +00:00
|
|
|
|
{
|
2019-02-09 00:44:10 +00:00
|
|
|
|
if (GTK_IS_WINDOW (container))
|
|
|
|
|
gtk_window_check_resize (GTK_WINDOW (container));
|
|
|
|
|
else
|
|
|
|
|
g_warning ("gtk_container_idle_sizer() called on a non-window");
|
1998-06-24 06:25:14 +00:00
|
|
|
|
}
|
1998-12-15 07:32:11 +00:00
|
|
|
|
|
2016-02-22 20:38:03 +00:00
|
|
|
|
if (!gtk_container_needs_idle_sizer (container))
|
2012-09-18 13:00:57 +00:00
|
|
|
|
{
|
2018-04-10 20:20:10 +00:00
|
|
|
|
gtk_container_stop_idle_sizer (container);
|
2012-09-18 13:00:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-10-03 23:38:40 +00:00
|
|
|
|
gdk_frame_clock_request_phase (clock,
|
|
|
|
|
GDK_FRAME_CLOCK_PHASE_LAYOUT);
|
2012-09-18 13:00:57 +00:00
|
|
|
|
}
|
1998-06-24 06:25:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-10 20:20:10 +00:00
|
|
|
|
void
|
2012-04-13 15:27:47 +00:00
|
|
|
|
gtk_container_start_idle_sizer (GtkContainer *container)
|
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
2012-09-18 13:00:57 +00:00
|
|
|
|
GdkFrameClock *clock;
|
|
|
|
|
|
2017-09-02 12:25:29 +00:00
|
|
|
|
if (priv->resize_handler != 0)
|
2012-09-18 13:00:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-04-10 20:20:10 +00:00
|
|
|
|
if (!gtk_container_needs_idle_sizer (container))
|
|
|
|
|
return;
|
|
|
|
|
|
2012-09-18 13:00:57 +00:00
|
|
|
|
clock = gtk_widget_get_frame_clock (GTK_WIDGET (container));
|
|
|
|
|
if (clock == NULL)
|
2012-04-13 15:27:47 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2017-09-02 12:25:29 +00:00
|
|
|
|
priv->resize_handler = g_signal_connect (clock, "layout",
|
|
|
|
|
G_CALLBACK (gtk_container_idle_sizer), container);
|
2012-10-03 23:38:40 +00:00
|
|
|
|
gdk_frame_clock_request_phase (clock,
|
|
|
|
|
GDK_FRAME_CLOCK_PHASE_LAYOUT);
|
2012-04-13 15:27:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-02-14 22:11:28 +00:00
|
|
|
|
void
|
2018-04-10 20:20:10 +00:00
|
|
|
|
gtk_container_stop_idle_sizer (GtkContainer *container)
|
2013-02-14 22:11:28 +00:00
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
|
|
|
|
|
|
|
|
|
if (priv->resize_handler == 0)
|
2013-02-14 22:11:28 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-04-10 19:45:09 +00:00
|
|
|
|
g_signal_handler_disconnect (gtk_widget_get_frame_clock (GTK_WIDGET (container)),
|
2017-09-02 12:25:29 +00:00
|
|
|
|
priv->resize_handler);
|
|
|
|
|
priv->resize_handler = 0;
|
2013-02-14 22:11:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-13 15:27:47 +00:00
|
|
|
|
void
|
|
|
|
|
_gtk_container_queue_restyle (GtkContainer *container)
|
|
|
|
|
{
|
2017-09-02 12:25:29 +00:00
|
|
|
|
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
|
2012-04-13 15:27:47 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_CONTAINER (container));
|
|
|
|
|
|
|
|
|
|
if (priv->restyle_pending)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->restyle_pending = TRUE;
|
2018-04-10 20:20:10 +00:00
|
|
|
|
gtk_container_start_idle_sizer (container);
|
2012-09-18 13:00:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-05 08:49:49 +00:00
|
|
|
|
static GtkSizeRequestMode
|
|
|
|
|
gtk_container_get_request_mode (GtkWidget *widget)
|
|
|
|
|
{
|
2018-03-17 13:54:23 +00:00
|
|
|
|
GtkWidget *w;
|
|
|
|
|
int wfh = 0, hfw = 0;
|
|
|
|
|
|
|
|
|
|
for (w = gtk_widget_get_first_child (widget);
|
|
|
|
|
w != NULL;
|
|
|
|
|
w = gtk_widget_get_next_sibling (w))
|
|
|
|
|
{
|
|
|
|
|
GtkSizeRequestMode mode = gtk_widget_get_request_mode (w);
|
2011-03-05 08:49:49 +00:00
|
|
|
|
|
2018-03-17 13:54:23 +00:00
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH:
|
|
|
|
|
hfw ++;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT:
|
|
|
|
|
wfh ++;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SIZE_REQUEST_CONSTANT_SIZE:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-05 08:49:49 +00:00
|
|
|
|
|
2018-03-17 13:54:23 +00:00
|
|
|
|
if (hfw == 0 && wfh == 0)
|
2012-11-13 21:02:53 +00:00
|
|
|
|
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
|
|
|
|
else
|
2018-03-17 13:54:23 +00:00
|
|
|
|
return wfh > hfw ?
|
2012-11-13 21:02:53 +00:00
|
|
|
|
GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT :
|
2018-03-17 13:54:23 +00:00
|
|
|
|
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
2011-03-05 08:49:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
2013-10-09 18:09:35 +00:00
|
|
|
|
* gtk_container_forall: (virtual forall)
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* @container: a #GtkContainer
|
2011-03-16 14:41:15 +00:00
|
|
|
|
* @callback: (scope call) (closure callback_data): a callback
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* @callback_data: callback user data
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
2016-01-23 06:51:48 +00:00
|
|
|
|
* Invokes @callback on each direct child of @container, including
|
|
|
|
|
* children that are considered “internal” (implementation details
|
|
|
|
|
* of the container). “Internal” children generally weren’t added
|
|
|
|
|
* by the user of the container, but were added by the container
|
|
|
|
|
* implementation itself.
|
|
|
|
|
*
|
|
|
|
|
* Most applications should use gtk_container_foreach(), rather
|
|
|
|
|
* than gtk_container_forall().
|
2001-02-03 01:09:41 +00:00
|
|
|
|
**/
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_forall (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkCallback callback,
|
|
|
|
|
gpointer callback_data)
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
gtk_widget_forall (GTK_WIDGET (container), callback, callback_data);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_foreach:
|
|
|
|
|
* @container: a #GtkContainer
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @callback: (scope call): a callback
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* @callback_data: callback user data
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
2016-01-23 06:51:48 +00:00
|
|
|
|
* Invokes @callback on each non-internal child of @container.
|
|
|
|
|
* See gtk_container_forall() for details on what constitutes
|
|
|
|
|
* an “internal” child. For all practical purposes, this function
|
|
|
|
|
* should iterate over precisely those child widgets that were
|
|
|
|
|
* added to the container by the application with explicit add()
|
|
|
|
|
* calls.
|
|
|
|
|
*
|
2018-11-19 12:48:36 +00:00
|
|
|
|
* It is permissible to remove the child from the @callback handler.
|
|
|
|
|
*
|
2016-01-23 06:51:48 +00:00
|
|
|
|
* Most applications should use gtk_container_foreach(),
|
|
|
|
|
* rather than gtk_container_forall().
|
2001-02-03 01:09:41 +00:00
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_foreach (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkCallback callback,
|
|
|
|
|
gpointer callback_data)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
1998-06-09 07:11:55 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
if (GTK_CONTAINER_GET_CLASS (container)->forall)
|
|
|
|
|
GTK_CONTAINER_GET_CLASS (container)->forall (container, callback, callback_data);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-17 13:57:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_set_focus_child:
|
|
|
|
|
* @container: a #GtkContainer
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* @child: (allow-none): a #GtkWidget, or %NULL
|
2008-03-17 13:57:00 +00:00
|
|
|
|
*
|
2008-07-21 23:23:41 +00:00
|
|
|
|
* Sets, or unsets if @child is %NULL, the focused child of @container.
|
2008-03-17 13:57:00 +00:00
|
|
|
|
*
|
|
|
|
|
* This function emits the GtkContainer::set_focus_child signal of
|
|
|
|
|
* @container. Implementations of #GtkContainer can override the
|
|
|
|
|
* default behaviour by overriding the class closure of this signal.
|
2010-08-20 10:55:41 +00:00
|
|
|
|
*
|
|
|
|
|
* This is function is mostly meant to be used by widgets. Applications can use
|
2014-12-11 02:08:08 +00:00
|
|
|
|
* gtk_widget_grab_focus() to manually set the focus to a specific widget.
|
2008-03-17 13:57:00 +00:00
|
|
|
|
*/
|
1998-06-09 07:11:55 +00:00
|
|
|
|
void
|
1998-12-03 06:52:48 +00:00
|
|
|
|
gtk_container_set_focus_child (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *child)
|
1998-06-09 07:11:55 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
2008-07-21 23:23:41 +00:00
|
|
|
|
if (child)
|
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
1998-06-09 07:11:55 +00:00
|
|
|
|
|
2019-02-26 04:18:13 +00:00
|
|
|
|
GTK_CONTAINER_GET_CLASS (container)->set_focus_child (container, child);
|
1998-06-09 07:11:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 21:34:39 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_get_children:
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* @container: a #GtkContainer
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Returns the container’s non-internal children. See
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* gtk_container_forall() for details on what constitutes an "internal" child.
|
2001-12-09 21:34:39 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (element-type GtkWidget) (transfer container): a newly-allocated list of the container’s non-internal children.
|
2001-12-09 21:34:39 +00:00
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GList*
|
2001-08-23 23:38:32 +00:00
|
|
|
|
gtk_container_get_children (GtkContainer *container)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-01-30 22:29:03 +00:00
|
|
|
|
GList *children = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
gtk_container_foreach (container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_container_children_callback,
|
|
|
|
|
&children);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
return g_list_reverse (children);
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-06 16:26:32 +00:00
|
|
|
|
static void
|
2018-03-17 13:59:19 +00:00
|
|
|
|
gtk_container_compute_expand (GtkWidget *widget,
|
|
|
|
|
gboolean *hexpand_p,
|
|
|
|
|
gboolean *vexpand_p)
|
2010-09-06 16:26:32 +00:00
|
|
|
|
{
|
2018-03-17 13:59:19 +00:00
|
|
|
|
GtkWidget *w;
|
|
|
|
|
gboolean hexpand = FALSE;
|
|
|
|
|
gboolean vexpand = FALSE;
|
2010-09-06 16:26:32 +00:00
|
|
|
|
|
2018-03-17 13:59:19 +00:00
|
|
|
|
for (w = gtk_widget_get_first_child (widget);
|
|
|
|
|
w != NULL;
|
|
|
|
|
w = gtk_widget_get_next_sibling (w))
|
|
|
|
|
{
|
|
|
|
|
/* note that we don't get_expand on the child if we already know we
|
|
|
|
|
* have to expand, so we only recurse into children until we find
|
|
|
|
|
* one that expands and then we basically don't do any more
|
|
|
|
|
* work. This means that we can leave some children in a
|
|
|
|
|
* need_compute_expand state, which is fine, as long as GtkWidget
|
|
|
|
|
* doesn't rely on an invariant that "if a child has
|
|
|
|
|
* need_compute_expand, its parents also do"
|
|
|
|
|
*
|
|
|
|
|
* gtk_widget_compute_expand() always returns FALSE if the
|
|
|
|
|
* child is !visible so that's taken care of.
|
|
|
|
|
*/
|
|
|
|
|
hexpand = hexpand || gtk_widget_compute_expand (w, GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
vexpand = vexpand || gtk_widget_compute_expand (w, GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
}
|
2010-09-06 16:26:32 +00:00
|
|
|
|
|
2018-03-17 13:59:19 +00:00
|
|
|
|
*hexpand_p = hexpand;
|
|
|
|
|
*vexpand_p = vexpand;
|
2010-09-06 16:26:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-20 18:05:33 +00:00
|
|
|
|
static void
|
2017-08-07 17:25:28 +00:00
|
|
|
|
gtk_container_real_set_focus_child (GtkContainer *container,
|
|
|
|
|
GtkWidget *focus_child)
|
1998-05-03 15:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
2017-08-07 17:25:28 +00:00
|
|
|
|
g_return_if_fail (focus_child == NULL || GTK_IS_WIDGET (focus_child));
|
1998-05-03 15:45:08 +00:00
|
|
|
|
|
2017-08-07 17:32:57 +00:00
|
|
|
|
/* Check for h/v adjustments and scroll to show the focus child if possible */
|
2017-02-08 09:02:47 +00:00
|
|
|
|
if (focus_child)
|
1998-05-03 15:45:08 +00:00
|
|
|
|
{
|
2004-02-11 01:21:14 +00:00
|
|
|
|
GtkAdjustment *hadj;
|
|
|
|
|
GtkAdjustment *vadj;
|
|
|
|
|
gint x, y;
|
|
|
|
|
|
2010-11-04 15:30:48 +00:00
|
|
|
|
hadj = g_object_get_qdata (G_OBJECT (container), hadjustment_key_id);
|
2004-02-11 01:21:14 +00:00
|
|
|
|
vadj = g_object_get_qdata (G_OBJECT (container), vadjustment_key_id);
|
2010-11-04 15:30:48 +00:00
|
|
|
|
if (hadj || vadj)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
2017-08-07 17:25:28 +00:00
|
|
|
|
GtkWidget *child = focus_child;
|
2018-04-07 11:37:24 +00:00
|
|
|
|
graphene_rect_t child_bounds;
|
2010-11-04 15:30:48 +00:00
|
|
|
|
|
2017-08-07 17:25:28 +00:00
|
|
|
|
while (gtk_widget_get_focus_child (child))
|
|
|
|
|
child = gtk_widget_get_focus_child (child);
|
|
|
|
|
|
2018-03-28 11:05:01 +00:00
|
|
|
|
if (!gtk_widget_translate_coordinates (child, focus_child,
|
2017-08-07 17:32:57 +00:00
|
|
|
|
0, 0, &x, &y))
|
|
|
|
|
return;
|
2004-02-11 01:21:14 +00:00
|
|
|
|
|
2019-02-20 03:53:47 +00:00
|
|
|
|
if (!gtk_widget_compute_bounds (child, child, &child_bounds))
|
|
|
|
|
return;
|
2010-08-11 21:14:16 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (vadj)
|
2018-04-07 11:37:24 +00:00
|
|
|
|
gtk_adjustment_clamp_page (vadj, y, y + child_bounds.size.height);
|
2010-08-11 21:14:16 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (hadj)
|
2018-04-07 11:37:24 +00:00
|
|
|
|
gtk_adjustment_clamp_page (hadj, x, x + child_bounds.size.width);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
}
|
1998-05-03 15:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-10 22:23:40 +00:00
|
|
|
|
static GtkWidgetPath *
|
|
|
|
|
gtk_container_real_get_path_for_child (GtkContainer *container,
|
|
|
|
|
GtkWidget *child)
|
|
|
|
|
{
|
2010-11-19 18:02:27 +00:00
|
|
|
|
GtkWidgetPath *path;
|
|
|
|
|
|
2019-04-05 04:43:36 +00:00
|
|
|
|
path = _gtk_widget_create_path (GTK_WIDGET (container));
|
2011-05-25 20:21:15 +00:00
|
|
|
|
gtk_widget_path_append_for_widget (path, child);
|
|
|
|
|
|
2010-11-19 18:02:27 +00:00
|
|
|
|
return path;
|
2010-10-10 22:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_container_children_callback (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gpointer client_data)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
GList **children;
|
|
|
|
|
|
|
|
|
|
children = (GList**) client_data;
|
|
|
|
|
*children = g_list_prepend (*children, widget);
|
|
|
|
|
}
|
1998-01-02 20:22:38 +00:00
|
|
|
|
|
2004-02-10 01:04:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_set_focus_vadjustment:
|
|
|
|
|
* @container: a #GtkContainer
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* @adjustment: an adjustment which should be adjusted when the focus
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* is moved among the descendents of @container
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
|
|
|
|
* Hooks up an adjustment to focus handling in a container, so when a
|
|
|
|
|
* child of the container is focused, the adjustment is scrolled to
|
|
|
|
|
* show that widget. This function sets the vertical alignment. See
|
|
|
|
|
* gtk_scrolled_window_get_vadjustment() for a typical way of obtaining
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* the adjustment and gtk_container_set_focus_hadjustment() for setting
|
2004-02-10 01:04:35 +00:00
|
|
|
|
* the horizontal adjustment.
|
|
|
|
|
*
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* The adjustments have to be in pixel units and in the same coordinate
|
|
|
|
|
* system as the allocation for immediate children of the container.
|
2004-02-10 01:04:35 +00:00
|
|
|
|
*/
|
1998-05-01 04:23:59 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_set_focus_vadjustment (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkAdjustment *adjustment)
|
1998-05-01 04:23:59 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
|
|
|
if (adjustment)
|
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
|
|
|
|
|
|
if (adjustment)
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_object_ref (adjustment);
|
1998-05-01 04:23:59 +00:00
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_object_set_qdata_full (G_OBJECT (container),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
vadjustment_key_id,
|
|
|
|
|
adjustment,
|
|
|
|
|
g_object_unref);
|
1998-05-01 04:23:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_get_focus_vadjustment:
|
|
|
|
|
* @container: a #GtkContainer
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the vertical focus adjustment for the container. See
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* gtk_container_set_focus_vadjustment().
|
2001-06-24 15:34:48 +00:00
|
|
|
|
*
|
2015-12-28 20:14:08 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): the vertical focus adjustment, or
|
|
|
|
|
* %NULL if none has been set.
|
2001-06-24 15:34:48 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkAdjustment *
|
|
|
|
|
gtk_container_get_focus_vadjustment (GtkContainer *container)
|
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *vadjustment;
|
2010-11-04 15:30:48 +00:00
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
|
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
vadjustment = g_object_get_qdata (G_OBJECT (container), vadjustment_key_id);
|
2001-06-24 15:34:48 +00:00
|
|
|
|
|
|
|
|
|
return vadjustment;
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-10 01:04:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_set_focus_hadjustment:
|
|
|
|
|
* @container: a #GtkContainer
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* @adjustment: an adjustment which should be adjusted when the focus is
|
2007-05-26 06:59:36 +00:00
|
|
|
|
* moved among the descendents of @container
|
2010-11-04 15:30:48 +00:00
|
|
|
|
*
|
|
|
|
|
* Hooks up an adjustment to focus handling in a container, so when a child
|
|
|
|
|
* of the container is focused, the adjustment is scrolled to show that
|
|
|
|
|
* widget. This function sets the horizontal alignment.
|
|
|
|
|
* See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining
|
2007-06-18 00:22:14 +00:00
|
|
|
|
* the adjustment and gtk_container_set_focus_vadjustment() for setting
|
2004-02-10 01:04:35 +00:00
|
|
|
|
* the vertical adjustment.
|
|
|
|
|
*
|
2010-11-04 15:30:48 +00:00
|
|
|
|
* The adjustments have to be in pixel units and in the same coordinate
|
|
|
|
|
* system as the allocation for immediate children of the container.
|
2004-02-10 01:04:35 +00:00
|
|
|
|
*/
|
1998-05-01 04:23:59 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_container_set_focus_hadjustment (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkAdjustment *adjustment)
|
1998-05-01 04:23:59 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
|
|
|
if (adjustment)
|
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
|
|
|
|
|
|
if (adjustment)
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_object_ref (adjustment);
|
1998-05-01 04:23:59 +00:00
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
g_object_set_qdata_full (G_OBJECT (container),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
hadjustment_key_id,
|
|
|
|
|
adjustment,
|
|
|
|
|
g_object_unref);
|
1998-05-01 04:23:59 +00:00
|
|
|
|
}
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_get_focus_hadjustment:
|
|
|
|
|
* @container: a #GtkContainer
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the horizontal focus adjustment for the container. See
|
|
|
|
|
* gtk_container_set_focus_hadjustment ().
|
|
|
|
|
*
|
2015-12-28 20:14:08 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): the horizontal focus adjustment, or %NULL if
|
2001-06-24 15:34:48 +00:00
|
|
|
|
* none has been set.
|
|
|
|
|
**/
|
|
|
|
|
GtkAdjustment *
|
|
|
|
|
gtk_container_get_focus_hadjustment (GtkContainer *container)
|
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *hadjustment;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
|
|
|
|
|
|
2002-10-07 04:29:52 +00:00
|
|
|
|
hadjustment = g_object_get_qdata (G_OBJECT (container), hadjustment_key_id);
|
2001-06-24 15:34:48 +00:00
|
|
|
|
|
|
|
|
|
return hadjustment;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_container_get_path_for_child:
|
|
|
|
|
* @container: a #GtkContainer
|
|
|
|
|
* @child: a child of @container
|
|
|
|
|
*
|
|
|
|
|
* Returns a newly created widget path representing all the widget hierarchy
|
2011-05-25 20:21:15 +00:00
|
|
|
|
* from the toplevel down to and including @child.
|
2010-10-19 08:59:46 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: A newly created #GtkWidgetPath
|
|
|
|
|
**/
|
2010-10-10 22:23:40 +00:00
|
|
|
|
GtkWidgetPath *
|
|
|
|
|
gtk_container_get_path_for_child (GtkContainer *container,
|
|
|
|
|
GtkWidget *child)
|
|
|
|
|
{
|
2011-09-27 02:29:11 +00:00
|
|
|
|
GtkWidgetPath *path;
|
|
|
|
|
|
2010-10-10 22:23:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
|
|
|
|
|
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
|
2015-09-06 23:58:03 +00:00
|
|
|
|
g_return_val_if_fail (container == (GtkContainer *) _gtk_widget_get_parent (child), NULL);
|
2010-10-10 22:23:40 +00:00
|
|
|
|
|
2011-09-27 02:29:11 +00:00
|
|
|
|
path = GTK_CONTAINER_GET_CLASS (container)->get_path_for_child (container, child);
|
|
|
|
|
if (gtk_widget_path_get_object_type (path) != G_OBJECT_TYPE (child))
|
|
|
|
|
{
|
|
|
|
|
g_critical ("%s %p returned a widget path for type %s, but child is %s",
|
|
|
|
|
G_OBJECT_TYPE_NAME (container),
|
|
|
|
|
container,
|
|
|
|
|
g_type_name (gtk_widget_path_get_object_type (path)),
|
|
|
|
|
G_OBJECT_TYPE_NAME (child));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
2010-10-10 22:23:40 +00:00
|
|
|
|
}
|