]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/canio.cpp
47c1450d72f0fc332ba2709339be30b952b5b539
[z.facultad/75.42/plaqui.git] / Constructor / canio.cpp
1 #include "canio.h"
2
3 Canio::Canio()
4 {
5         imageN = Gdk::Pixbuf::create_from_file("canio_n.png");
6         imageS = Gdk::Pixbuf::create_from_file("canio_s.png");
7         null = Gdk::Pixbuf::create_from_file("null.png");
8         imgActual = 0;
9         image = imageN;
10         set_size_request(image->get_width(), image->get_height());
11 }
12
13 Canio::~Canio()
14 {
15 }
16
17 bool Canio::on_button_press_event(GdkEventButton *event)
18 {
19         int w, h;
20         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==3)){
21                 image = null;  //como hago para actualizar?????
22                 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);
23                 imgActual++;
24                 switch (imgActual) {
25                         case 1:
26                                 image = imageS;
27                                 break;
28                         default: 
29                                 imgActual = 0;
30                                 image = imageN;                 
31                 }
32                 get_size_request(w, h);
33                 set_size_request(h, w);         
34                 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);
35         }
36         return true;
37 }