]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Client/src/item_pump.cpp
Se liberan los caños como GPL :-)
[z.facultad/75.42/plaqui.git] / Client / src / item_pump.cpp
index 1c25011e9ed609d8abf48738368433368e7daa3d..70201be0f740240e2ca9fa2562f2601ee8a037f1 100644 (file)
@@ -6,10 +6,27 @@ ViewPump::ViewPump(Glib::ustring _name, int orientacion):ViewItem(_name)
        switch (orientacion) {
                case 0:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_e.png");
+                       in_x = 96-16;
+                       in_y = 0;
+                       out_x = in_x;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = -15;
                break;
                case 1:
                        image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_o.png");
+                       in_x = 16;
+                       in_y = 0;                       
+                       out_x = 16;
+                       out_y = 32;
+                       offset_x = 0;
+                       offset_y = 0;
+                       item_offset_x = 0;
+                       item_offset_y = -15;
        }
+       m_or = orientacion;
        image.show();
        set_size_request();
 }
@@ -18,3 +35,25 @@ ViewPump::~ViewPump()
 {
 }
 
+bool ViewPump::on_image_expose_event(GdkEventExpose *e)
+{
+       Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
+       if (!colormap->alloc_color(color, true, true)) {
+               std::cout << name << ": Error alocando color!" << std::endl;
+       }
+       
+       gc->set_foreground(color);
+       gc->set_background(color);
+       gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+       if (actual_flow == 0) return true;
+       switch (m_or) {
+               case 0:
+                       image.get_window()->draw_arc(gc, 1, 8, 8, 16, 16, 0, 360*64);
+                       image.get_window()->draw_line(gc, 16, 16, 96, 16);
+               break;
+               case 1:
+                       image.get_window()->draw_arc(gc, 1, 72, 8, 16, 16, 0, 360*64);
+                       image.get_window()->draw_line(gc, 80, 16, 0, 16);
+       }
+       return true;
+}