gtk2/docs/reference/gtk/tmpl/gtksocket.sgml

141 lines
3.3 KiB
Plaintext
Raw Normal View History

1999-08-16 18:51:52 +00:00
<!-- ##### SECTION Title ##### -->
GtkSocket
<!-- ##### SECTION Short_Description ##### -->
Container for widgets from other processes.
<!-- ##### SECTION Long_Description ##### -->
<para>
Together with #GtkPlug, #GtkSocket provides the ability
to embed widgets from one process into another process
in a fashion that is transparent to the user. One
process creates a #GtkSocket widget and, passes the
that widget's window ID to the other process,
which then creates a #GtkPlug with that window ID.
1999-08-16 18:51:52 +00:00
Any widgets contained in the #GtkPlug then will appear
inside the first applications window.
</para>
<para>
The socket's window ID is obtained by using
Doc typo fix. (#68172) * gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172) * gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs. * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document. * gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs. * gtk/gtkrc.c (gtk_rc_get_style_by_paths), gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_push_composite_child), gtk/gtkdialog.c (gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc from messing up the indentation of inline examples. * gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv() instead of getenv(). * gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c, gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c, gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes. * gtk/gtkaccelmap.c (gtk_accel_map_add_filter, gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner): Document. * gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id() instead of GTK_WINDOW_XWINDOW(). (#68172) * gtk/gtk-sections.txt: Move functions which are documented as "private" or "internal" into Private subsections. * gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml, gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml, gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml, gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml, gtk/tmpl/gtkfeatures.sgml: Minor markup fixes. * gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs. * gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml, gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc. * gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
gtk_socket_get_id(). Before using this function,
1999-08-16 18:51:52 +00:00
the socket must have been realized, and for hence,
have been added to its parent.
<example>
<title>Obtaining the window ID of a socket.</title>
1999-08-16 18:51:52 +00:00
<programlisting>
GtkWidget *socket = gtk_socket_new (<!-- -->);
1999-08-16 18:51:52 +00:00
gtk_widget_show (socket);
gtk_container_add (GTK_CONTAINER (parent), socket);
/* The following call is only necessary if one of
* the ancestors of the socket is not yet visible.
*/
gtk_widget_realize (socket);
g_print ("The ID of the sockets window is %#x\n",
Doc typo fix. (#68172) * gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172) * gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs. * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document. * gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs. * gtk/gtkrc.c (gtk_rc_get_style_by_paths), gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_push_composite_child), gtk/gtkdialog.c (gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc from messing up the indentation of inline examples. * gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv() instead of getenv(). * gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c, gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c, gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes. * gtk/gtkaccelmap.c (gtk_accel_map_add_filter, gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner): Document. * gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id() instead of GTK_WINDOW_XWINDOW(). (#68172) * gtk/gtk-sections.txt: Move functions which are documented as "private" or "internal" into Private subsections. * gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml, gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml, gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml, gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml, gtk/tmpl/gtkfeatures.sgml: Minor markup fixes. * gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs. * gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml, gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc. * gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
gtk_socket_get_id (socket));
1999-08-16 18:51:52 +00:00
</programlisting>
</example>
</para>
<para>
Note that if you pass the window ID of the socket to another
1999-08-16 18:51:52 +00:00
process that will create a plug in the socket, you
must make sure that the socket widget is not destroyed
until that plug is created. Violating this rule will
cause unpredictable consequences, the most likely
consequence being that the plug will appear as a
separate toplevel window. You can check if the plug
has been created by examining the
<StructField>plug_window</StructField> field of the
#GtkSocket structure. If this field is non-%NULL,
then the plug has been successfully created inside
1999-08-16 18:51:52 +00:00
of the socket.
</para>
<para>
When GTK+ is notified that the embedded window has been
destroyed, then it will destroy the socket as well. You
should always, therefore, be prepared for your sockets
to be destroyed at any time when the main event loop
is running.
</para>
<para>
A socket can also be used to swallow arbitrary
pre-existing top-level windows using gtk_socket_steal(),
though the integration when this is done will not be as close
as between a #GtkPlug and a #GtkSocket.</para>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term>#GtkPlug</term>
<listitem><para>the widget that plugs into a #GtkSocket.</para></listitem>
</varlistentry>
</variablelist>
</para>
<!-- ##### STRUCT GtkSocket ##### -->
<para>
The #GtkSocket structure contains the <structfield>plug_window</structfield>
field. (This field should be considered read-only. It should
1999-08-16 18:51:52 +00:00
never be set by an application.)
</para>
<!-- ##### FUNCTION gtk_socket_new ##### -->
<para>
</para>
@Returns:
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gtk_socket_steal ##### -->
<para>
</para>
@socket: a #GtkSocket.
@wid:
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gtk_socket_add_id ##### -->
<para>
</para>
@socket:
@window_id:
<!-- # Unused Parameters # -->
@id:
<!-- ##### FUNCTION gtk_socket_get_id ##### -->
<para>
</para>
@socket:
@Returns:
<!-- ##### SIGNAL GtkSocket::plug-added ##### -->
<para>
</para>
@socket: the object which received the signal.
<!-- ##### SIGNAL GtkSocket::plug-removed ##### -->
<para>
</para>
@socket: the object which received the signal.
@Returns: