add(m_HBox);
m_HBox.pack_start(m_VBox);
+
+ m_VBox.pack_start(m_Button_Canio);
+ m_VBox.pack_start(m_Button_Y);
+ m_VBox.pack_start(m_Button_Codo);
+
m_HBox.pack_start(m_WorkPlace);
- m_WorkPlace.set_size_request(300, 300);
+ m_WorkPlace.set_size_request(600, 600);
//Targets:
std::list<Gtk::TargetEntry> listTargets;
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);
- m_VBox.pack_start(m_Button_Codo);
-
-
//Drop site:
-
- //Make m_Label_Drop a DnD drop destination:
m_WorkPlace.drag_dest_set(listTargets);
-
- //Connect signals:
+
+ //Connect signals:
m_WorkPlace.signal_drag_data_received().connect( SigC::slot(*this, &DnDWindow::on_label_drop_drag_data_received) );
-
show_all();
}
context->drag_finish(false, false, time);
}
+
#include <gtkmm/button.h>
#include <gtkmm/fixed.h>
#include "item.h"
+#include "workplace.h"
class DnDWindow : public Gtk::Window
{
virtual void on_y_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
virtual void on_codo_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
-
void on_item_button_down();
//Member widgets:
Gtk::HBox m_HBox;
Gtk::Button m_Button_Canio;
Gtk::Button m_Button_Y;
Gtk::Button m_Button_Codo;
- Gtk::Fixed m_WorkPlace;
+ WorkPlace m_WorkPlace;
std::list<CItem *> listaItems;
};
--- /dev/null
+
+
+#include "workplace.h"
+
+WorkPlace::WorkPlace():Gtk::Fixed()
+{
+}
+
+bool WorkPlace::on_expose_event(GdkEventExpose *e)
+{
+ int i;
+ for(i=0; i<get_width(); i+=32) {
+ get_window()->draw_line(get_style()->get_black_gc(), i, 0, i, get_height());
+ }
+
+ return true;
+}
+
--- /dev/null
+
+#ifndef _H_WORKPLACE_
+#define _H_WORKPLACE_
+
+#include <gtkmm/fixed.h>
+#include <gdkmm/gc.h>
+
+class WorkPlace:public Gtk::Fixed {
+public:
+ WorkPlace();
+ virtual ~WorkPlace() {}
+ virtual bool on_expose_event(GdkEventExpose *);
+};
+
+#endif