]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/conduct.cpp
d10c0c542d02bfe2b7d0e5f788ef15cd9df8736d
[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         Glib::RefPtr<Gnome::Glade::Xml> ref;
13         try {
14                 ref = Gnome::Glade::Xml::create("constructor.glade", "conduct_pty_wnd");
15         }
16         catch(const Gnome::Glade::XmlError &ex) {
17                 std::cerr << ex.what() << std::endl;
18         }
19         //tengo que crear una clase para esta ventana..!!!
20         ref->get_widget_derived("conduct_pty_wnd",property_wnd);
21 }
22
23 Conduct::~Conduct()
24 {
25 }
26
27 bool Conduct::on_button_press_event(GdkEventButton *event)
28 {
29         int w, h;
30         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
31                 image = null; 
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                 imgActual++;
34                 switch (imgActual) {
35                         case 1:
36                                 image = imageS;
37                                 break;
38                         default: 
39                                 imgActual = 0;
40                                 image = imageN;                 
41                 }
42                 get_size_request(w, h);
43                 set_size_request(h, w);         
44                 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);
45         }
46         if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
47                 menu_popup.popup(event->button, event->time);
48                  return true; //It has been handled.
49         }
50         
51         if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
52                         property_wnd->show();
53         }
54         return true;
55 }
56
57 void Conduct::on_menu_popup_rotar()
58 {
59         GdkEventButton event; 
60                 event.type = GDK_BUTTON_PRESS;
61                 event.button = 2;
62         Conduct::on_button_press_event(&event);
63 }
64
65 void Conduct::on_menu_popup_propiedades()
66 {
67         GdkEventButton event;
68         event.type = GDK_2BUTTON_PRESS;
69         event.button = 1;
70         Conduct::on_button_press_event(&event);
71 }