COIN-OR::LEMON - Graph Library

source: lemon-0.x/gui/edit_win.cc @ 1485:3a1c6678fa23

Last change on this file since 1485:3a1c6678fa23 was 1485:3a1c6678fa23, checked in by Hegyi Péter, 15 years ago

Erasing from graph would be possible, if erasing from graph would be possible... (Afternoon has become timewasting...)

  • Property exe set to *
File size: 2.2 KB
RevLine 
[1469]1#include <edit_win.h>
2#include <set>
3
4bool EditWin::close_if_escape_is_pressed(GdkEventKey* e)
5{
6  if(e->keyval==GDK_Escape)
7  {
8    hide();
9  }
10  return true;
11}
12
13EditWin::EditWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),table(2, 2, true)
14{
15  set_title(title);
16  set_default_size(200, 50);
[1478]17  set_keep_above(true);
[1469]18  signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed));
19 
[1478]20  //buttons array
21  buttons=new (Gtk::RadioButton *) [TOOL_NUM];
22  for(int i=0;i<TOOL_NUM;i++)
23    {
24      buttons[i]=NULL;
25    }
26
27  Gtk::RadioButton::Group group;//=buttons[MOVE]->get_group();
28
[1469]29  //New node button
[1478]30  buttons[CREATE_NODE]=new Gtk::RadioButton("New Node");
31  buttons[CREATE_NODE]->set_mode(false);
32  buttons[CREATE_NODE]->set_group(group);
33  buttons[CREATE_NODE]->signal_clicked().connect
[1469]34    (
35     sigc::bind
36     (
37      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
38      1
39      )
40     );
[1478]41  table.attach(*buttons[CREATE_NODE],0,1,0,1);
[1469]42
43  //New edge button
[1478]44  buttons[CREATE_EDGE]=new Gtk::RadioButton("New Edge");
45  buttons[CREATE_EDGE]->set_mode(false);
46  buttons[CREATE_EDGE]->set_group(group);
47  buttons[CREATE_EDGE]->signal_clicked().connect
[1469]48    (
49     sigc::bind
50     (
51      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
52      2
53      )
54     );
[1478]55  table.attach(*buttons[CREATE_EDGE],1,2,0,1);
[1469]56   
57  //Move button
[1478]58  buttons[MOVE]=new Gtk::RadioButton("Move");
59  buttons[MOVE]->set_mode(false);
60  buttons[MOVE]->set_group(group);
61  buttons[MOVE]->signal_clicked().connect
[1469]62    (
63     sigc::bind
64     (
65      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
66      0
67      )
68     );
[1478]69  table.attach(*buttons[MOVE],0,1,1,2);
70     
[1485]71  //New edge button
72  buttons[ERASER]=new Gtk::RadioButton("Erase Item");
73  buttons[ERASER]->set_mode(false);
74  buttons[ERASER]->set_group(group);
75  buttons[ERASER]->signal_clicked().connect
76    (
77     sigc::bind
78     (
79      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
80      3
81      )
82     );
83  table.attach(*buttons[ERASER],1,2,1,2);
84   
[1469]85  add(table);
86
87  show_all_children();
88
89}
90
91void EditWin::makeEditorialToolChanged(int newtool)
92{
93  gdc.changeEditorialTool(newtool);
94}
Note: See TracBrowser for help on using the repository browser.