From a02bffd9a0cca7a49b5bc2c87a3b0293b91aba8b Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Sun, 12 Oct 2003 19:26:47 +0000 Subject: [PATCH] Bueno hice un commit y se mezclo todo con el commit de Luca :-D Yo habia hecho lo mismo que el, solo que con los iconos globales creados una sola vez. Ahora deje todo andando y puse el icono donde correspondia. --- tests/GUI/dndwindow.cc | 50 +++++++++++++++++++++++------------------- tests/GUI/item.cc | 2 -- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/tests/GUI/dndwindow.cc b/tests/GUI/dndwindow.cc index e365208..daa5939 100644 --- a/tests/GUI/dndwindow.cc +++ b/tests/GUI/dndwindow.cc @@ -19,6 +19,8 @@ #include "dndwindow.h" #include +Glib::RefPtr ico_canio, ico_y, ico_codo; + DnDWindow::DnDWindow() : m_Button_Canio("Drag Canio\n"), m_Button_Y("Drop Y\n"), @@ -26,6 +28,10 @@ DnDWindow::DnDWindow() { set_title("Editor"); + ico_canio = Gdk::Pixbuf::create_from_file("canio.png"); + ico_y = Gdk::Pixbuf::create_from_file("y.png"); + ico_codo = Gdk::Pixbuf::create_from_file("codo.png"); + add(m_HBox); m_HBox.pack_start(m_VBox); @@ -80,6 +86,23 @@ void DnDWindow::on_item_button_down() std::cout << "boton abajo" << std::endl; } +void DnDWindow::on_canio_drag_begin(const Glib::RefPtr &context) +{ + context->set_icon(ico_canio, 0, 0); //ico_canio->get_width(), ico_canio->get_height()); +} + +void DnDWindow::on_y_drag_begin(const Glib::RefPtr &context) +{ + context->set_icon(ico_y, 0, 0); //ico_canio->get_width(), ico_canio->get_height()); +} + +void DnDWindow::on_codo_drag_begin(const Glib::RefPtr &context) +{ + context->set_icon(ico_codo, 0, 0); //ico_canio->get_width(), ico_canio->get_height()); +} + + + void DnDWindow::on_canio_drag_data_get(const Glib::RefPtr& context, GtkSelectionData* selection_data, guint, guint) { @@ -117,8 +140,10 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtrshow(); //listaItems.push_back(a); @@ -127,24 +152,3 @@ 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); -} - diff --git a/tests/GUI/item.cc b/tests/GUI/item.cc index 907b435..83a1721 100644 --- a/tests/GUI/item.cc +++ b/tests/GUI/item.cc @@ -5,10 +5,8 @@ CItem::CItem(const char *filename):Gtk::DrawingArea() { - std::cout << "CItem::CItem() -> Usando " << filename << std::endl; image = Gdk::Pixbuf::create_from_file(filename); - std::cout << "CItem::CItem() -> w = " << image->get_width() << " h = " << image->get_height() << std::endl; set_size_request(image->get_width(), image->get_height()); } -- 2.43.0