|
1 #include <edit_win.h> |
|
2 #include <set> |
|
3 |
|
4 bool EditWin::close_if_escape_is_pressed(GdkEventKey* e) |
|
5 { |
|
6 if(e->keyval==GDK_Escape) |
|
7 { |
|
8 hide(); |
|
9 } |
|
10 return true; |
|
11 } |
|
12 |
|
13 EditWin::EditWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),table(2, 2, true) |
|
14 { |
|
15 set_title(title); |
|
16 set_default_size(200, 50); |
|
17 |
|
18 signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed)); |
|
19 |
|
20 //New node button |
|
21 button=new Gtk::Button("New Node"); |
|
22 button->signal_clicked().connect |
|
23 ( |
|
24 sigc::bind |
|
25 ( |
|
26 sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), |
|
27 1 |
|
28 ) |
|
29 ); |
|
30 table.attach(*button,0,1,0,1); |
|
31 |
|
32 //New edge button |
|
33 button=new Gtk::Button("New Edge"); |
|
34 button->signal_clicked().connect |
|
35 ( |
|
36 sigc::bind |
|
37 ( |
|
38 sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), |
|
39 2 |
|
40 ) |
|
41 ); |
|
42 table.attach(*button,1,2,0,1); |
|
43 |
|
44 //Move button |
|
45 button=new Gtk::Button("Move"); |
|
46 button->signal_clicked().connect |
|
47 ( |
|
48 sigc::bind |
|
49 ( |
|
50 sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), |
|
51 0 |
|
52 ) |
|
53 ); |
|
54 table.attach(*button,0,1,1,2); |
|
55 |
|
56 add(table); |
|
57 |
|
58 show_all_children(); |
|
59 |
|
60 } |
|
61 |
|
62 void EditWin::makeEditorialToolChanged(int newtool) |
|
63 { |
|
64 gdc.changeEditorialTool(newtool); |
|
65 } |