]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/cistern.cpp
no me compila la linea en el cpp donde quiero conectar la senial (por que no anda...
[z.facultad/75.42/plaqui.git] / Constructor / cistern.cpp
1 #include "cistern.h"
2
3 Cistern::Cistern()
4 {
5         imageE = Gdk::Pixbuf::create_from_file("tanque_e.png");
6         imageO = Gdk::Pixbuf::create_from_file("tanque_o.png");
7         null = Gdk::Pixbuf::create_from_file("tanque_null.png");
8         imgActual = 0;
9         image = imageE;
10         set_size_request(image->get_width(), image->get_height());
11 }
12
13 Cistern::~Cistern()
14 {
15 }
16
17 bool Cistern::on_button_press_event(GdkEventButton *event)
18 {
19         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
20                 image = null; 
21                 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
22                 imgActual++;
23                 switch (imgActual) {
24                         case 1:
25                                 image = imageO;
26                                 break;
27                         default: 
28                                 imgActual = 0;
29                                 image = imageE;                 
30                 }
31                 set_size_request(image->get_width(),image->get_height());
32                 image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
33         }
34         if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
35                 menu_popup.popup(event->button, event->time);
36                  return true; //It has been handled.
37         }
38         return true;
39 }
40
41 void Cistern::on_menu_popup_rotar()
42 {
43         GdkEventButton event; 
44                 event.type = GDK_BUTTON_PRESS;
45                 event.button = 2;
46         Cistern::on_button_press_event(&event);
47 }