]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item_union.cpp
Se corrige el bug en la union (del modelo) que probablemente era el error
[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 = Gtk::Widget::get_default_colormap();
32         if (!colormap->alloc_color(color, false, false)) {
33                 std::cout << "ERROR ALOCANDO COLOR!" << std::endl;
34         }
35         gc->set_foreground(color);
36         gc->set_background(color);
37         
38         if (name == "union6") {
39                 std::cout << color.get_red() << " " << color.get_green() << " " << color.get_blue() << std::endl;
40         }
41         int w,h;
42         w = image.get_width();
43         h = image.get_height();
44         if (actual_flow > 0) {
45                 switch (m_or) {
46                         case 0:
47                                 image.get_window()->draw_rectangle(gc, 1, w/2-3, 16, 6, h-16);
48                                 image.get_window()->draw_rectangle(gc, 1, 0, 13, w, 6);
49                         break;
50                         case 1:
51                                 image.get_window()->draw_rectangle(gc, 1, 0, h/2-3, w/2, 6);
52                                 image.get_window()->draw_rectangle(gc, 1, 51, 0, 6, h);
53                         break;
54                         case 2:
55                                 image.get_window()->draw_rectangle(gc, 1, w/2-3, 0, 6, h/2);
56                                 image.get_window()->draw_rectangle(gc, 1, 0, 51, w, 6);
57                         break;
58                         case 3:
59                                 image.get_window()->draw_rectangle(gc, 1, w/2, h/2-3, w/2, 6);
60                                 image.get_window()->draw_rectangle(gc, 1, 16, 0, 6, h);
61                 }
62         }
63         return true;
64 }
65
66