]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/conduct.cpp
ahora compila, y se pueden guardar los datos de los items.
[z.facultad/75.42/plaqui.git] / Constructor / conduct.cpp
1 #include "conduct.h"
2
3 Conduct::Conduct()
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 Conduct::~Conduct()
14 {
15 }
16
17 bool Conduct::on_button_press_event(GdkEventButton *event)
18 {
19         int w, h;
20         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
21                 image = null; 
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         if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
37                 menu_popup.popup(event->button, event->time);
38                  return true; //It has been handled.
39         }
40         
41         if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
42                 property_wnd->spin_caudal->set_value( caudal_max );
43                 property_wnd->txt_item_name->set_text (name);
44                 property_wnd->show();
45         }
46         return true;
47 }
48
49 void Conduct::on_menu_popup_rotar()
50 {
51         GdkEventButton event; 
52                 event.type = GDK_BUTTON_PRESS;
53                 event.button = 2;
54         Conduct::on_button_press_event(&event);
55 }
56
57 void Conduct::on_menu_popup_propiedades()
58 {
59         GdkEventButton event;
60         event.type = GDK_2BUTTON_PRESS;
61         event.button = 1;
62         Conduct::on_button_press_event(&event);
63 }