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()
67 int CItem::get_position_x()
72 int CItem::get_position_y()
82 double CItem::get_caudal()
88 Glib::ustring CItem::get_name()
93 Glib::ustring CItem::get_other_name(int _id)
95 std::list<CItem *>::iterator i = listaItems->begin();
96 while ( i != listaItems->end() ) {
97 if ( (*i)->get_id() == _id )
98 return (*i)->get_name();
104 int CItem::get_img_actual()
109 void CItem::set_position(int _x, int _y)
115 void CItem::set_id(int _id)
120 void CItem::set_caudal(double _caudal)
122 caudal_max = _caudal;
125 void CItem::set_name(Glib::ustring _name)
130 bool CItem::is_occupied_area(int _a, int _b)
132 if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )
137 ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item)
140 std::list<CItem *>::iterator i = listaItems->begin();
141 while ( i != listaItems->end() ) {
144 if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) {
152 ConnectorType CItem::get_connector_type( int _a, int _b )
156 void CItem::set_default_connector()
160 void CItem::get_logic_connect_position(int& _a, int& _b)