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

326 lines
7.4 KiB
Plaintext
Raw Normal View History

1999-08-16 18:51:52 +00:00
<!-- ##### SECTION Title ##### -->
Selections
<!-- ##### SECTION Short_Description ##### -->
Functions for handling inter-process communication via selections.
<!-- ##### SECTION Long_Description ##### -->
<para>
The selection mechanism provides the basis for different types
of IPC between processes. In particular, drag and drop and
#GtkClipboard work via selections. You will very seldom or
never need to use most of the functions in this section directly;
#GtkClipboard provides a nicer interface to the same functionality.
</para>
<para>
Some of the datatypes defined this section are used in
the #GtkClipboard and drag-and-drop API's as well. The
#GtkTargetEntry structure and #GtkTargetList objects represent
lists of data types that are supported when sending or
receiving data. The #GtkSelectionData object is used to
store a chunk of data along with the data type and other
associated information.
1999-08-16 18:51:52 +00:00
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term>#GtkWidget</term>
<listitem><para>Much of the operation of selections happens via
signals for #GtkWidget. In particular, if you are
using the functions in this section, you may need
to pay attention to ::selection_get,
::selection_received, and :selection_clear_event
signals.</para></listitem>
</varlistentry>
</variablelist>
1999-08-16 18:51:52 +00:00
</para>
<!-- ##### STRUCT GtkTargetEntry ##### -->
<para>
A #GtkTargetEntry structure represents a single type of
data than can be supplied for by a widget for a selection
or for supplied or received during drag-and-drop. It
contains a string representing the drag type, a flags
field (used only for drag and drop - see #GtkTargetFlags),
and an application assigned integer ID. The integer
ID will later be passed as a signal parameter for signals
like "selection_get". It allows the application to identify
the target type without extensive string compares.
</para>
@target:
@flags:
@info:
<!-- ##### STRUCT GtkTargetList ##### -->
<para>
A #GtkTargetList structure is a reference counted list
of #GtkTargetPair. It is used to represent the same
information as a table of #GtkTargetEntry, but in
an efficient form. This structure should be treated as
opaque.
</para>
@list:
@ref_count:
<!-- ##### STRUCT GtkTargetPair ##### -->
<para>
Internally used structure in the drag-and-drop and
selection handling code.
</para>
1999-08-16 18:51:52 +00:00
@target:
@flags:
@info:
<!-- ##### FUNCTION gtk_target_list_new ##### -->
<para>
Create a new #GtkTargetList from an array of #GtkTargetEntry.
</para>
@targets: Pointer to an array of #GtkTargetEntry
@ntargets: number of entries in @targets.
@Returns: the new #GtkTargetList.
<!-- ##### FUNCTION gtk_target_list_ref ##### -->
<para>
Increase the reference count of a #GtkTargetList by one.
</para>
@list: a #GtkTargetList
<!-- ##### FUNCTION gtk_target_list_unref ##### -->
<para>
Decrease the reference count of a #GtkTargetList by one.
If the resulting reference count is zero, free the list.
</para>
@list: a #GtkTargetList
<!-- ##### FUNCTION gtk_target_list_add ##### -->
<para>
Add another target to a #GtkTargetList
</para>
@list: a #GtkTargetList
@target: the interned atom representing the target
@flags: the flags for this target
@info: an ID that will be passed back to the application
<!-- ##### FUNCTION gtk_target_list_add_table ##### -->
<para>
Add a table of #GtkTargetEntry into a target list
</para>
@list: a #GtkTargetList
@targets: the table of #GtkTargetEntry
@ntargets: number of targets in the table
<!-- ##### FUNCTION gtk_target_list_remove ##### -->
<para>
Remove a target from a target list
</para>
@list: a #GtkTargetList
@target: the interned atom representing the target
<!-- ##### FUNCTION gtk_target_list_find ##### -->
<para>
Look up a given target in a #GtkTargetList
</para>
@list: a #GtkTargetList
@target: an interned atom representing the target to search for
@info: a pointer to the location to store application info for target
@Returns: %TRUE if the target was found, otherwise %FALSE
<!-- ##### FUNCTION gtk_selection_owner_set ##### -->
<para>
Claim ownership of a given selection for a particular widget,
or, if @widget is %NULL, release ownership of the selection.
</para>
@widget: a #GtkWidget, or %NULL.
@selection: an interned atom representing the selection to claim
@time: the time stamp for claiming the selection
@Returns: %TRUE if the operation succeeded
<!-- ##### FUNCTION gtk_selection_add_target ##### -->
<para>
Add specified target to the list of supported targets for a
given widget and selection.
</para>
@widget: a #GtkTarget
@selection: the selection
@target: target to add.
@info: A unsigned integer which will be passed back to the application.
<!-- ##### FUNCTION gtk_selection_add_targets ##### -->
<para>
Add a table of targets to the list of supported targets
for a given widget and selection.
</para>
@widget: a #GtkWidget
@selection: the selection
@targets: a table of targets to add
@ntargets: number of entries in @targets
<!-- ##### FUNCTION gtk_selection_clear_targets ##### -->
<para>
</para>
@widget:
@selection:
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gtk_selection_convert ##### -->
<para>
Request the contents of a selection. When received,
a "selection_received" signal will be generated.
</para>
@widget: The widget which acts as requestor
@selection: Which selection to get
@target: Form of information desired (e.g., STRING)
@time: Time of request (usually of triggering event)
In emergency, you could use GDK_CURRENT_TIME
@Returns: TRUE if requested succeeded. FALSE if we could not process
request. (e.g., there was already a request in process for
this widget).
<!-- ##### FUNCTION gtk_selection_data_set ##### -->
<para>
Store new data into a GtkSelectionData object. Should
_only_ by called from a selection handler callback.
Null terminates the stored data.
</para>
@selection_data:
@type: the type of selection data
@format: format (number of bits in a unit)
@data: pointer to the data (will be copied)
@length: length of the data
<!-- ##### FUNCTION gtk_selection_data_set_text ##### -->
<para>
</para>
@selection_data:
@str:
@len:
@Returns:
<!-- ##### FUNCTION gtk_selection_data_get_text ##### -->
<para>
</para>
@selection_data:
@Returns:
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
<!-- ##### FUNCTION gtk_selection_remove_all ##### -->
<para>
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
Removes all handlers and unsets ownership of all
selections for a widget. Called when widget is being
destroyed. This function will not generally be
called by applications.
</para>
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
@widget: a #GtkWidget
1999-08-16 18:51:52 +00:00
<!-- ##### FUNCTION gtk_selection_data_copy ##### -->
<para>
Make a copy of a #GtkSelection data structure and its
data.
</para>
@data: a pointer to a #GtkSelectionData structure.
@Returns: a pointer to a copy of @data.
<!-- ##### FUNCTION gtk_selection_data_free ##### -->
<para>
Free a #GtkSelectionData structure returned from
gtk_selection_data_copy().
</para>
@data: a pointer to a #GtkSelectionData structure.
<!-- ##### FUNCTION gtk_selection_clear ##### -->
<para>
Internal function.
</para>
@widget:
@event:
@Returns:
<!-- ##### FUNCTION gtk_selection_incr_event ##### -->
<para>
Internal function.
</para>
@window:
@event:
@Returns:
<!-- ##### FUNCTION gtk_selection_notify ##### -->
<para>
Internal function.
</para>
@widget:
@event:
@Returns:
<!-- ##### FUNCTION gtk_selection_property_notify ##### -->
<para>
Internal function.
</para>
@widget:
@event:
@Returns:
<!-- ##### FUNCTION gtk_selection_request ##### -->
<para>
Internal function.
</para>
@widget:
@event:
@Returns: