3 bool CItem:: logic_connect = false;
7 CItem::CItem(const char *filename):Gtk::DrawingArea()
9 image = Gdk::Pixbuf::create_from_file(filename);
10 set_size_request(image->get_width(), image->get_height());
15 Glib::RefPtr<Gnome::Glade::Xml> ref;
16 ref = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "item_pty_wnd");
17 ref->get_widget_derived("item_pty_wnd",property_wnd);
22 property_wnd->item = this;
23 menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
24 menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
25 menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
26 menu_image_linea.set(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
27 menulist = menu_popup.items();
28 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Propiedades",menu_image_propiedades, SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
29 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar", menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
30 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image_delete,SigC::slot(*this, &CItem::on_menu_popup_eliminar) ) ) ;
31 menu_popup.accelerate(*this);
36 std::cout << "Item Die" << std::endl;
39 bool CItem::on_expose_event(GdkEventExpose* event)
41 image->render_to_drawable ( get_window(), get_style()->get_black_gc(), 0, 0, 0, 0, image->get_width() ,image->get_height() ,
42 Gdk::RGB_DITHER_NONE, 0, 0);
44 // XXX Esto no deberia ser necesario! en todo caso devolves false en
45 // vez de true para que siga llamando a los otros handlers :)
46 //Gtk::DrawingArea::on_expose_event(event);
50 void CItem::on_menu_popup_propiedades()
54 void CItem::on_menu_popup_rotar()
58 void CItem::on_menu_popup_eliminar()
60 workplace->delete_item(ID);
63 void CItem::on_menu_popup_conectar()
65 CItem::logic_connect = true;
69 int CItem::get_position_x()
74 int CItem::get_position_y()
84 double CItem::get_caudal()
90 Glib::ustring CItem::get_name()
95 Glib::ustring CItem::get_other_name(int _id)
97 std::list<CItem *>::iterator i = listaItems->begin();
98 while ( i != listaItems->end() ) {
99 if ( (*i)->get_id() == _id )
100 return (*i)->get_name();
106 int CItem::get_img_actual()
111 void CItem::set_position(int _x, int _y)
117 void CItem::set_id(int _id)
122 void CItem::set_caudal(double _caudal)
124 caudal_max = _caudal;
127 void CItem::set_name(Glib::ustring _name)
132 bool CItem::is_occupied_area(int _a, int _b)
134 if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )
139 ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item)
142 std::list<CItem *>::iterator i = listaItems->begin();
143 while ( i != listaItems->end() ) {
146 if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) {
154 ConnectorType CItem::get_connector_type( int _a, int _b )
158 void CItem::set_default_connector()