5 ViewTank::ViewTank(Glib::ustring _name, int orientacion):ViewItem(_name)
9 image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_e.png");
20 image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_o.png");
39 std::string ViewTank::get_extra()
48 bool ViewTank::on_image_expose_event(GdkEventExpose *e)
50 Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
51 Gdk::Color negro = Gdk::Color("black");
52 Gdk::Color blanco = Gdk::Color("white");
53 colormap->alloc_color(negro);
54 colormap->alloc_color(blanco);
55 colormap->alloc_color(color);
56 gc->set_line_attributes(1, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
57 int w,h,x,y,h_offset,y_offset;
58 w = image.get_width();
59 h = image.get_height();
61 if (actual_flow == 0) return true;
73 y_offset = static_cast<int>(h*(1.0f-extra/actual_flow));
74 h_offset = static_cast<int>(h*(1.0f-extra/actual_flow));
75 gc->set_foreground(negro);
76 gc->set_background(negro);
77 image.get_window()->draw_rectangle(gc, 1, x, y, w, h);
78 gc->set_foreground(color);
79 gc->set_background(color);
80 image.get_window()->draw_rectangle(gc, 1, x, y+y_offset, w, h-h_offset);
82 /* Un borde para que se vea bien */
83 gc->set_foreground(blanco);
84 gc->set_background(blanco);
85 image.get_window()->draw_rectangle(gc, 0, x-1, y-1, w+1, h+1);