| 1 | // -*- C++ -*- // |
|---|
| 2 | |
|---|
| 3 | #ifndef NEWMAPWIN_H |
|---|
| 4 | #define NEWMAPWIN_H |
|---|
| 5 | |
|---|
| 6 | class NewMapWin; |
|---|
| 7 | |
|---|
| 8 | #include <all_include.h> |
|---|
| 9 | #include <graph_displayer_canvas.h> |
|---|
| 10 | #include <libgnomecanvasmm.h> |
|---|
| 11 | #include <libgnomecanvasmm/polygon.h> |
|---|
| 12 | #include <stack> |
|---|
| 13 | |
|---|
| 14 | ///This class is responsible for creating a window, |
|---|
| 15 | ///on which the parameters of a new map can be set. |
|---|
| 16 | |
|---|
| 17 | class NewMapWin : public Gtk::Dialog |
|---|
| 18 | { |
|---|
| 19 | ///The \ref GraphDisplayerCanvas on which the graph will be drawn. |
|---|
| 20 | ///It has to be known for this class, because |
|---|
| 21 | ///when a map is created |
|---|
| 22 | ///a function of the \ref GraphDisplayerCanvas will be called. |
|---|
| 23 | GraphDisplayerCanvas & gdc; |
|---|
| 24 | |
|---|
| 25 | public: |
|---|
| 26 | struct tree_node |
|---|
| 27 | { |
|---|
| 28 | char ch; |
|---|
| 29 | tree_node * left_child; |
|---|
| 30 | tree_node * right_child; |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | ///Constructor of NewMapWin creates the widgets shown in NewMapWin. |
|---|
| 34 | NewMapWin(const std::string& title, GraphDisplayerCanvas &, bool itisedge=true, bool edgenode=true); |
|---|
| 35 | |
|---|
| 36 | ///Signal on button is connected to this function, |
|---|
| 37 | ///Therefore this function determines whether to |
|---|
| 38 | ///call the map/creatort function, and if yes, it |
|---|
| 39 | //tells it the attributes.(name, default value) |
|---|
| 40 | virtual void on_response(int response_id); |
|---|
| 41 | |
|---|
| 42 | virtual bool closeIfEscapeIsPressed(GdkEventKey*); |
|---|
| 43 | |
|---|
| 44 | ///Function that creates a tree from an appropriately manipulated string |
|---|
| 45 | tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int); |
|---|
| 46 | |
|---|
| 47 | ///Function that creates a string from a tree by postorder reading. |
|---|
| 48 | std::string postOrder(tree_node *); |
|---|
| 49 | |
|---|
| 50 | std::string string2Polishform(std::string, bool); |
|---|
| 51 | |
|---|
| 52 | bool validVariable(std::string, bool); |
|---|
| 53 | |
|---|
| 54 | std::map<char, std::string> ch2var; |
|---|
| 55 | |
|---|
| 56 | Gtk::Entry name, default_value; |
|---|
| 57 | |
|---|
| 58 | Gtk::Table * table; |
|---|
| 59 | Gtk::Label * label; |
|---|
| 60 | |
|---|
| 61 | Gtk::RadioButton node, edge; |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | #endif //NEWMAPWIN_H |
|---|