]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/conduct.cpp
algunos cambios menores
[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         property_wnd->set_title("Propiedades del Tubo");
12 }
13
14 Conduct::~Conduct()
15 {
16 }
17
18 bool Conduct::on_button_press_event(GdkEventButton *event)
19 {
20         int w, h;
21         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
22                 image = null; 
23                 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);
24                 imgActual++;
25                 switch (imgActual) {
26                         case 1:
27                                 image = imageS;
28                                 break;
29                         default: 
30                                 imgActual = 0;
31                                 image = imageN;                 
32                 }
33                 get_size_request(w, h);
34                 set_size_request(h, w);         
35                 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);
36         }
37         if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
38                 menu_popup.popup(event->button, event->time);
39                  return true; //It has been handled.
40         }
41         
42         if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
43                 property_wnd->spin_caudal->set_value( caudal_max );
44                 property_wnd->txt_item_name->set_text (name);
45                 property_wnd->show();
46         }
47         return true;
48 }
49
50 void Conduct::on_menu_popup_rotar()
51 {
52         GdkEventButton event; 
53                 event.type = GDK_BUTTON_PRESS;
54                 event.button = 2;
55         Conduct::on_button_press_event(&event);
56 }
57
58 void Conduct::on_menu_popup_propiedades()
59 {
60         GdkEventButton event;
61         event.type = GDK_2BUTTON_PRESS;
62         event.button = 1;
63         Conduct::on_button_press_event(&event);
64 }