new_map_win.h
author hegyi
Thu, 17 Nov 2005 15:34:18 +0000
branchgui
changeset 88 c397e85ec555
parent 85 0b2217328320
child 90 e9f8f44f12a3
permissions -rw-r--r--
As initial value of a new map expression with ()+-/* operators can be given. These operators work on numbers, or on maps. If maps are given, then the new value for a given graph element will be calculated using the value from the given maps that belong to that graph element.
     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::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 
    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 &);
    35 
    36   
    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();
    42   
    43   virtual void showByPreChoose(bool);
    44 
    45   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
    46 
    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 
    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