4 CItem::CItem(const char *filename):Gtk::DrawingArea()
6 image = Gdk::Pixbuf::create_from_file(filename);
7 set_size_request(image->get_width(), image->get_height());
12 Glib::RefPtr<Gnome::Glade::Xml> ref;
13 ref = Gnome::Glade::Xml::create("constructor.glade", "item_pty_wnd");
14 ref->get_widget_derived("item_pty_wnd",property_wnd);
18 property_wnd->item = this;
19 menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
20 menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
21 menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
22 menu_image_linea.set(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
23 menulist = menu_popup.items();
24 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Propiedades",menu_image_propiedades, SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
25 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar", menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
26 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image_delete,SigC::slot(*this, &CItem::on_menu_popup_eliminar) ) ) ;
27 menu_popup.accelerate(*this);
32 std::cout << "Item Die" << std::endl;
35 bool CItem::on_expose_event(GdkEventExpose* event)
37 image->render_to_drawable ( get_window(), get_style()->get_black_gc(), 0, 0, 0, 0, image->get_width() ,image->get_height() ,
38 Gdk::RGB_DITHER_NONE, 0, 0);
40 // XXX Esto no deberia ser necesario! en todo caso devolves false en
41 // vez de true para que siga llamando a los otros handlers :)
42 //Gtk::DrawingArea::on_expose_event(event);
46 void CItem::on_menu_popup_propiedades()
50 void CItem::on_menu_popup_rotar()
54 void CItem::on_menu_popup_eliminar()
56 workplace->delete_item(ID);
59 void CItem::on_menu_popup_conectar()
63 int CItem::get_position_x()
68 int CItem::get_position_y()
78 double CItem::get_caudal()
84 Glib::ustring CItem::get_name()
89 Glib::ustring CItem::get_other_name(int _id)
91 std::list<CItem *>::iterator i = listaItems->begin();
92 while ( i != listaItems->end() ) {
93 if ( (*i)->get_id() == _id )
94 return (*i)->get_name();
100 int CItem::get_img_actual()
105 void CItem::set_position(int _x, int _y)
111 void CItem::set_id(int _id)
116 void CItem::set_caudal(double _caudal)
118 caudal_max = _caudal;
121 void CItem::set_name(Glib::ustring _name)
126 bool CItem::is_occupied_area(int _a, int _b)
128 if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )
133 ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item)
136 std::list<CItem *>::iterator i = listaItems->begin();
137 while ( i != listaItems->end() ) {
140 if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) {
148 ConnectorType CItem::get_connector_type( int _a, int _b )
152 void CItem::set_default_connector()