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