X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/12a41ca6b41a3d98e9ff6d4cc7de31a9ec537472..e218a1f9cc4ccbe639a7f31610715f9bd66a8ee4:/tests/GUI/dndwindow.cc?ds=sidebyside diff --git a/tests/GUI/dndwindow.cc b/tests/GUI/dndwindow.cc index 8bf40c4..47a18d4 100644 --- a/tests/GUI/dndwindow.cc +++ b/tests/GUI/dndwindow.cc @@ -46,9 +46,10 @@ DnDWindow::DnDWindow() m_WorkPlace.set_size_request(600, 600); //Targets: - std::list listTargets; listTargets.push_back( Gtk::TargetEntry("STRING") ); listTargets.push_back( Gtk::TargetEntry("text/plain") ); + listTargets.push_back( Gtk::TargetEntry("POINTER") ); + listTargets.push_back( Gtk::TargetEntry("application/pointer") ); //Drag site: @@ -128,10 +129,6 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtrlength >= 0) && (selection_data->format == 8)) - { - CItem *a = Gtk::manage( new CItem((const char *)selection_data->data) ); /* Ajusto coordenada x e y para que caigan en un lugar de una cuadricula de * 32x32 */ int i,j; @@ -139,7 +136,23 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtrformat == 10) { + m_WorkPlace.move(*drag_get_source_widget(context), i*32, j*32); + } + + // El Drag es desde la barra de tareas + if ((selection_data->length >= 0) && (selection_data->format == 8)) + { + CItem *a = Gtk::manage( new CItem((const char *)selection_data->data) ); m_WorkPlace.put(*a, i*32, j*32); + // Seteo la lista de tipos de drags + a->drag_source_set(listTargets); + // Conecto las seƱales + a->signal_drag_data_get().connect( SigC::slot(*this, &DnDWindow::on_item_drag_data_get)); + a->signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_item_drag_begin)); + a->show(); //listaItems.push_back(a); } @@ -147,4 +160,15 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtrdrag_finish(false, false, time); } +void DnDWindow::on_item_drag_begin(const Glib::RefPtr& context) +{ +} + +void DnDWindow::on_item_drag_data_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint info, guint time) +{ + // El 10 creo que es el format + gtk_selection_data_set (selection_data, selection_data->target, 10, (const guchar*)"codo.png", 8); +} + +