]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item.cpp
Agrego Constructor/doc al IMAGE_PATH para que tome las imagenes de nico.
[z.facultad/75.42/plaqui.git] / Client / src / item.cpp
1
2 #include "item.h"
3 #include <sstream>
4 #include <string>
5
6 ViewItem::ViewItem(Glib::ustring _name):Gtk::EventBox(),image()
7 {
8         name = _name;
9         set_events(Gdk::BUTTON_PRESS_MASK);
10         actual_flow = -1;
11         add(image);
12
13         image.signal_expose_event().connect( SigC::slot(*this, &ViewItem::on_image_expose_event) );
14 }
15
16 void ViewItem::on_realize()
17 {
18         Gtk::EventBox::on_realize();
19         Glib::RefPtr<Gdk::Window> window = get_window();
20         gc = Gdk::GC::create(window);
21 }
22
23 ViewItem::~ViewItem()
24 {
25 }
26
27 void ViewItem::set_position(int _x, int _y)
28 {
29         x = _x;
30         y = _y;
31 }
32
33 void ViewItem::set_name(Glib::ustring _name)
34 {
35         name = _name;
36 }
37
38 std::string ViewItem::get_actual_flow()
39 {
40         std::stringstream ss;
41         std::string s;
42
43         ss << actual_flow;
44         ss >> s;
45         return s;
46 }
47
48 bool ViewItem::on_image_expose_event(GdkEventExpose *e)
49 {
50         Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
51         colormap->alloc_color(color);
52         gc->set_foreground(color);
53         gc->set_background(color);
54         image.get_window()->draw_rectangle(gc, 1, 0, 0, 10, 10);
55 }
56