3 WorkPlace::WorkPlace( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
5 refGlade->get_widget_derived("viewport",viewport);
6 this->signal_button_press_event().connect(SigC::slot(*this,&WorkPlace::on_button_press_event));
9 WorkPlace::~WorkPlace()
13 bool WorkPlace::on_expose_event(GdkEventExpose *event)
16 for(x=0; x<get_width(); x+=32)
17 for (y=0; y<get_height();y+=32){
18 get_window()->draw_point (get_style()->get_black_gc(), x,y);
19 get_window()->draw_point (get_style()->get_black_gc(), x,y+1);
20 get_window()->draw_point (get_style()->get_black_gc(), x,y-1);
21 get_window()->draw_point (get_style()->get_black_gc(), x+1,y);
22 get_window()->draw_point (get_style()->get_black_gc(), x-1,y);
24 //TODO recorer la lista_lineas y dibujar todas
25 get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
30 bool WorkPlace::on_button_press_event(GdkEventButton *event)
32 std::cout<< temp.x<<" "<<temp.y<< std::endl;
33 if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
34 get_pointer(temp.x,temp.y);
35 std::cout<< temp.x<<" "<<temp.y<< std::endl;
40 bool WorkPlace::on_button_release_event(GdkEventButton *event)
42 if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1) ) {
43 get_pointer(temp.w,temp.z);
44 lista_lineas.push_back(temp);
45 get_window()->draw_line (get_style()->get_black_gc(), temp.x,temp.y,temp.w,temp.z);
50 void WorkPlace::delete_item(int _id)
52 std::list<CItem*>::iterator i = listaItems->begin();
53 while ( i != listaItems->end() ){
55 if ( temp->get_id() == _id ){