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 usually pretend that Gtk::Clipboard is a singleton. You can get the default clipboard instance with Gtk::Clipboard::get(). This is probably the only clipboard you will ever need.
Your application doesn't need to wait for clipboard operations, particularly between the time when the user chooses Copy and then later chooses Paste. Most Gtk::Clipboard methods take sigc::slots which specify callback methods. When Gtk::Clipboard is ready, it will call these methods, either providing the requested data, or asking for data.
Reference

Targets
Different applications contain different types of data, and they might make that data available in a variety of formats. gtkmm calls these data types targets.
For instance, gedit can supply and receive the "UTF8_STRING" target, so you can paste data into gedit from any application that supplies that target. Or two different image editing applications might supply and receive a variety of image formats as targets. As long as one application can receive one of the targets that the other supplies then you will be able to copy data from one to the other.
A target can be in a variety of binary formats. This chapter, and the examples, assume that the data is 8-bit text. This would allow us to use an XML format for the clipboard data. However this would probably not be appropriate for binary data such as images. Gtk::Clipboard provides overloads that allow you to specify the format in more detail if necessary.
The Drag and Drop API uses the same mechanism. You should probably use the same data targets and formats for both Clipboard and Drag and Drop operations.

Copy
When the user asks to copy some data, you should tell the Clipboard what targets are available, and provide the callback methods that it can use to get the data. At this point you should store a copy of the data, to be provided when the clipboard calls your callback method in response to a paste.
For instance,

Glib::RefPtr<Gtk::Clipboard> refClipboard = Gtk::Clipboard::get();

//Targets:
std::vector<Gtk::TargetEntry> targets;
targets.push_back( Gtk::TargetEntry("example_custom_target") );
targets.push_back( Gtk::TargetEntry("UTF8_STRING") );

refClipboard->set( targets,
    sigc::mem_fun(*this, &ExampleWindow::on_clipboard_get),
    sigc::mem_fun(*this, &ExampleWindow::on_clipboard_clear) );

Your callback will then provide the stored data when the user chooses to paste the data. For instance:

void ExampleWindow::on_clipboard_get(
    Gtk::SelectionData& selection_data, guint /* info */)
{
  const std::string target = selection_data.get_target();

  if(target == "example_custom_target")
    selection_data.set("example_custom_target", m_ClipboardStore);
}

The ideal example below can supply more than one clipboard target.
The clear callback allows you to free the memory used by your stored data when the clipboard replaces its data with something else.

Paste
When the user asks to paste data from the Clipboard, you should request a specific format and provide a callback method which will be called with the actual data. For instance:

refClipboard->request_contents("example_custom_target",
    sigc::mem_fun(*this, &ExampleWindow::on_clipboard_received) );

Here is an example callback method:

void ExampleWindow::on_clipboard_received(
    const Gtk::SelectionData& selection_data)
{
  Glib::ustring clipboard_data = selection_data.get_data_as_string();
  //Do something with the pasted data.
}

Discovering the available targets
To find out what targets are currently available on the Clipboard for pasting, call the request_targets() method, specifying a method to be called with the information. For instance:

refClipboard->request_targets( sigc::mem_fun(*this,
    &ExampleWindow::on_clipboard_received_targets) );

In your callback, compare the vector of available targets with those that your application supports for pasting. You could enable or disable a Paste menu item, depending on whether pasting is currently possible. For instance:

void ExampleWindow::on_clipboard_received_targets(
  const std::vector<Glib::ustring>& targets)
{
  const bool bPasteIsPossible =
    std::find(targets.begin(), targets.end(),
      example_target_custom) != targets.end();

  // Enable/Disable the Paste button appropriately:
  m_Button_Paste.set_sensitive(bPasteIsPossible);
}

Examples

Simple
This example allows copy and pasting of application-specific data, using the standard text target. Although this is simple, it's not ideal because it does not identify the Clipboard data as being of a particular type.

Clipboard - Simple
Source Code

Ideal
This is like the simple example, but it
Defines a custom clipboard target, though the format of that target is still text.
It supports pasting of 2 targets - both the custom one and a text one that creates an arbitrary text representation of the custom data.
It uses request_targets() and the owner_change signal and disables the Paste button if it can't use anything on the clipboard.

Clipboard - Ideal
Source Code