X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/46de693afcd74154ed8b4f6bf6e81221e18a0f97..3e385dbab78eb0336e82855d829a76a111514a38:/tests/GUI/dndwindow.cc diff --git a/tests/GUI/dndwindow.cc b/tests/GUI/dndwindow.cc index fea04dc..e365208 100644 --- a/tests/GUI/dndwindow.cc +++ b/tests/GUI/dndwindow.cc @@ -48,7 +48,10 @@ DnDWindow::DnDWindow() m_Button_Canio.signal_drag_data_get().connect( SigC::slot(*this, &DnDWindow::on_canio_drag_data_get)); m_Button_Y.signal_drag_data_get().connect( SigC::slot(*this, &DnDWindow::on_y_drag_data_get)); m_Button_Codo.signal_drag_data_get().connect( SigC::slot(*this, &DnDWindow::on_codo_drag_data_get)); - + // SeƱales para cambiar el icono cuando empieza el drag. + m_Button_Canio.signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_canio_drag_begin)); + m_Button_Y.signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_y_drag_begin)); + m_Button_Codo.signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_codo_drag_begin)); m_VBox.pack_start(m_Button_Canio); m_VBox.pack_start(m_Button_Y); @@ -78,10 +81,14 @@ void DnDWindow::on_item_button_down() } -void DnDWindow::on_canio_drag_data_get(const Glib::RefPtr&, GtkSelectionData* selection_data, guint, guint) +void DnDWindow::on_canio_drag_data_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint, guint) { //TODO: The gtkmm API needs to change to use a Gtk::SelectionData instead of a GtkSelectionData. //That should happen for gtkmm 2.4. + Glib::RefPtr image; + image = Gdk::Pixbuf::create_from_file("canio.png"); + // Cambio el icono de DND seteando el "hot spot" en el centro. + context->set_icon(image, image->get_width() / 2, image->get_height() / 2); gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar*)"canio.png", 9); } @@ -120,3 +127,24 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtrdrag_finish(false, false, time); } +void DnDWindow::on_canio_drag_begin(const Glib::RefPtr& context) +{ + Glib::RefPtr image; + image = Gdk::Pixbuf::create_from_file("canio.png"); + context->set_icon(image, image->get_width() / 2, image->get_height() / 4); +} + +void DnDWindow::on_y_drag_begin(const Glib::RefPtr& context) +{ + Glib::RefPtr image; + image = Gdk::Pixbuf::create_from_file("y.png"); + context->set_icon(image, image->get_width() / 4, image->get_height() / 4); +} + +void DnDWindow::on_codo_drag_begin(const Glib::RefPtr& context) +{ + Glib::RefPtr image; + image = Gdk::Pixbuf::create_from_file("codo.png"); + context->set_icon(image, 0, 0);//image->get_width() / 2, image->get_height() / 2); +} +