]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/constructor.cpp
estoy completando un poco todo esto para ponerme a implementar el guardar y cargar...
[z.facultad/75.42/plaqui.git] / Constructor / constructor.cpp
index e2fddbff09e18b607f3cf2ad745ce88dc4418279..7553c9126bb2cc77895064bc6db79abd94cf845e 100644 (file)
@@ -7,10 +7,10 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
        set_title("Constructor");
        
        
        set_title("Constructor");
        
        
-       ico_canio = Gdk::Pixbuf::create_from_file("item_canio.png");
-       ico_y     = Gdk::Pixbuf::create_from_file("item_y.png");
-       ico_codo  = Gdk::Pixbuf::create_from_file("item_codo.png");
-       ico_tanque  = Gdk::Pixbuf::create_from_file("item_tanque.png");
+       ico_canio = Gdk::Pixbuf::create_from_file("canio_n.png");
+       ico_y     = Gdk::Pixbuf::create_from_file("y_n.png");
+       ico_codo  = Gdk::Pixbuf::create_from_file("codo_o.png");
+       ico_tanque  = Gdk::Pixbuf::create_from_file("tanque_e.png");
        
        refGlade->get_widget("btn_canio", btn_canio);
        refGlade->get_widget("btn_codo", btn_codo);
        
        refGlade->get_widget("btn_canio", btn_canio);
        refGlade->get_widget("btn_codo", btn_codo);
@@ -92,6 +92,7 @@ void Constructor::on_btn_tanque_drag_get(const Glib::RefPtr<Gdk::DragContext>& c
 
 void Constructor::on_main_menu_quit()
 {
 
 void Constructor::on_main_menu_quit()
 {
+       delete this;
        Gtk::Main::quit();
        //hide();
 }
        Gtk::Main::quit();
        //hide();
 }
@@ -175,17 +176,19 @@ void Constructor::on_item_drop_drag_received(const Glib::RefPtr<Gdk::DragContext
                if ((selection_data->length >= 0) && (selection_data->format == 8))     {
                        CItem *a;
                        if (strcmp((const char *)selection_data->data, "item_codo.png")==0) 
                if ((selection_data->length >= 0) && (selection_data->format == 8))     {
                        CItem *a;
                        if (strcmp((const char *)selection_data->data, "item_codo.png")==0) 
-                               a = new Splitter();//Gtk::manage( new Splitter() );
+                               a = new Splitter();
                                        else    if (strcmp((const char *)selection_data->data, "item_canio.png")==0) 
                                        else    if (strcmp((const char *)selection_data->data, "item_canio.png")==0) 
-                                               a = new Conduct();//Gtk::manage( new Conduct() );
+                                               a = new Conduct();
                                                        else if (strcmp((const char *)selection_data->data, "item_y.png")==0) 
                                                        else if (strcmp((const char *)selection_data->data, "item_y.png")==0) 
-                                                               a = new Union();//Gtk::manage( new Union() );
+                                                               a = new Union();
                                                                        else if (strcmp((const char *)selection_data->data, "item_tanque.png")==0) 
                                                                        else if (strcmp((const char *)selection_data->data, "item_tanque.png")==0) 
-                                                                               a = new Cistern();//Gtk::manage( new Cistern() );
+                                                                               a = new Cistern();
                                                                                        else
                                                                                        else
-                                                                                               a = new CItem();//Gtk::manage( new CItem((const char *)selection_data->data) );
+                                                                                               a = new CItem();
                        //Seteo el ID del item
                        //Seteo el ID del item
+                       Glib::ustring name("item");
                        a->set_id(++id);                
                        a->set_id(++id);                
+                       a->set_name( name );
                        if ( can_drop(a, i*32, j*32) ) {
                                workplace->put(*a, i*32, j*32);
                                //Apunto al workplace
                        if ( can_drop(a, i*32, j*32) ) {
                                workplace->put(*a, i*32, j*32);
                                //Apunto al workplace