new_map_win.h
author hegyi
Mon, 09 Jan 2006 12:41:06 +0000
branchgui
changeset 117 004b239908e6
parent 96 e664d8aa3f72
child 120 9166130d8d56
permissions -rw-r--r--
The tree that is created for evaluation of expression string at new map creation is deleted after usage.
     1 // -*- C++ -*- //
     2 
     3 #ifndef NEWMAPWIN_H
     4 #define NEWMAPWIN_H
     5 
     6 class NewMapWin;
     7 
     8 #include <all_include.h>
     9 #include <nbtab.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   NoteBookTab & mytab;
    20 
    21 public:
    22   struct tree_node
    23   {
    24     char ch;
    25     tree_node * left_child;
    26     tree_node * right_child;
    27   };
    28   
    29   ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
    30   NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
    31 
    32   ///Signal on button is connected to this function,
    33   ///Therefore this function determines whether to
    34   ///call the map/creatort function, and if yes, it
    35   //tells it the attributes.(name, default value)
    36   virtual void on_response(int response_id);
    37 
    38   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
    39 
    40   ///Function that creates a tree from an appropriately manipulated string
    41   tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int);
    42 
    43   ///Function  that creates a string from a tree by postorder reading.
    44   std::string postOrder(tree_node *);
    45 
    46   std::string string2Polishform(std::string, bool);
    47 
    48   bool validVariable(std::string, bool);
    49 
    50   void deleteTree(tree_node *);
    51 
    52   std::map<char, std::string> ch2var;
    53 
    54   Gtk::Entry name, default_value;
    55 
    56   Gtk::Table * table;
    57   Gtk::Label * label;
    58 
    59   Gtk::RadioButton node, edge;
    60 };
    61 
    62 #endif //NEWMAPWIN_H