]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item_union.cpp
08bad4ed80fa04d59b7e7e85b47eca2826fb9ab5
[z.facultad/75.42/plaqui.git] / Client / src / item_union.cpp
1
2 #include "item_union.h"
3 #include <iostream>
4
5 ViewUnion::ViewUnion(Glib::ustring _name, int orientacion):ViewItem(_name)
6 {
7         switch (orientacion) {
8                 case 0:
9                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/y_n.png");
10                 break;
11                 case 1:
12                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/y_e.png");
13                 break;
14                 case 2:
15                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/y_s.png");
16                 break;
17                 case 3:
18                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/y_o.png");
19         }
20         m_or = orientacion;
21         image.show();
22         set_size_request();
23 }
24
25 ViewUnion::~ViewUnion()
26 {
27 }
28
29 bool ViewUnion::on_image_expose_event(GdkEventExpose *e)
30 {
31         Glib::RefPtr<Gdk::Colormap> colormap = image.get_colormap();
32         Gdk::Color blanco = Gdk::Color("white");
33         colormap->alloc_color(color);
34         colormap->alloc_color(blanco);
35         gc->set_foreground(color);
36         gc->set_background(color);
37         int w,h;
38         w = image.get_width();
39         h = image.get_height();
40         switch (m_or) {
41                 case 0:
42                         image.get_window()->draw_rectangle(gc, 1, w/2-2, h/2, 4, h/2);
43                         gc->set_foreground(blanco);
44                         image.get_window()->draw_rectangle(gc, 0, w/2-3, h/2-1, 6, h/2);
45                 break;
46                 case 1:
47                         image.get_window()->draw_rectangle(gc, 1, 0, h/2-2, w/2, 4);
48                 break;
49                 case 2:
50                         image.get_window()->draw_rectangle(gc, 1, w/2-2, 0, 4, h/2);
51                 break;
52                 case 3:
53                         image.get_window()->draw_rectangle(gc, 1, w/2, h/2-2, w/2, 4);
54         }
55 }
56