]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item_pump.cpp
- Se completa un poco la doc del cliente.
[z.facultad/75.42/plaqui.git] / Client / src / item_pump.cpp
1
2 #include "item_pump.h"
3
4 ViewPump::ViewPump(Glib::ustring _name, int orientacion):ViewItem(_name)
5 {
6         switch (orientacion) {
7                 case 0:
8                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_e.png");
9                         in_x = 96-16;
10                         in_y = 0;
11                         out_x = in_x;
12                         out_y = 32;
13                         offset_x = 0;
14                         offset_y = 0;
15                         item_offset_x = 0;
16                         item_offset_y = -15;
17                 break;
18                 case 1:
19                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/bomba_o.png");
20                         in_x = 16;
21                         in_y = 0;                       
22                         out_x = 16;
23                         out_y = 32;
24                         offset_x = 0;
25                         offset_y = 0;
26                         item_offset_x = 0;
27                         item_offset_y = -15;
28         }
29         m_or = orientacion;
30         image.show();
31         set_size_request();
32 }
33
34 ViewPump::~ViewPump()
35 {
36 }
37
38 bool ViewPump::on_image_expose_event(GdkEventExpose *e)
39 {
40         Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
41         if (!colormap->alloc_color(color, true, true)) {
42                 std::cout << name << ": Error alocando color!" << std::endl;
43         }
44         
45         gc->set_foreground(color);
46         gc->set_background(color);
47         gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
48         if (actual_flow == 0) return true;
49         switch (m_or) {
50                 case 0:
51                         image.get_window()->draw_arc(gc, 1, 8, 8, 16, 16, 0, 360*64);
52                         image.get_window()->draw_line(gc, 16, 16, 96, 16);
53                 break;
54                 case 1:
55                         image.get_window()->draw_arc(gc, 1, 72, 8, 16, 16, 0, 360*64);
56                         image.get_window()->draw_line(gc, 80, 16, 0, 16);
57         }
58         return true;
59 }