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