gui/new_map_win.h
author hegyi
Thu, 17 Nov 2005 15:34:18 +0000
changeset 1814 0f02ced2e2ba
parent 1737 dc821d2668c1
child 1823 cb082cdf3667
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.
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@1593
    17
class NewMapWin : public Gtk::Window
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@1593
    34
  NewMapWin(const std::string& title, GraphDisplayerCanvas &);
hegyi@1593
    35
hegyi@1814
    36
  
hegyi@1593
    37
  ///Signal on button is connected to this function,
hegyi@1593
    38
  ///Therefore this function determines whether to
hegyi@1593
    39
  ///call the map/creatort function, and if yes, it
hegyi@1593
    40
  //tells it the attributes.(name, default value)
hegyi@1593
    41
  virtual void buttonPressed();
hegyi@1814
    42
  
hegyi@1737
    43
  virtual void showByPreChoose(bool);
hegyi@1737
    44
hegyi@1593
    45
  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
hegyi@1593
    46
hegyi@1814
    47
  ///Function that creates a tree from an appropriately manipulated string
hegyi@1814
    48
  tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int);
hegyi@1814
    49
hegyi@1814
    50
  ///Function  that creates a string from a tree by postorder reading.
hegyi@1814
    51
  std::string postOrder(tree_node *);
hegyi@1814
    52
hegyi@1814
    53
  std::string string2Polishform(std::string, bool);
hegyi@1814
    54
hegyi@1814
    55
  bool validVariable(std::string, bool);
hegyi@1814
    56
hegyi@1814
    57
  std::map<char, std::string> ch2var;
hegyi@1814
    58
hegyi@1593
    59
  Gtk::Entry name, default_value;
hegyi@1593
    60
hegyi@1593
    61
  Gtk::VBox vbox;
hegyi@1593
    62
hegyi@1593
    63
  Gtk::Button * button;
hegyi@1593
    64
hegyi@1593
    65
  Gtk::Table * table;
hegyi@1593
    66
  Gtk::Label * label;
hegyi@1593
    67
hegyi@1593
    68
  Gtk::RadioButton node, edge;
hegyi@1593
    69
};
hegyi@1593
    70
hegyi@1593
    71
#endif //NEWMAPWIN_H