]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Client/src/item.cpp
Se liberan los caños como GPL :-)
[z.facultad/75.42/plaqui.git] / Client / src / item.cpp
index 4ce5846dfa7d2904b2b4745e49977e42b0d45b26..be4e47db9eb525de4ba55b8579317be4b9e3059c 100644 (file)
@@ -1,3 +1,4 @@
+
 #include "item.h"
 #include <sstream>
 #include <string>
 #include "item.h"
 #include <sstream>
 #include <string>
@@ -8,19 +9,24 @@ ViewItem::ViewItem(Glib::ustring _name):Gtk::EventBox(),image()
        set_events(Gdk::BUTTON_PRESS_MASK);
        actual_flow = -1;
        add(image);
        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) );
 }
 
 }
 
-ViewItem::~ViewItem()
+void ViewItem::on_realize()
 {
 {
+       Gtk::EventBox::on_realize();
+       Glib::RefPtr<Gdk::Window> 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;
 void ViewItem::set_position(int _x, int _y)
 {
        x = _x;
@@ -32,11 +38,6 @@ void ViewItem::set_name(Glib::ustring _name)
        name = _name;
 }
 
        name = _name;
 }
 
-Glib::ustring ViewItem::get_name()
-{
-       return name;
-}
-
 std::string ViewItem::get_actual_flow()
 {
        std::stringstream ss;
 std::string ViewItem::get_actual_flow()
 {
        std::stringstream ss;
@@ -47,3 +48,12 @@ std::string ViewItem::get_actual_flow()
        return s;
 }
 
        return s;
 }
 
+bool ViewItem::on_image_expose_event(GdkEventExpose *e)
+{
+       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);
+}
+