ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 7日 (金) 07:15:27 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AClipboard ------------------------- @@ -2,7 +2,7 @@ The Gtk::Clipboard object represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as a Gdk::Atom. (Conversion to and from strings can be done with Gdk::Atom#intern and Gdk::Atom#name.) The default clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, which, in X, traditionally contains the currently selected text. -To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (via methods like Gtk::Clipboard#set_text), or you can supply a callback to be called at a later time when the data is needed (via Gtk::Clipboard#set_with_data) Providing a callback also avoids having to make copies of the data when it is not needed. +To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (via methods like Gtk::Clipboard#set_text), or you can supply a callback to be called at a later time when the data is needed (via Gtk::Clipboard#set). Providing a callback also avoids having to make copies of the data when it is not needed. Requesting the data from the clipboard is essentially asynchronous. If the contents of the clipboard are provided within the same process, then a direct method call will be made to retrieve the data, but if they are provided by another process, then the data needs to be retrieved from the other process, which may take some time. To avoid blocking the user interface, the call to request the selection, Gtk::Clipboard#request_contents takes a callback that will be called when the contents are received (or when the request fails.) If you don't want to deal with providing a separate callback, you can also use Gtk::Clipboard#wait_for_contents(). What this does is run the GLib main loop recursively waiting for the contents. This can simplify the code flow, but you still have to be aware that other callbacks in your program can be called while this recursive mainloop is running.