-#include "item.h"
+#include "item.h"
+#include <sstream>
+#include <string>
-Item::Item(Glib::ustring _name):Gtk::DrawingArea()
+ViewItem::ViewItem(Glib::ustring _name):Gtk::EventBox(),image()
{
- //image = Gdk::Pixbuf::create_from_file(filename);
name = _name;
- //set_size_request(image->get_width(), image->get_height());
+ set_events(Gdk::BUTTON_PRESS_MASK);
+ actual_flow = -1;
+ add(image);
+
+ open = false;
+ actual_flow = extra = 0;
+
+ image.signal_expose_event().connect( SigC::slot(*this, &ViewItem::on_image_expose_event) );
}
-Item::~Item()
+void ViewItem::on_realize()
{
+ Gtk::EventBox::on_realize();
+ Glib::RefPtr<Gdk::Window> window = get_window();
+ gc = Gdk::GC::create(window);
}
-bool Item::on_expose_event(GdkEventExpose* event)
+ViewItem::~ViewItem()
{
- image->render_to_drawable ( get_window(), get_style()->get_black_gc(), 0, 0, 0, 0, image->get_width() ,image->get_height() ,
- Gdk::RGB_DITHER_NONE, 0, 0);
- return true;
}
-void Item::set_position(int _x, int _y)
+void ViewItem::set_position(int _x, int _y)
{
x = _x;
y = _y;
}
-void Item::set_name(Glib::ustring _name)
+void ViewItem::set_name(Glib::ustring _name)
{
name = _name;
}
-Glib::ustring Item::get_name()
+std::string ViewItem::get_actual_flow()
+{
+ std::stringstream ss;
+ std::string s;
+
+ ss << actual_flow;
+ ss >> s;
+ return s;
+}
+
+bool ViewItem::on_image_expose_event(GdkEventExpose *e)
{
- return name;
+ Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
+ colormap->alloc_color(color);
+ gc->set_foreground(color);
+ gc->set_background(color);
+ image.get_window()->draw_rectangle(gc, 1, 0, 0, 10, 10);
}