# HG changeset patch # User hegyi # Date 1118405510 0 # Node ID 104aab6e5d864c47e2e743575cc6d1a227f042ef # Parent d0ccb2fdeeffbcd18350b12cb2057d0f3923ce7c Sorry, forgot to commit two new files. diff -r d0ccb2fdeeff -r 104aab6e5d86 gui/edit_win.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/edit_win.cc Fri Jun 10 12:11:50 2005 +0000 @@ -0,0 +1,65 @@ +#include +#include + +bool EditWin::close_if_escape_is_pressed(GdkEventKey* e) +{ + if(e->keyval==GDK_Escape) + { + hide(); + } + return true; +} + +EditWin::EditWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),table(2, 2, true) +{ + set_title(title); + set_default_size(200, 50); + + signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed)); + + //New node button + button=new Gtk::Button("New Node"); + button->signal_clicked().connect + ( + sigc::bind + ( + sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), + 1 + ) + ); + table.attach(*button,0,1,0,1); + + //New edge button + button=new Gtk::Button("New Edge"); + button->signal_clicked().connect + ( + sigc::bind + ( + sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), + 2 + ) + ); + table.attach(*button,1,2,0,1); + + //Move button + button=new Gtk::Button("Move"); + button->signal_clicked().connect + ( + sigc::bind + ( + sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), + 0 + ) + ); + table.attach(*button,0,1,1,2); + + add(table); + + show_all_children(); + +} + +void EditWin::makeEditorialToolChanged(int newtool) +{ + gdc.changeEditorialTool(newtool); +} diff -r d0ccb2fdeeff -r 104aab6e5d86 gui/edit_win.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/edit_win.h Fri Jun 10 12:11:50 2005 +0000 @@ -0,0 +1,40 @@ +// -*- C++ -*- // + +#ifndef EDIT_WIN_H +#define EDIT_WIN_H + +#include +#include +#include +#include +#include + +///This class is responsible for creating a window, +///on which the wished editorial tool can be activated. +class EditWin : public Gtk::Window +{ +protected: + ///The \ref GraphDisplayerCanvas on which the graph will be drawn. + ///It has to be known for this class, because + ///when a map assigned to a certain attribute + ///a function of the \ref GraphDisplayerCanvas will be called. + GraphDisplayerCanvas & gdc; + + Gtk::Table table; + + Gtk::Label * label; + Gtk::Button * button; + +public: + ///Constructor of EditWin creates the widgets shown in EditWin. + EditWin(const std::string& title, GraphDisplayerCanvas &); + + virtual bool close_if_escape_is_pressed(GdkEventKey*); + + ///Callback function in case of button pression. + ///It changes the actual tool ins editor's hand. + void makeEditorialToolChanged(int); + +}; + +#endif //EDIT_WIN_H