]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/conduct.cpp
Se arreglan detalles, ya compila pero se cuelga cuando se conecta un cliente.
[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         ref->get_widget_derived("conduct_pty_wnd",property_wnd);
20 }
21
22 Conduct::~Conduct()
23 {
24 }
25
26 bool Conduct::on_button_press_event(GdkEventButton *event)
27 {
28         int w, h;
29         if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
30                 image = null; 
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                 imgActual++;
33                 switch (imgActual) {
34                         case 1:
35                                 image = imageS;
36                                 break;
37                         default: 
38                                 imgActual = 0;
39                                 image = imageN;                 
40                 }
41                 get_size_request(w, h);
42                 set_size_request(h, w);         
43                 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);
44         }
45         if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
46                 menu_popup.popup(event->button, event->time);
47                  return true; //It has been handled.
48         }
49         
50         if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
51                         property_wnd->show();
52         }
53         return true;
54 }
55
56 void Conduct::on_menu_popup_rotar()
57 {
58         GdkEventButton event; 
59                 event.type = GDK_BUTTON_PRESS;
60                 event.button = 2;
61         Conduct::on_button_press_event(&event);
62 }
63
64 void Conduct::on_menu_popup_propiedades()
65 {
66         GdkEventButton event;
67         event.type = GDK_2BUTTON_PRESS;
68         event.button = 1;
69         Conduct::on_button_press_event(&event);
70 }