X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/43fc1b3f57852f2af098fa7411e83220015aaa6f..4f94fbe0a1d217c7410e5396aad365c85f1fc5af:/Client/src/item.cpp?ds=sidebyside diff --git a/Client/src/item.cpp b/Client/src/item.cpp index 418647e..6bbaf1d 100644 --- a/Client/src/item.cpp +++ b/Client/src/item.cpp @@ -1,24 +1,29 @@ -#include "item.h" +#include "item.h" +#include +#include ViewItem::ViewItem(Glib::ustring _name):Gtk::EventBox(),image() { name = _name; set_events(Gdk::BUTTON_PRESS_MASK); + actual_flow = -1; add(image); + + image.signal_expose_event().connect( SigC::slot(*this, &ViewItem::on_image_expose_event) ); } -ViewItem::~ViewItem() +void ViewItem::on_realize() { + Gtk::EventBox::on_realize(); + Glib::RefPtr window = get_window(); + gc = Gdk::GC::create(window); } -/* -bool ViewItem::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 ViewItem::set_position(int _x, int _y) { x = _x; @@ -30,8 +35,22 @@ void ViewItem::set_name(Glib::ustring _name) name = _name; } -Glib::ustring ViewItem::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 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); }