?? gdk-selections.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Selections</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GDK Reference Manual"><link rel="up" href="reference.html" title="API Reference"><link rel="prev" href="gdk-Keyboard-Handling.html" title="Key Values"><link rel="next" href="gdk-Drag-and-Drop.html" title="Drag and Drop"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="reference" href="reference.html" title="API Reference"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="gdk-Keyboard-Handling.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GDK Reference Manual</th><td><a accesskey="n" href="gdk-Drag-and-Drop.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3259246" class="shortcut">Top</a>  |  <a href="#id3259807" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Selections"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3259246"></a><span class="refentrytitle">Selections</span></h2><p>Selections — Functions for transfering data via the X selection mechanism</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gdk/gdk.h>typedef <a class="link" href="gdk-Selections.html#GdkSelection">GdkSelection</a>;typedef <a class="link" href="gdk-Selections.html#GdkSelectionType">GdkSelectionType</a>;typedef <a class="link" href="gdk-Selections.html#GdkTarget">GdkTarget</a>;#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-PRIMARY:CAPS">GDK_SELECTION_PRIMARY</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-SECONDARY:CAPS">GDK_SELECTION_SECONDARY</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-CLIPBOARD:CAPS">GDK_SELECTION_CLIPBOARD</a>#define <a class="link" href="gdk-Selections.html#GDK-TARGET-BITMAP:CAPS">GDK_TARGET_BITMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-TARGET-COLORMAP:CAPS">GDK_TARGET_COLORMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-TARGET-DRAWABLE:CAPS">GDK_TARGET_DRAWABLE</a>#define <a class="link" href="gdk-Selections.html#GDK-TARGET-PIXMAP:CAPS">GDK_TARGET_PIXMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-TARGET-STRING:CAPS">GDK_TARGET_STRING</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-ATOM:CAPS">GDK_SELECTION_TYPE_ATOM</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-BITMAP:CAPS">GDK_SELECTION_TYPE_BITMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-COLORMAP:CAPS">GDK_SELECTION_TYPE_COLORMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-DRAWABLE:CAPS">GDK_SELECTION_TYPE_DRAWABLE</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-INTEGER:CAPS">GDK_SELECTION_TYPE_INTEGER</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-PIXMAP:CAPS">GDK_SELECTION_TYPE_PIXMAP</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-WINDOW:CAPS">GDK_SELECTION_TYPE_WINDOW</a>#define <a class="link" href="gdk-Selections.html#GDK-SELECTION-TYPE-STRING:CAPS">GDK_SELECTION_TYPE_STRING</a><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="gdk-Selections.html#gdk-selection-owner-set">gdk_selection_owner_set</a> (<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *owner, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> send_event);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="gdk-Selections.html#gdk-selection-owner-set-for-display">gdk_selection_owner_set_for_display</a> (<a class="link" href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *owner, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> send_event);<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a>* <a class="link" href="gdk-Selections.html#gdk-selection-owner-get">gdk_selection_owner_get</a> (<a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection);<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a>* <a class="link" href="gdk-Selections.html#gdk-selection-owner-get-for-display">gdk_selection_owner_get_for_display</a> (<a class="link" href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection);void <a class="link" href="gdk-Selections.html#gdk-selection-convert">gdk_selection_convert</a> (<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *requestor, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> target, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="gdk-Selections.html#gdk-selection-property-get">gdk_selection_property_get</a> (<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *requestor, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guchar">guchar</a> **data, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> *prop_type, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> *prop_format);void <a class="link" href="gdk-Selections.html#gdk-selection-send-notify">gdk_selection_send_notify</a> (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> requestor, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> target, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> property, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);void <a class="link" href="gdk-Selections.html#gdk-selection-send-notify-for-display">gdk_selection_send_notify_for_display</a> (<a class="link" href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> requestor, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> selection, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> target, <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> property, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre></div><div class="refsect1" lang="en"><a name="id3259807"></a><h2>Description</h2><p>The X selection mechanism provides a way to transferarbitrary chunks of data between programs. A <em class="firstterm">selection</em> is a essentially a named clipboard, identified by a string internedas a <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a>. By claiming ownership of a selection,an application indicates that it will be responsiblefor supplying its contents. The most common selections are <code class="literal">PRIMARY</code> and <code class="literal">CLIPBOARD</code>.</p><p>The contents of a selection can be represented ina number of formats, called <em class="firstterm">targets</em>.Each target is identified by an atom. A list ofall possible targets supported by the selection ownercan be retrieved by requesting the special target<code class="literal">TARGETS</code>. When a selection is retrieved, the data is accompanied by a type(an atom), and a format (an integer, representingthe number of bits per item).See <a class="link" href="gdk-Properties-and-Atoms.html" title="Properties and Atoms">Properties and Atoms</a>for more information.</p><p>The functions in this section only contain the lowlevelparts of the selection protocol. A considerably morecomplicated implementation is needed on top of this.GTK+ contains such an implementation in the functionsin <code class="literal">gtkselection.h</code> and programmersshould use those functions instead of the ones presented here. If you plan to implement selection handlingdirectly on top of the functions here, you should referto the X Inter-client Communication Conventions Manual(ICCCM).</p></div><div class="refsect1" lang="en"><a name="id3259896"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3259906"></a><h3><a name="GdkSelection"></a>GdkSelection</h3><a class="indexterm" name="id3259921"></a><pre class="programlisting">typedef GdkAtom GdkSelection;</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">GdkSelection</code> is deprecated and should not be used in newly-written code.</p></div><p>The <a class="link" href="gdk-Selections.html#GdkSelection"><span class="type">GdkSelection</span></a> enumeration contains predefined atom values for several common selections.</p></div><hr><div class="refsect2" lang="en"><a name="id3259959"></a><h3><a name="GdkSelectionType"></a>GdkSelectionType</h3><a class="indexterm" name="id3259974"></a><pre class="programlisting">typedef GdkAtom GdkSelectionType;</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">GdkSelectionType</code> is deprecated and should not be used in newly-written code.</p></div><p>The <a class="link" href="gdk-Selections.html#GdkSelectionType"><span class="type">GdkSelectionType</span></a> enumeration contains predefinedatom values used to represent the types of data transferredin response to a request for a target. See theICCCM for details about what data should be transferredfor each of these types. Other atoms can be used,and the recommended practice for GTK+ is to to use mime types for this purpose. However, supporting these typesmay be useful for compatibility with older programs.</p></div><hr><div class="refsect2" lang="en"><a name="id3260017"></a><h3><a name="GdkTarget"></a>GdkTarget</h3><a class="indexterm" name="id3260032"></a><pre class="programlisting">typedef GdkAtom GdkTarget;</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">GdkTarget</code> is deprecated and should not be used in newly-written code.</p></div><p>The <a class="link" href="gdk-Selections.html#GdkTarget"><span class="type">GdkTarget</span></a> enumeration contains predefined atom values which areused to describe possible targets for a selection. Other atoms can beused, and the recommended practice for GTK+ is to to use mime typesfor this purpose. However, supporting these types may be useful forcompatibility with older programs.</p></div><hr><div class="refsect2" lang="en"><a name="id3260073"></a><h3><a name="GDK-SELECTION-PRIMARY:CAPS"></a>GDK_SELECTION_PRIMARY</h3><a class="indexterm" name="id3260086"></a><pre class="programlisting">#define GDK_SELECTION_PRIMARY _GDK_MAKE_ATOM (1)</pre><p>A <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a> representing the <code class="literal">PRIMARY</code> selection.</p></div><hr><div class="refsect2" lang="en"><a name="id3260116"></a><h3><a name="GDK-SELECTION-SECONDARY:CAPS"></a>GDK_SELECTION_SECONDARY</h3><a class="indexterm" name="id3260130"></a><pre class="programlisting">#define GDK_SELECTION_SECONDARY _GDK_MAKE_ATOM (2)</pre><p>A <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a> representing the <code class="literal">SECONDARY</code> selection.</p></div><hr><div class="refsect2" lang="en"><a name="id3260160"></a><h3><a name="GDK-SELECTION-CLIPBOARD:CAPS"></a>GDK_SELECTION_CLIPBOARD</h3><a class="indexterm" name="id3260174"></a><pre class="programlisting">#define GDK_SELECTION_CLIPBOARD _GDK_MAKE_ATOM (69)</pre><p>A <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a> representing the <code class="literal">CLIPBOARD</code> selection.</p></div><hr><div class="refsect2" lang="en"><a name="id3260204"></a><h3><a name="GDK-TARGET-BITMAP:CAPS"></a>GDK_TARGET_BITMAP</h3><a class="indexterm" name="id3260218"></a><pre class="programlisting">#define GDK_TARGET_BITMAP _GDK_MAKE_ATOM (5)</pre><p>A <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a> representing the <code class="literal">BITMAP</code> selection target.</p></div><hr><div class="refsect2" lang="en"><a name="id3260248"></a><h3><a name="GDK-TARGET-COLORMAP:CAPS"></a>GDK_TARGET_COLORMAP</h3><a class="indexterm" name="id3260261"></a><pre class="programlisting">#define GDK_TARGET_COLORMAP _GDK_MAKE_ATOM (7)</pre><p>A <a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom"><span class="type">GdkAtom</span></a> representing the <code class="literal">COLORMAP</code> selection target.</p></div><hr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -