]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/canio.cpp
387ce3101e6ad36d248548e16d82576ca26b728f
[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         if (event->type == GDK_2BUTTON_PRESS){
20                 image = null;  //como hago para actualizar?????
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 = imageS;
26                                 break;
27                         default: 
28                                 imgActual = 0;
29                                 image = imageN;                 
30                 }
31                 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);
32         }
33         return true;
34 }