Sorry, forgot to commit two new files. gui
authorhegyi
Fri, 10 Jun 2005 12:11:50 +0000
branchgui
changeset 1043ddd0c9d881
parent 9 0bb1675306cb
child 11 09b2a893fc9d
Sorry, forgot to commit two new files.
edit_win.cc
edit_win.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/edit_win.cc	Fri Jun 10 12:11:50 2005 +0000
     1.3 @@ -0,0 +1,65 @@
     1.4 +#include <edit_win.h>
     1.5 +#include <set>
     1.6 +
     1.7 +bool EditWin::close_if_escape_is_pressed(GdkEventKey* e)
     1.8 +{
     1.9 +  if(e->keyval==GDK_Escape)
    1.10 +  {
    1.11 +    hide();
    1.12 +  }
    1.13 +  return true;
    1.14 +}
    1.15 +
    1.16 +EditWin::EditWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),table(2, 2, true)
    1.17 +{
    1.18 +  set_title(title);
    1.19 +  set_default_size(200, 50);
    1.20 +
    1.21 +  signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed));
    1.22 +  
    1.23 +  //New node button
    1.24 +  button=new Gtk::Button("New Node");
    1.25 +  button->signal_clicked().connect
    1.26 +    (
    1.27 +     sigc::bind
    1.28 +     (
    1.29 +      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
    1.30 +      1
    1.31 +      )
    1.32 +     );
    1.33 +  table.attach(*button,0,1,0,1);
    1.34 +
    1.35 +  //New edge button
    1.36 +  button=new Gtk::Button("New Edge");
    1.37 +  button->signal_clicked().connect
    1.38 +    (
    1.39 +     sigc::bind
    1.40 +     (
    1.41 +      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
    1.42 +      2
    1.43 +      )
    1.44 +     );
    1.45 +  table.attach(*button,1,2,0,1);
    1.46 +    
    1.47 +  //Move button
    1.48 +  button=new Gtk::Button("Move");
    1.49 +  button->signal_clicked().connect
    1.50 +    (
    1.51 +     sigc::bind
    1.52 +     (
    1.53 +      sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
    1.54 +      0
    1.55 +      )
    1.56 +     );
    1.57 +  table.attach(*button,0,1,1,2);
    1.58 +    
    1.59 +  add(table);
    1.60 +
    1.61 +  show_all_children();
    1.62 +
    1.63 +}
    1.64 +
    1.65 +void EditWin::makeEditorialToolChanged(int newtool)
    1.66 +{
    1.67 +  gdc.changeEditorialTool(newtool);
    1.68 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/edit_win.h	Fri Jun 10 12:11:50 2005 +0000
     2.3 @@ -0,0 +1,40 @@
     2.4 +// -*- C++ -*- //
     2.5 +
     2.6 +#ifndef EDIT_WIN_H
     2.7 +#define EDIT_WIN_H
     2.8 +
     2.9 +#include <all_include.h>
    2.10 +#include <mapstorage.h>
    2.11 +#include <graph_displayer_canvas.h>
    2.12 +#include <libgnomecanvasmm.h>
    2.13 +#include <libgnomecanvasmm/polygon.h>
    2.14 +
    2.15 +///This class is responsible for creating a window,
    2.16 +///on which the wished editorial tool can be activated.
    2.17 +class EditWin : public Gtk::Window
    2.18 +{
    2.19 +protected:
    2.20 +  ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
    2.21 +  ///It has to be known for this class, because
    2.22 +  ///when a map assigned to a certain attribute
    2.23 +  ///a function of the \ref GraphDisplayerCanvas will be called.
    2.24 +  GraphDisplayerCanvas & gdc;
    2.25 +
    2.26 +  Gtk::Table table;
    2.27 +  
    2.28 +  Gtk::Label * label;
    2.29 +  Gtk::Button * button;
    2.30 +
    2.31 +public:
    2.32 +  ///Constructor of EditWin creates the widgets shown in EditWin.
    2.33 +  EditWin(const std::string& title, GraphDisplayerCanvas &);
    2.34 +
    2.35 +  virtual bool close_if_escape_is_pressed(GdkEventKey*);
    2.36 +
    2.37 +  ///Callback function in case of button pression.
    2.38 +  ///It changes the actual tool ins editor's hand.
    2.39 +  void makeEditorialToolChanged(int);
    2.40 +
    2.41 +};
    2.42 +
    2.43 +#endif //EDIT_WIN_H