The Clipboard

Simple text copy-paste functionality is provided for free by widgets such as Gtk::Entry and Gtk::TextView, but you might need special code to deal with your own data formats. For instance, a drawing program would need special code to allow copy and paste within a view, or between documents.

You can get a clipboard instance with Gtk::Widget::get_clipboard() or Gdk::Display::get_clipboard().

Your application doesn't need to wait for clipboard operations, particularly between the time when the user chooses Copy and then later chooses Paste. Many Gdk::Clipboard methods take sigc::slots which specify callback methods. When Gdk::Clipboard is ready, it will call these methods, providing the requested data.