Coller

Quand l'utilisateur demande à coller des données à partir du Clipboard, vous devez demander un format défini et fournir une fonction de rappel qui est appelée avec les vraies données. Par exemple :

void ExampleWindow::on_button_paste()
{
  get_clipboard()->read_text_async(sigc::mem_fun(*this,
              &ExampleWindow::on_clipboard_received));
}

Voici un exemple de fonction de rappel :

void ExampleWindow::on_clipboard_received(Glib::RefPtr<Gio::AsyncResult>& result)
{
  auto text = get_clipboard()->read_text_finish(result);
  //Do something with the pasted data.
}

XVIII.III.I. Discovering the available formats

To find out what formats are currently available on the Clipboard for pasting, call the get_formats() method. Then call a Gdk::ContentFormats method to find out if a format that your application supports is available.