Pegar

Cuando el usuario pide pegar datos desde el Clipboard, debe pedir un formato específico y proporcionar un método de retorno de llamada que se llamará con los datos en sí. Por ejemplo:

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

Aquí hay un ejemplo de un método de retorno de llamada:

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

18.3.1. 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.