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