Métodos

Los Widgets pueden identificarse como orígenes o destinos usando estos métodos de Gtk::Widget:

void drag_source_set(const Glib::RefPtr<Gdk::ContentFormats>& targets,
      Gdk::ModifierType start_button_mask, Gdk::DragAction actions);
  • targets is a Gdk::ContentFormats object.
  • start_button_mask es una combinación de valores complementarios, que especifica qué tecla modificadora o botón del ratón debe presionarse para empezar a arrastrar.
  • actions is an ORed combination of values, which specify which Drag and Drop operations will be possible from this source - for instance, copy, move, or link. The user can choose between the actions by using modifier keys, such as Shift to change from copy to move, and this will be shown by a different cursor.
void drag_dest_set(const Glib::RefPtr<Gdk::ContentFormats>& targets,
    Gtk::DestDefaults flags, Gdk::DragAction actions);
  • flags es una combinación de valores complementarios que indica cómo responderá el widget visualmente a los objetos que se arrastran y sueltan.
  • actions indica las acciones de arrastrar y soltar que este destino puede recibir: consulte la descripción arriba.

There are several methods to add source formats and destination formats. Examples:

  • drag_source_add_text_targets()
  • drag_source_add_image_targets()
  • drag_dest_add_text_targets()
  • drag_dest_add_image_targets()