3 bool CItem::logic_connect = false;
4 int CItem::gate_id = -1;
7 CItem::CItem(const char *filename)
9 image = Gdk::Pixbuf::create_from_file(filename);
10 set_size_request(image->get_width(), image->get_height());
12 add_events(Gdk::EXPOSURE_MASK);
17 Glib::RefPtr<Gnome::Glade::Xml> ref;
18 ref = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "item_pty_wnd");
19 ref->get_widget_derived("item_pty_wnd",property_wnd);
24 property_wnd->item = this;
25 menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
26 menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
27 menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
28 menu_image_linea.set(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
29 menulist = menu_popup.items();
30 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Propiedades",menu_image_propiedades, SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
31 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar", menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
32 menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image_delete,SigC::slot(*this, &CItem::on_menu_popup_eliminar) ) ) ;
33 menu_popup.accelerate(*this);
38 std::cout << "Item Die" << std::endl;
41 void CItem::on_realize()
43 Gtk::DrawingArea::on_realize();
44 Glib::RefPtr<Gdk::Window> window = get_window();
45 gc = Gdk::GC::create(window);
47 Glib::RefPtr<Gdk::Colormap> colormap = get_colormap();
49 red = Gdk::Color("red");
50 blue = Gdk::Color("blue");
52 colormap->alloc_color(red);
53 colormap->alloc_color(blue);
56 bool CItem::on_expose_event(GdkEventExpose* event)
58 get_window()->draw_pixbuf(gc, image, 0, 0, 0, 0, image->get_width() ,image->get_height(),
59 Gdk::RGB_DITHER_NONE, 0, 0);
61 // XXX Esto no deberia ser necesario! en todo caso devolves false en
62 // vez de true para que siga llamando a los otros handlers :)
63 //Gtk::DrawingArea::on_expose_event(event);
67 void CItem::on_menu_popup_propiedades()
71 void CItem::on_menu_popup_rotar()
75 void CItem::on_menu_popup_eliminar()
77 workplace->delete_item(ID);
80 void CItem::on_menu_popup_conectar()
84 int CItem::get_position_x()
89 int CItem::get_position_y()
99 double CItem::get_caudal()
105 Glib::ustring CItem::get_name()
110 Glib::ustring CItem::get_other_name(int _id)
112 std::list<CItem *>::iterator i = listaItems->begin();
113 while ( i != listaItems->end() ) {
114 if ( (*i)->get_id() == _id )
115 return (*i)->get_name();
121 int CItem::get_img_actual()
126 void CItem::set_position(int _x, int _y)
132 void CItem::set_id(int _id)
137 void CItem::set_caudal(double _caudal)
139 caudal_max = _caudal;
142 void CItem::set_name(Glib::ustring _name)
147 bool CItem::is_occupied_area(int _a, int _b)
149 if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )
154 ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item)
157 std::list<CItem *>::iterator i = listaItems->begin();
158 while ( i != listaItems->end() ) {
161 if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) {
169 ConnectorType CItem::get_connector_type( int _a, int _b )
173 void CItem::set_default_connector()
177 void CItem::get_in_logic_connect_position(int& _a, int& _b)
183 void CItem::get_out_logic_connect_position(int& _a, int& _b)
189 void CItem::update_logic_position()