[Lemon-commits] [lemon_svn] hegyi: r1949 - hugo/trunk/gui
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:00 CET 2006
Author: hegyi
Date: Fri Jun 10 14:11:50 2005
New Revision: 1949
Added:
hugo/trunk/gui/edit_win.cc (contents, props changed)
hugo/trunk/gui/edit_win.h (contents, props changed)
Log:
Sorry, forgot to commit two new files.
Added: hugo/trunk/gui/edit_win.cc
==============================================================================
--- (empty file)
+++ hugo/trunk/gui/edit_win.cc Fri Jun 10 14:11:50 2005
@@ -0,0 +1,65 @@
+#include <edit_win.h>
+#include <set>
+
+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);
+}
Added: hugo/trunk/gui/edit_win.h
==============================================================================
--- (empty file)
+++ hugo/trunk/gui/edit_win.h Fri Jun 10 14:11:50 2005
@@ -0,0 +1,40 @@
+// -*- C++ -*- //
+
+#ifndef EDIT_WIN_H
+#define EDIT_WIN_H
+
+#include <all_include.h>
+#include <mapstorage.h>
+#include <graph_displayer_canvas.h>
+#include <libgnomecanvasmm.h>
+#include <libgnomecanvasmm/polygon.h>
+
+///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
More information about the Lemon-commits
mailing list