]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item_codo.cpp
ce0f2b5ce4dfde7e1b2f27297c1cb42c0f1ab1bf
[z.facultad/75.42/plaqui.git] / Client / src / item_codo.cpp
1
2 #include "item_codo.h"
3
4 ViewCodo::ViewCodo(Glib::ustring _name, int orientacion):ViewItem(_name)
5 {
6         switch (orientacion) {
7                 case 0:
8                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_o.png");
9                 break;
10                 case 1:
11                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_n.png");
12                 break;
13                 case 2:
14                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_e.png");
15                 break;
16                 case 3:
17                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_s.png");
18         }
19         m_or = orientacion;
20         image.show();
21         set_size_request();
22 }
23
24 ViewCodo::~ViewCodo()
25 {
26 }
27
28 bool ViewCodo::on_image_expose_event(GdkEventExpose *e)
29 {
30         Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
31         Gdk::Color blanco = Gdk::Color("white");
32         colormap->alloc_color(blanco);
33         colormap->alloc_color(color);
34         gc->set_foreground(blanco);
35         gc->set_background(blanco);
36         gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
37         int w,h;
38         w = image.get_width();
39         h = image.get_height();
40         // TODO : hacer que dibuje arcos en el sentido del codo!
41         switch (m_or) {
42                 case 0:
43                         image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64);
44                         gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
45                         gc->set_foreground(color);
46                         image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64);
47                 break;
48                 case 1:
49                         image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64);
50                         gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
51                         gc->set_foreground(color);
52                         image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64);
53                 break;
54                 case 2:
55                         image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64);
56                         gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
57                         gc->set_foreground(color);
58                         image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64);
59                 break;
60                 case 3:
61                         image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64);
62                         gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
63                         gc->set_foreground(color);
64                         image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64);
65         }
66 }
67