Extending the print dialog

You may add a custom tab to the print dialog:

Although the custom_widget_apply signal provides the widget you previously created, to simplify things you can keep the widgets you expect to contain some user input as class members. For example, let's say you have a Gtk::Entry called m_Entry as a member of your CustomPrintOperation class:

Gtk::Widget* CustomPrintOperation::on_create_custom_widget()
  set_custom_tab_label("My custom tab");

  Gtk::Box* hbox = new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 8);

  Gtk::Label* label = Gtk::make_managed<Gtk::Label>("Enter some text: ");
  hbox->pack_start(*label, false, false);

  hbox->pack_start(m_Entry, false, false);

  return hbox;

void CustomPrintOperation::on_custom_widget_apply(Gtk::Widget* /* widget */)
  Glib::ustring user_input = m_Entry.get_text();

The example in examples/book/printing/advanced demonstrates this.