[42] | 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> |
---|
[88] | 12 | #include <stack> |
---|
[42] | 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::Window |
---|
| 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 | |
---|
[88] | 25 | public: |
---|
| 26 | struct tree_node |
---|
| 27 | { |
---|
| 28 | char ch; |
---|
| 29 | tree_node * left_child; |
---|
| 30 | tree_node * right_child; |
---|
| 31 | }; |
---|
| 32 | |
---|
[42] | 33 | ///Constructor of NewMapWin creates the widgets shown in NewMapWin. |
---|
| 34 | NewMapWin(const std::string& title, GraphDisplayerCanvas &); |
---|
| 35 | |
---|
[88] | 36 | |
---|
[42] | 37 | ///Signal on button is connected to this function, |
---|
| 38 | ///Therefore this function determines whether to |
---|
| 39 | ///call the map/creatort function, and if yes, it |
---|
| 40 | //tells it the attributes.(name, default value) |
---|
| 41 | virtual void buttonPressed(); |
---|
[88] | 42 | |
---|
[85] | 43 | virtual void showByPreChoose(bool); |
---|
| 44 | |
---|
[42] | 45 | virtual bool closeIfEscapeIsPressed(GdkEventKey*); |
---|
| 46 | |
---|
[88] | 47 | ///Function that creates a tree from an appropriately manipulated string |
---|
| 48 | tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int); |
---|
| 49 | |
---|
| 50 | ///Function that creates a string from a tree by postorder reading. |
---|
| 51 | std::string postOrder(tree_node *); |
---|
| 52 | |
---|
| 53 | std::string string2Polishform(std::string, bool); |
---|
| 54 | |
---|
| 55 | bool validVariable(std::string, bool); |
---|
| 56 | |
---|
| 57 | std::map<char, std::string> ch2var; |
---|
| 58 | |
---|
[42] | 59 | Gtk::Entry name, default_value; |
---|
| 60 | |
---|
| 61 | Gtk::VBox vbox; |
---|
| 62 | |
---|
| 63 | Gtk::Button * button; |
---|
| 64 | |
---|
| 65 | Gtk::Table * table; |
---|
| 66 | Gtk::Label * label; |
---|
| 67 | |
---|
| 68 | Gtk::RadioButton node, edge; |
---|
| 69 | }; |
---|
| 70 | |
---|
| 71 | #endif //NEWMAPWIN_H |
---|