]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/workplace.cpp
-ahi borre lo que se me escapo
[z.facultad/75.42/plaqui.git] / Constructor / workplace.cpp
1 #include "workplace.h"
2
3 WorkPlace::WorkPlace( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
4 {
5         refGlade->get_widget_derived("viewport",viewport);
6         viewport->workplace = this;
7 }
8
9 WorkPlace::~WorkPlace()
10 {
11 }
12
13 bool WorkPlace::on_expose_event(GdkEventExpose *event)
14 {
15         int x, y;
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);
23                 }
24         return true;
25 }
26
27 bool WorkPlace::on_button_press_event(GdkEventButton *event)
28 {
29         if ((event->type==GDK_BUTTON_RELEASE) && (event->button ==1)) {
30                 get_pointer(viewport->temp.w, viewport->temp.z);        
31                 get_window()->draw_line (get_style()->get_black_gc(), viewport->temp.x,viewport->temp.y,viewport->temp.w,viewport->temp.z);
32         }
33         return true;
34 }
35
36 void WorkPlace::delete_item(int _id)
37 {
38         std::list<CItem*>::iterator i = listaItems->begin();
39         while ( i != listaItems->end() ){
40         CItem *temp = *i;
41                 if ( temp->get_id() == _id ){
42                         listaItems->erase(i);
43                         delete temp;
44                         break;
45                 }
46                 i++;
47         }
48 }