Index: src/UIElements/Menu/ActionMenuItem.cpp
===================================================================
--- src/UIElements/Menu/ActionMenuItem.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * ActionMenuItem.cpp
- *
- *  Created on: Dec 11, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include <iostream>
-
-#include "Menu/ActionMenuItem.hpp"
-#include "Actions/MethodAction.hpp"
-
-using namespace std;
-
-ActionMenuItem::ActionMenuItem(char _trigger, const char* _description,Menu* _menu,Action* _action)
-: MenuItem(_trigger,_description,_menu),
-  action(_action)
-{
-}
-
-ActionMenuItem::~ActionMenuItem()
-{}
-
-void ActionMenuItem::doTrigger() {
-  action->call();
-}
-
-bool ActionMenuItem::isActive() {
-  return action->isActive();
-}
Index: src/UIElements/Menu/ActionMenuItem.hpp
===================================================================
--- src/UIElements/Menu/ActionMenuItem.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * ActionMenuItem.h
- *
- *  Created on: Dec 11, 2009
- *      Author: crueger
- */
-
-#ifndef ACTIONMENUITEM_H_
-#define ACTIONMENUITEM_H_
-
-#include <string>
-
-#include "Menu/MenuItem.hpp"
-
-class Action;
-
-/**
- * Produce MenuItems that take an appropriate action when called.
- */
-class ActionMenuItem : public MenuItem
-{
-public:
-  ActionMenuItem(char,const char*,Menu*,Action*);
-  virtual ~ActionMenuItem();
-
-  virtual void doTrigger();
-
-  virtual bool isActive();
-
-private:
-  Action* action; //!< this action will be called when the trigger matches
-};
-
-#endif /* ACTIONMENUITEM_H_ */
Index: src/UIElements/Menu/DisplayMenuItem.cpp
===================================================================
--- src/UIElements/Menu/DisplayMenuItem.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * DisplayMenuItem.cpp
- *
- *  Created on: Dec 14, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include <sstream>
-#include <cmath>
-
-#include "Menu/DisplayMenuItem.hpp"
-#include "Views/StringView.hpp"
-
-
-DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
-  MenuItem('\0',"",_menu),
-  view(_view),
-  title("")
-{
-}
-
-DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view, string _title, char _spacer, int _length ):
-  MenuItem('\0',"",_menu),
-  view(_view),
-  title(_title),
-  length(_length),
-  spacer(_spacer)
-{
-}
-
-DisplayMenuItem::~DisplayMenuItem()
-{}
-
-
-void DisplayMenuItem::doTrigger(){}
-bool DisplayMenuItem::checkTrigger(char c){
-  return false;
-}
-
-const string DisplayMenuItem::formatEntry(){
-  stringstream s;
-  if(title.length()>0) {
-    int pre = floor((length-title.length())/2.0);
-    int post = ceil((length-title.length())/2.0);
-    for(int i=0;i<pre;i++)
-      s << spacer;
-    s << title;
-    for(int i=0;i<post;i++)
-          s << spacer;
-    s << "\n";
-  }
-  s << view->toString();
-  return s.str();
-}
-
-
-const string DisplayMenuItem::getDescription(){
-  return string("");
-}
Index: src/UIElements/Menu/DisplayMenuItem.hpp
===================================================================
--- src/UIElements/Menu/DisplayMenuItem.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * DisplayMenuItem.hpp
- *
- *  Created on: Dec 14, 2009
- *      Author: crueger
- */
-
-#ifndef DISPLAYMENUITEM_HPP_
-#define DISPLAYMENUITEM_HPP_
-
-#include "Menu/MenuItem.hpp"
-#include "defs.hpp"
-
-class StringView;
-
-/**
- * Display any kind of StringView within a Menu
- *
- * Any trigger are ignored for this type of Item
- */
-class DisplayMenuItem : public MenuItem
-{
-public:
-  DisplayMenuItem(Menu* _menu, StringView *_view);
-  DisplayMenuItem(Menu* _menu, StringView *_view, string _title,
-                  char _spacer=STD_MENU_TITLE_SPACER, int _length=STD_MENU_LENGTH);
-  virtual ~DisplayMenuItem();
-
-  virtual void doTrigger();
-  virtual bool checkTrigger(char);
-
-  virtual const string formatEntry();
-
-  virtual const string getDescription();
-
-private:
-  StringView *view;
-  string title;
-  int length;
-  char spacer;
-};
-
-#endif /* DISPLAYMENUITEM_HPP_ */
Index: src/UIElements/Menu/Menu.cpp
===================================================================
--- src/UIElements/Menu/Menu.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ src/UIElements/Menu/Menu.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -20,14 +20,129 @@
 #include "Helpers/MemDebug.hpp"
 
-#include "Menu.hpp"
+#include <iostream>
 
-Menu::Menu()
+#include "Actions/ActionRegistry.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionTraits.hpp"
+#include "Menu/Menu.hpp"
+
+/** Constructor of class Menu.
+ * \param &_name name of menu
+ */
+Menu::Menu(const std::string &_name) :
+  MenuInterface(_name),
+  name(_name),
+  TopPosition(0),
+  LastItem(NoItem)
+{}
+
+/** Destructor of class Menu.
+ *
+ */
+Menu::~Menu()
+{}
+
+/** Initialiser for class Menu.
+ * Fills menus with items.
+ */
+void Menu::init()
 {
-  // TODO Auto-generated constructor stub
-
+  populate();
+  populateActions();
 }
 
-Menu::~Menu()
+/** Initializing function.
+ * Inserts Menus and Actions obtained from MenuDescription and
+ * ActionRegistry.
+ */
+void Menu::populate()
 {
-  // TODO Auto-generated destructor stub
+  // go through all menus and create them
+
+  bool CompleteFlag = false;  // indicates whether all menus have been added
+  bool PossibleMissingFlag = false; // indicates whether a separator is missing
+  while (!CompleteFlag) {
+    CompleteFlag = true;
+    PossibleMissingFlag = false;
+    for(MenuDescription::const_iterator iter = menudescriptions.getBeginIter();
+        iter != menudescriptions.getEndIter();
+        ++iter) {
+      // skip when already present
+      if (!isPresent(iter->first)) {
+        // have some short refs to infos
+        const std::string &MenuName = iter->first;
+        const std::string &TopName = iter->second.first;
+        const int &MenuPosition = iter->second.second;
+        std::cout << "MenuName is " << MenuName
+            << ", TopName is " << TopName
+            << " and Position is " << MenuPosition
+            << std::endl;
+
+        // does it belong to us?
+        if (TopName == name) {
+          if (MenuPosition-1 == TopPosition) {
+            Menu::addSubmenu(MenuName, MenuPosition);
+            CompleteFlag = false;
+          }
+          // is there a menuposition specified that we have not reached yet?
+          if (MenuPosition-1 > TopPosition)
+            PossibleMissingFlag = true;
+        }
+      }
+    }
+    if (PossibleMissingFlag && (CompleteFlag)) {
+      Menu::addSeparator();
+      CompleteFlag = false; // pass once more as there should be a menu to come
+    }
+  }
 }
+
+/** Fills this menu with all Actions that belong to it.
+ */
+void Menu::populateActions()
+{
+  // go through all actions and add those beloning to this menu
+  ActionRegistry &AR = ActionRegistry::getInstance();
+  for (ActionRegistry::const_iterator iter = AR.getBeginIter();
+      iter != AR.getEndIter();
+      ++iter) {
+    const std::string &MenuName = iter->second->Traits.getMenuName();
+    if (MenuName == name) {
+      const std::string &ActionName = iter->first;
+      Menu::addAction(ActionName);
+    }
+  }
+}
+
+void Menu::addAction(const std::string &ActionName)
+{
+  LastItem = ActionItem;
+  addActionItem(ActionName, ActionName);
+}
+
+void Menu::addSeparator()
+{
+  std::cout << "Creating separator at position " << TopPosition << std::endl;
+  ASSERT( LastItem != SeparatorItem,
+      "Menu::populate() - adding another separator after a separator!");
+  LastItem = SeparatorItem;
+  addSeparatorItem();
+  TopPosition++;
+}
+
+void Menu::addSubmenu(const std::string &MenuName, const int MenuPosition)
+{
+  std::cout << "Creating top-level menu " << MenuName
+      << " at position " << TopPosition << std::endl;
+  ASSERT (!isPresent(MenuName),
+      "Menu::addSubmenu() - trying to add menu "+MenuName+" with already present token!");
+  addSubmenuItem(MenuName, menudescriptions.getDescription(MenuName));
+  DuplicatesList.insert(MenuName);
+  LastItem = MenuItem;
+  TopPosition = MenuPosition;
+}
+
+bool Menu::isPresent(const std::string &token)
+{
+  return (DuplicatesList.find(token) != DuplicatesList.end());
+}
Index: src/UIElements/Menu/Menu.hpp
===================================================================
--- src/UIElements/Menu/Menu.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ src/UIElements/Menu/Menu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -9,32 +9,45 @@
 #define MENU_MENU_H_
 
-using namespace std;
+#include <set>
+#include <string>
 
-class MenuItem;
+#include "Menu/MenuInterface.hpp"
+#include "Menu/MenuDescription.hpp"
 
-/**
- * Base class for all Types of menus
- * contains basic abstract functionality to add Items, remove Items and display the menu
+/** Base class for all Types of menus.
+ * Here, we simply initialize the menus. Via the MenuInterface wrapper we may
+ * access the adding of items for each specific menu in a uniform manner.
  *
- * TODO: Make sure all items are only added once.
+ * Note that this Class is never to be used directly but only via derived
+ * specializations.
  */
-class Menu
+class Menu : virtual public MenuInterface
 {
 public:
-  Menu();
+  explicit Menu(const std::string &name);
   virtual ~Menu();
 
+  void init();
 
-  /**
-   * Adding and removing should be handled by the items.
-   */
-  virtual void addItem(MenuItem*)=0;
-  /**
-   * Adding and removing should be handled by the items.
-   */
-  virtual void removeItem(MenuItem*)=0;
-  virtual void display()=0;
+protected:
+  // Unique name of the menu for identification.
+  const std::string name;
+
+  // populater function that adds all menu items
+  void populate();
+  void populateActions();
 
 private:
+  void addAction(const std::string &ActionName);
+  void addSeparator();
+  void addSubmenu(const std::string &MenuName, const int MenuPosition);
+  bool isPresent(const std::string &token);
+
+  enum ItemType {ActionItem, MenuItem, SeparatorItem, NoItem};
+
+  int TopPosition;  // current position to add
+  MenuDescription menudescriptions; // contains the menu tree and description to each item
+  enum ItemType LastItem;  // check whether separator followed separator
+  std::set <std::string> DuplicatesList;  // is used to check for duplicates
 };
 
Index: src/UIElements/Menu/MenuDescription.cpp
===================================================================
--- src/UIElements/Menu/MenuDescription.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ src/UIElements/Menu/MenuDescription.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -75,5 +75,5 @@
  * \return description string of the menu or empty
  */
-const std::string MenuDescription::getDescription(std::string token) const
+const std::string MenuDescription::getDescription(const std::string &token) const
 {
   if (MenuDescriptionsMap.find(token) != MenuDescriptionsMap.end())
@@ -87,5 +87,5 @@
  * \return description string of the menu or empty
  */
-const std::string MenuDescription::getName(std::string token) const
+const std::string MenuDescription::getName(const std::string &token) const
 {
   if (MenuNameMap.find(token) != MenuNameMap.end())
Index: src/UIElements/Menu/MenuDescription.hpp
===================================================================
--- src/UIElements/Menu/MenuDescription.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ src/UIElements/Menu/MenuDescription.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -32,6 +32,6 @@
 
   // getter for description
-  const std::string getDescription(std::string token) const;
-  const std::string getName(std::string token) const;
+  const std::string getDescription(const std::string &token) const;
+  const std::string getName(const std::string &token) const;
 
   std::multimap <std::string, std::string> getMenuItemsMap() const;
Index: src/UIElements/Menu/MenuInterface.cpp
===================================================================
--- src/UIElements/Menu/MenuInterface.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/MenuInterface.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,25 @@
+/*
+ * MenuInterface.cpp
+ *
+ *  Created on: Nov 6, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Menu/MenuInterface.hpp"
+
+/** Empty Constructor for class MenuInterface.
+ *
+ */
+MenuInterface::MenuInterface(const std::string &_token)
+{}
+
+/** Empty Destructor for class MenuInterface.
+ *
+ */
+MenuInterface::~MenuInterface()
+{}
Index: src/UIElements/Menu/MenuInterface.hpp
===================================================================
--- src/UIElements/Menu/MenuInterface.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/MenuInterface.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,31 @@
+/*
+ * MenuInterface.hpp
+ *
+ *  Created on: Nov 5, 2010
+ *      Author: heber
+ */
+
+#ifndef MENUINTERFACE_HPP_
+#define MENUINTERFACE_HPP_
+
+#include <string>
+
+/** Defines a common interface to access all menus.
+ * This class offers to to add
+ * -# submenus
+ * -# actions
+ * -# separators
+ * in a uniform way.
+ */
+class MenuInterface
+{
+public:
+  explicit MenuInterface(const std::string &_token);
+  virtual ~MenuInterface();
+
+  virtual void addActionItem(const std::string &token, const std::string &description)=0;
+  virtual void addSeparatorItem()=0;
+  virtual void addSubmenuItem(const std::string &token, const std::string &description)=0;
+};
+
+#endif /* MENUINTERFACE_HPP_ */
Index: src/UIElements/Menu/MenuItem.cpp
===================================================================
--- src/UIElements/Menu/MenuItem.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * MenuItem.cpp
- *
- *  Created on: Dec 10, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Menu/MenuItem.hpp"
-#include "Menu/Menu.hpp"
-#include <sstream>
-#include <iostream>
-
-/**
- * produce a new MenuItem using with a description and a trigger.
- * The MenuItem is then added to the menu passed to it.
- */
-MenuItem::MenuItem(char _trigger, const char* _description,Menu* menu) :
-  trigger(_trigger),
-  added(false)
-{
-  description = new string(_description);
-  add_to_menu(menu);
-}
-
-MenuItem::~MenuItem()
-{
-  delete description;
-}
-
-/**
- * check if the trigger matches and call doTrigger if it does.
- */
-bool MenuItem::checkTrigger(char key) {
-  if(key == trigger) {
-    doTrigger();
-    return true;
-  }
-  else
-    return false;
-
-}
-
-char MenuItem::getTrigger() {
-  return trigger;
-}
-
-const string MenuItem::getDescription() {
-  return *description;
-}
-
-/**
- * Produce a formated output of this item containing trigger and description
- * Normal format is: "<trigger> - <description>"
- */
-const string MenuItem::formatEntry(){
-  stringstream s;
-  s << getTrigger() << " - " << getDescription();
-
-  return s.str();
-}
-
-
-/**
- * check if this item is within a menu and add to menu if it is not yet contained anywhere
- *
- * TODO: include funtionality to move Items from one menu to another
- */
-void MenuItem::add_to_menu(Menu* menu) {
-  if(!wasAdded()) {
-    menu->addItem(this);
-    added=true;
-  }
-}
-
-bool MenuItem::wasAdded(){
-  return added;
-}
-
-bool MenuItem::isActive(){
-  return true;
-}
Index: src/UIElements/Menu/MenuItem.hpp
===================================================================
--- src/UIElements/Menu/MenuItem.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * MenuItem.h
- *
- *  Created on: Dec 10, 2009
- *      Author: crueger
- */
-
-#ifndef MENUITEM_H_
-#define MENUITEM_H_
-
-#include <string>
-
-using namespace std;
-
-class Menu;
-
-/**
- * Base class for all kinds of MenuItems
- *
- * This class takes care of checking the triggers and performing appropriate actions.
- */
-class MenuItem {
-public:
-  MenuItem(char,const char*,Menu*);
-  virtual ~MenuItem();
-
-  virtual void doTrigger()=0;
-  virtual bool checkTrigger(char);
-
-  virtual const string formatEntry();
-
-  virtual const string getDescription();
-  char getTrigger();
-
-  void add_to_menu(Menu*);
-  bool wasAdded();
-
-  virtual bool isActive();
-
-protected:
-  void setDescription(string);
-
-private:
-  char trigger;
-  string *description;
-  bool added;
-};
-
-#endif /* MENUITEM_H_ */
Index: src/UIElements/Menu/Qt4/QtMenu.cpp
===================================================================
--- src/UIElements/Menu/Qt4/QtMenu.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QtMenu.cpp
- *
- *  Created on: Jan 15, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Menu/Qt4/QtMenu.hpp"
-
-#include <Qt/qaction.h>
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Menu/MenuItem.hpp"
-
-QtMenu::QtMenu(const char * _title) :
-  QMenu(_title)
-{}
-
-QtMenu::~QtMenu()
-{
-  // yay... Just like Mario Bros.
-  for(list<QtMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++)
-    delete (*it);
-}
-
-void QtMenu::addItem(MenuItem* item) {
-  const string description = item->getDescription();
-  QAction *action = addAction(QString(description.c_str()));
-  QtMenuPipe *pipe = new QtMenuPipe(item,action);
-  QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called()));
-  plumbing.push_back(pipe);
-}
-
-void QtMenu::removeItem(MenuItem* item) {
-  list<QtMenuPipe*>::iterator iter;
-  for(iter=plumbing.begin(); iter!=plumbing.end(); iter++){
-    delete (*iter);
-  }
-}
-
-void QtMenu::display() {
-
-}
-
-QtMenuPipe::QtMenuPipe(MenuItem *_item, QAction *_action) :
-    theItem(_item), theAction(_action)
-{}
-
-QtMenuPipe::~QtMenuPipe() {
-  delete theAction;
-  delete theItem;
-}
-
-void QtMenuPipe::called() {
-  theItem->doTrigger();
-}
Index: src/UIElements/Menu/Qt4/QtMenu.hpp
===================================================================
--- src/UIElements/Menu/Qt4/QtMenu.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ src/UIElements/Menu/Qt4/QtMenu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -2,49 +2,118 @@
  * QtMenu.hpp
  *
- *  Created on: Jan 15, 2010
- *      Author: crueger
+ *  Created on: Nov 5, 2010
+ *      Author: heber
  */
 
-#ifndef QTMENU_HPP_
-#define QTMENU_HPP_
+#ifndef MENUINTERFACEQT_HPP_
+#define MENUINTERFACEQT_HPP_
 
+#include <Qt/qaction.h>
+
+#include <iostream>
 #include <list>
-
-#include <QtGui/QMenu>
-#include <QtCore/QObject>
+#include <map>
+#include <string>
 
 #include "Menu/Menu.hpp"
+#include "Menu/MenuInterface.hpp"
+#include "Menu/Qt4/QtMenuPipe.hpp"
 
-class QtMenuPipe;
+/** QtMenu is a specialization of MenuInterface to Qt-like menus.
+ * I.e. with this interface we can access QMenu and QMenuBar.
+ * (The latter is the reason why we have to add this additional wrapping layer).
+ */
+template <class T>
+class QtMenu : virtual public MenuInterface, public Menu
+{
+public:
+  explicit QtMenu(const std::string &_token) :
+    MenuInterface(_token),
+    Menu(_token),
+    MenuInstance(new T(QString(getNameWithAccelerator(_token).c_str()))),
+    deleteMenu(true)
+  {}
 
-class QtMenu : public QMenu, public Menu
-{
-  Q_OBJECT
+  QtMenu(T *_Menu, const std::string &_token) :
+    MenuInterface(_token),
+    Menu(_token),
+    MenuInstance(_Menu),
+    deleteMenu(false)
+  {}
 
-public:
-  QtMenu(const char *);
-  virtual ~QtMenu();
+  virtual ~QtMenu()
+  {
+    for(std::list<QtMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++)
+      delete (*it);
 
-  virtual void addItem(MenuItem*);
-  virtual void removeItem(MenuItem*);
-  virtual void display();
+    if (deleteMenu)
+      delete MenuInstance;
+  }
+
+  T * const getMenuInstance()
+  {
+    return MenuInstance;
+  }
+
+protected:
+  // We need to have a reference of the Menu, as Qt returns reference to added menu as well
+  T *MenuInstance;
+
+  /** Puts Qt's token, the ampersand, in front of the accelerator char in the menu name.
+   * \param ActionName Action of menu
+   * \return name with ampersand added at the right place
+   */
+  std::string getNameWithAccelerator(const std::string &ActionName)
+  {
+    std::string newname;
+    bool Inserted = false;
+    std::pair < MenuShortcutMap::iterator, bool > Inserter;
+    for (std::string::const_iterator CharRunner = ActionName.begin();
+        CharRunner != ActionName.end();
+        ++CharRunner) {
+      std::cout << "Current char is " << *CharRunner << std::endl;
+      if (!Inserted) {
+        Inserter = ShortcutMap.insert(
+            std::pair<char, std::string > (*CharRunner, ActionName)
+            );
+        if (Inserter.second) {
+          std::cout << "Accelerator is " << *CharRunner << std::endl;
+          newname += '&';
+          Inserted = true;
+        }
+      }
+      newname += *CharRunner;
+    }
+    return newname;
+  }
+
 private:
-  list<QtMenuPipe*> plumbing;
+  bool deleteMenu;
+  std::list<QtMenuPipe*> plumbing;
+
+  typedef std::map <char, std::string> MenuShortcutMap;
+  MenuShortcutMap ShortcutMap;
+
+  virtual void addActionItem(const std::string &token, const std::string &description)
+  {
+    QAction *action = MenuInstance->addAction(QString(getNameWithAccelerator(description).c_str()));
+    QtMenuPipe *pipe = new QtMenuPipe(token,action);
+    QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called()));
+    plumbing.push_back(pipe);
+  }
+
+  virtual void addSeparatorItem()
+  {
+    MenuInstance->addSeparator();
+  }
+
+  virtual void addSubmenuItem(const std::string &token, const std::string &description)
+  {
+    QMenu *Menu = MenuInstance->addMenu(QString(token.c_str()));
+    QtMenu<QMenu> *NewMenu = new QtMenu<QMenu>(Menu, token);
+    NewMenu->init();
+  }
+
 };
 
-// This handles the plumbing from QT to internal Items
-// Slots from QT are redirected to internal methods.
-// This way methods can be used where no QT is available
-class QtMenuPipe : public QObject {
-  Q_OBJECT
-public:
-  QtMenuPipe(MenuItem*,QAction*);
-  virtual ~QtMenuPipe();
-public slots:
-  void called();
-private:
-  MenuItem *theItem;
-  QAction *theAction;
-};
-
-#endif /* QTMENU_HPP_ */
+#endif /* MENUINTERFACEQT_HPP_ */
Index: src/UIElements/Menu/Qt4/QtMenuPipe.cpp
===================================================================
--- src/UIElements/Menu/Qt4/QtMenuPipe.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/Qt4/QtMenuPipe.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,40 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtMenuPipe.cpp
+ *
+ *  Created on: Nov 5, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Qt/qaction.h>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "QtMenuPipe.hpp"
+
+#include "Actions/ActionRegistry.hpp"
+#include "Actions/Action.hpp"
+
+QtMenuPipe::QtMenuPipe(const std::string &_ActionName, QAction *_action) :
+    ActionName(_ActionName), theAction(_action)
+{}
+
+QtMenuPipe::~QtMenuPipe() {
+  delete theAction;
+}
+
+void QtMenuPipe::called() {
+  Action* action = ActionRegistry::getInstance().getActionByName(ActionName);
+  action->call();
+}
Index: src/UIElements/Menu/Qt4/QtMenuPipe.hpp
===================================================================
--- src/UIElements/Menu/Qt4/QtMenuPipe.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/Qt4/QtMenuPipe.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,32 @@
+/*
+ * QtMenuPipe.hpp
+ *
+ *  Created on: Nov 5, 2010
+ *      Author: heber
+ */
+
+#ifndef QTMENUPIPE_HPP_
+#define QTMENUPIPE_HPP_
+
+#include <QtCore/QObject>
+
+#include <string>
+
+class QAction;
+
+// This handles the plumbing from QT to internal Items
+// Slots from QT are redirected to internal methods.
+// This way methods can be used where no QT is available
+class QtMenuPipe : public QObject {
+  Q_OBJECT
+public:
+  QtMenuPipe(const std::string &,QAction*);
+  virtual ~QtMenuPipe();
+public slots:
+  void called();
+private:
+  const std::string ActionName;
+  QAction *theAction;
+};
+
+#endif /* QTMENUPIPE_HPP_ */
Index: src/UIElements/Menu/SeperatorItem.cpp
===================================================================
--- src/UIElements/Menu/SeperatorItem.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * SeperatorItem.cpp
- *
- *  Created on: Dec 11, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include <string>
-#include <sstream>
-
-#include "Menu/SeperatorItem.hpp"
-#include "Menu/Menu.hpp"
-#include "defs.hpp"
-
-
-SeperatorItem::SeperatorItem(Menu* menu):
-  MenuItem('\0',"",menu),
-  spacer(STD_SEPERATOR_SPACER),
-  length(STD_MENU_LENGTH)
-{
-  // TODO Auto-generated constructor stub
-
-}
-
-SeperatorItem::SeperatorItem(Menu* menu,char _spacer, int _length):
-  MenuItem('\0',"",menu),
-  spacer(_spacer),
-  length(_length)
-{
-  // TODO Auto-generated constructor stub
-
-}
-
-SeperatorItem::~SeperatorItem()
-{
-  // TODO Auto-generated destructor stub
-}
-
-
-void SeperatorItem::doTrigger(){}
-bool SeperatorItem::checkTrigger(char){
-  return false;
-}
-
-const string SeperatorItem::getDescription() {
-  return string("");
-}
-
-const string SeperatorItem::formatEntry(){
-  stringstream s;
-  for(int i=0; i<length;i++)
-    s << spacer;
-  return s.str();
-}
Index: src/UIElements/Menu/SeperatorItem.hpp
===================================================================
--- src/UIElements/Menu/SeperatorItem.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * SeperatorItem.h
- *
- *  Created on: Dec 11, 2009
- *      Author: crueger
- */
-
-#ifndef SEPERATORITEM_H_
-#define SEPERATORITEM_H_
-
-#include "Menu/MenuItem.hpp"
-
-/**
- * Produce a Seperator within a Menu.
- *
- * All triggers are ignored for this Item.
- */
-class SeperatorItem : public MenuItem
-{
-public:
-  SeperatorItem(Menu*);
-  SeperatorItem(Menu*,char,int);
-  virtual ~SeperatorItem();
-
-  virtual void doTrigger();
-  virtual bool checkTrigger(char);
-
-  virtual const string getDescription();
-
-  virtual const string formatEntry();
-private:
-  char spacer;
-  int length;
-};
-
-#endif /* SEPERATORITEM_H_ */
Index: src/UIElements/Menu/SubMenuItem.cpp
===================================================================
--- src/UIElements/Menu/SubMenuItem.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * SubMenuItem.cpp
- *
- *  Created on: Dec 10, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include "SubMenuItem.hpp"
-
-SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _parent, Menu* _theMenu) :
-  MenuItem(_trigger,_description,_parent),
-  theMenu(_theMenu)
-{
-}
-
-SubMenuItem::~SubMenuItem()
-{
-  delete theMenu;
-}
-
-void SubMenuItem::doTrigger() {
-  theMenu->display();
-}
Index: src/UIElements/Menu/SubMenuItem.hpp
===================================================================
--- src/UIElements/Menu/SubMenuItem.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,20 +1,0 @@
-#ifndef SUBMENUITEM_H_
-#define SUBMENUITEM_H_
-
-#include "MenuItem.hpp"
-#include "TextMenu.hpp"
-
-class Menu;
-
-class SubMenuItem : public MenuItem
-{
-public:
-  SubMenuItem(char,const char*,Menu*,Menu*);
-  virtual ~SubMenuItem();
-
-  virtual void doTrigger();
-private:
-  Menu* theMenu;
-};
-
-#endif /* SUBMENUITEM_H_ */
Index: src/UIElements/Menu/TextMenu.cpp
===================================================================
--- src/UIElements/Menu/TextMenu.cpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * TextMenu.cpp
- *
- *  Created on: Dec 10, 2009
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Helpers/MemDebug.hpp"
-
-#include <boost/bind.hpp>
-#include <iostream>
-#include <cmath>
-#include "Menu/TextMenu.hpp"
-#include "Menu/MenuItem.hpp"
-#include "Helpers/Assert.hpp"
-
-
-/**
- * produce a text menu with a given title.
- * The text will later be displayed using the stream passed to the constructor.
- */
-TextMenu::TextMenu(ostream& _outputter, const string _title, char _spacer,int _length) :
-  defaultItem(0),
-  outputter(_outputter),
-  title(_title),
-  spacer(_spacer),
-  length(_length),
-  quit(false)
-{
-}
-
-TextMenu::~TextMenu()
-{
-  for(list<MenuItem*>::iterator it=items.begin(); it != items.end(); it++)
-    delete (*it);
-}
-
-
-void TextMenu::addItem(MenuItem* item) {
-  items.push_back(item);
-}
-
-void TextMenu::removeItem(MenuItem* item) {
-  items.remove(item);
-}
-
-void TextMenu::doQuit(){
-  quit = true;
-}
-
-bool TextMenu::hasQuit(){
-  return quit;
-}
-
-void TextMenu::showEntry(MenuItem* entry){
-  if(entry->isActive()==false){
-    outputter << "(";
-  }
-  outputter << entry->formatEntry();
-  if(entry->isActive()==false){
-    outputter << ")";
-  }
-  outputter << "\n";
-}
-
-void TextMenu::display() {
-  char choice;
-  bool somethingChosen = false;
-  quit = false;
-  do {
-    int pre = floor((length - title.length()) /2.0);
-    int post = ceil((length - title.length()) /2.0);
-    for(int i=0;i<pre;i++)
-      outputter << spacer;
-    outputter << title;
-    for(int i=0;i<post;i++)
-          outputter << spacer;
-    outputter << '\n';
-    for_each(items.begin(), items.end(), boost::bind(&TextMenu::showEntry,this,_1));
-    outputter.flush();
-
-    cin >> choice;
-
-    list<MenuItem*>::iterator iter;
-    for(iter = items.begin(); iter!=items.end();iter++){
-      if((*iter)->isActive()){
-        somethingChosen |= (*iter)->checkTrigger(choice);
-      }
-    }
-    // see if something was chosen and call default Item if not
-    if(!somethingChosen) {
-      if(defaultItem){
-        defaultItem->doTrigger();
-      }
-      else{
-        outputter << "Invalid Choice!" <<  endl;
-      }
-    }
-  }while (!hasQuit());
-}
-
-string TextMenu::getTitle(){
-  return title;
-}
-
-void TextMenu::addDefault(MenuItem* _defaultItem) {
-  defaultItem = _defaultItem;
-}
-
-/****************************** Contained Actions ****************/
-
-TextMenu::LeaveAction::LeaveAction(TextMenu* _menu, const ActionTraits & LeaveActionTrait) :
-  Action(LeaveActionTrait, false),
-  menu(_menu)
-{}
-
-TextMenu::LeaveAction::~LeaveAction(){}
-
-bool TextMenu::LeaveAction::canUndo(){
-  return false;
-}
-
-bool TextMenu::LeaveAction::shouldUndo(){
-  return false;
-}
-
-void TextMenu::LeaveAction::getParametersfromValueStorage()
-{}
-
-Dialog* TextMenu::LeaveAction::fillDialog(Dialog *dialog){
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-  return dialog;
-}
-
-
-Action::state_ptr TextMenu::LeaveAction::performCall(){
-  menu->doQuit();
-  return Action::success;
-}
-
-
-Action::state_ptr TextMenu::LeaveAction::performUndo(Action::state_ptr){
-  ASSERT(0,"Cannot undo leaving a menu");
-  return Action::success;
-}
-
-Action::state_ptr TextMenu::LeaveAction::performRedo(Action::state_ptr){
-  ASSERT(0,"Cannot redo leaving a menu");
-  return Action::success;
-}
Index: src/UIElements/Menu/TextMenu.hpp
===================================================================
--- src/UIElements/Menu/TextMenu.hpp	(revision ffb9ad3ad26c892a8aa0013c675637237728b887)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * TextMenu.h
- *
- *  Created on: Dec 10, 2009
- *      Author: crueger
- */
-
-#ifndef TEXTMENU_H_
-#define TEXTMENU_H_
-
-#include <list>
-#include <iosfwd>
-#include <string>
-
-#include "Menu/Menu.hpp"
-#include "Actions/Action.hpp"
-#include "Actions/ActionTraits.hpp"
-#include "defs.hpp"
-
-class MenuItem;
-
-/**
- * Used to produce any kind of text menu
- *
- * All Items are displayed and user is prompted for a key. The item corresponding to that key is then activated.
- */
-class TextMenu : public Menu
-{
-public:
-  class LeaveAction : public Action {
-  public:
-    LeaveAction(TextMenu*, const ActionTraits &_trait);
-    virtual ~LeaveAction();
-
-    bool canUndo();
-    bool shouldUndo();
-
-  protected:
-    virtual Dialog* fillDialog(Dialog *dialog);
-  private:
-    virtual void getParametersfromValueStorage();
-    virtual Action::state_ptr performCall();
-    virtual Action::state_ptr performUndo(Action::state_ptr);
-    virtual Action::state_ptr performRedo(Action::state_ptr);
-
-    ActionTraits *LeaveActionTrait;
-    TextMenu* menu;
-  };
-
-  TextMenu(ostream& _outputter, const string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
-  virtual ~TextMenu();
-
-  virtual void addItem(MenuItem*);
-  virtual void removeItem(MenuItem*);
-  virtual void display();
-  virtual string getTitle();
-
-  /**
-   * Call doQuit if you want to return from this menu.
-   */
-  virtual void doQuit();
-  /**
-   * Check whether someone has chosen to quit
-   */
-  virtual bool hasQuit();
-
-  virtual void addDefault(MenuItem*);
-
-protected:
-  virtual void showEntry(MenuItem*);
-
-private:
-  list<MenuItem*> items;
-
-  MenuItem* defaultItem;
-
-  ostream& outputter;
-  string title;
-  char spacer;
-  int length;
-
-  bool quit;
-};
-
-#endif /* TEXTMENU_H_ */
Index: src/UIElements/Menu/TextMenu/ActionMenuItem.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/ActionMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/ActionMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,47 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ActionMenuItem.cpp
+ *
+ *  Created on: Dec 11, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <iostream>
+
+#include "Menu/TextMenu/ActionMenuItem.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionRegistry.hpp"
+
+using namespace std;
+
+ActionMenuItem::ActionMenuItem(char _trigger, const std::string &_description,TxMenu* const _menu,const std::string &_ActionName)
+: MenuItem(_trigger,_description,_menu),
+  ActionName(_ActionName)
+{
+}
+
+ActionMenuItem::~ActionMenuItem()
+{}
+
+void ActionMenuItem::doTrigger() {
+  Action* action = ActionRegistry::getInstance().getActionByName(ActionName);
+  action->call();
+}
+
+bool ActionMenuItem::isActive() {
+  Action* action = ActionRegistry::getInstance().getActionByName(ActionName);
+  return action->isActive();
+}
Index: src/UIElements/Menu/TextMenu/ActionMenuItem.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/ActionMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/ActionMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,35 @@
+/*
+ * ActionMenuItem.h
+ *
+ *  Created on: Dec 11, 2009
+ *      Author: crueger
+ */
+
+#ifndef ACTIONMENUITEM_H_
+#define ACTIONMENUITEM_H_
+
+#include <string>
+
+#include "Menu/TextMenu/MenuItem.hpp"
+
+class Action;
+class TxMenu;
+
+/**
+ * Produce MenuItems that take an appropriate action when called.
+ */
+class ActionMenuItem : public MenuItem
+{
+public:
+  ActionMenuItem(char,const std::string &,TxMenu* const,const std::string &);
+  virtual ~ActionMenuItem();
+
+  virtual void doTrigger();
+
+  virtual bool isActive();
+
+private:
+  const std::string ActionName; //!< this action will be called when the trigger matches
+};
+
+#endif /* ACTIONMENUITEM_H_ */
Index: src/UIElements/Menu/TextMenu/DisplayMenuItem.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/DisplayMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/DisplayMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,73 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * DisplayMenuItem.cpp
+ *
+ *  Created on: Dec 14, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <sstream>
+#include <cmath>
+
+#include "Menu/TextMenu/DisplayMenuItem.hpp"
+#include "Views/StringView.hpp"
+
+
+DisplayMenuItem::DisplayMenuItem(TxMenu* const _menu, StringView *_view):
+  MenuItem('\0',"",_menu),
+  view(_view),
+  title("")
+{
+}
+
+DisplayMenuItem::DisplayMenuItem(TxMenu* const _menu, StringView *_view, const std::string &_title, char _spacer, int _length ):
+  MenuItem('\0',"",_menu),
+  view(_view),
+  title(_title),
+  length(_length),
+  spacer(_spacer)
+{
+}
+
+DisplayMenuItem::~DisplayMenuItem()
+{}
+
+
+void DisplayMenuItem::doTrigger(){}
+bool DisplayMenuItem::checkTrigger(char c){
+  return false;
+}
+
+const std::string DisplayMenuItem::formatEntry(){
+  std::stringstream s;
+  if(title.length()>0) {
+    int pre = floor((length-title.length())/2.0);
+    int post = ceil((length-title.length())/2.0);
+    for(int i=0;i<pre;i++)
+      s << spacer;
+    s << title;
+    for(int i=0;i<post;i++)
+          s << spacer;
+    s << "\n";
+  }
+  s << view->toString();
+  return s.str();
+}
+
+
+const std::string DisplayMenuItem::getDescription(){
+  return std::string("");
+}
Index: src/UIElements/Menu/TextMenu/DisplayMenuItem.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/DisplayMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/DisplayMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,46 @@
+/*
+ * DisplayMenuItem.hpp
+ *
+ *  Created on: Dec 14, 2009
+ *      Author: crueger
+ */
+
+#ifndef DISPLAYMENUITEM_HPP_
+#define DISPLAYMENUITEM_HPP_
+
+#include <string>
+
+#include "Menu/TextMenu/MenuItem.hpp"
+#include "defs.hpp"
+
+class StringView;
+class TxMenu;
+
+/**
+ * Display any kind of StringView within a Menu
+ *
+ * Any trigger are ignored for this type of Item
+ */
+class DisplayMenuItem : public MenuItem
+{
+public:
+  DisplayMenuItem(TxMenu* const _menu, StringView *_view);
+  DisplayMenuItem(TxMenu* const _menu, StringView *_view, const std::string &_title,
+                  char _spacer=STD_MENU_TITLE_SPACER, int _length=STD_MENU_LENGTH);
+  virtual ~DisplayMenuItem();
+
+  virtual void doTrigger();
+  virtual bool checkTrigger(char);
+
+  virtual const std::string formatEntry();
+
+  virtual const std::string getDescription();
+
+private:
+  StringView *view;
+  std::string title;
+  int length;
+  char spacer;
+};
+
+#endif /* DISPLAYMENUITEM_HPP_ */
Index: src/UIElements/Menu/TextMenu/MenuItem.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/MenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/MenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,93 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * MenuItem.cpp
+ *
+ *  Created on: Dec 10, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Menu/TextMenu/MenuItem.hpp"
+#include "Menu/TextMenu/TxMenu.hpp"
+#include "Menu/Menu.hpp"
+#include <sstream>
+
+/**
+ * produce a new MenuItem using with a description and a trigger.
+ * The MenuItem is then added to the menu passed to it.
+ */
+MenuItem::MenuItem(char _trigger, const std::string &_description,TxMenu* const menu) :
+  trigger(_trigger),
+  description(_description),
+  added(false)
+{
+  add_to_menu(menu);
+}
+
+MenuItem::~MenuItem()
+{}
+
+/**
+ * check if the trigger matches and call doTrigger if it does.
+ */
+bool MenuItem::checkTrigger(char key) {
+  if(key == trigger) {
+    doTrigger();
+    return true;
+  }
+  else
+    return false;
+
+}
+
+char MenuItem::getTrigger() {
+  return trigger;
+}
+
+const std::string MenuItem::getDescription() {
+  return description;
+}
+
+/**
+ * Produce a formated output of this item containing trigger and description
+ * Normal format is: "<trigger> - <description>"
+ */
+const std::string MenuItem::formatEntry(){
+  std::stringstream s;
+  s << getTrigger() << " - " << getDescription();
+
+  return s.str();
+}
+
+
+/**
+ * check if this item is within a menu and add to menu if it is not yet contained anywhere
+ *
+ * TODO: include funtionality to move Items from one menu to another
+ */
+void MenuItem::add_to_menu(TxMenu* const menu) {
+  if(!wasAdded()) {
+    menu->addItem(this);
+    added=true;
+  }
+}
+
+bool MenuItem::wasAdded(){
+  return added;
+}
+
+bool MenuItem::isActive(){
+  return true;
+}
Index: src/UIElements/Menu/TextMenu/MenuItem.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/MenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/MenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,44 @@
+/*
+ * MenuItem.h
+ *
+ *  Created on: Dec 10, 2009
+ *      Author: crueger
+ */
+
+#ifndef MENUITEM_H_
+#define MENUITEM_H_
+
+#include <string>
+
+class TxMenu;
+
+/**
+ * Base class for all kinds of MenuItems
+ *
+ * This class takes care of checking the triggers and performing appropriate actions.
+ */
+class MenuItem {
+public:
+  MenuItem(char,const std::string &,TxMenu* const);
+  virtual ~MenuItem();
+
+  virtual void doTrigger()=0;
+  virtual bool checkTrigger(char);
+
+  virtual const std::string formatEntry();
+
+  virtual const std::string getDescription();
+  char getTrigger();
+
+  void add_to_menu(TxMenu* const);
+  bool wasAdded();
+
+  virtual bool isActive();
+
+private:
+  char trigger;
+  const std::string description;
+  bool added;
+};
+
+#endif /* MENUITEM_H_ */
Index: src/UIElements/Menu/TextMenu/SeperatorItem.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/SeperatorItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/SeperatorItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,67 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * SeperatorItem.cpp
+ *
+ *  Created on: Dec 11, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <string>
+#include <sstream>
+
+#include "Menu/TextMenu/SeperatorItem.hpp"
+#include "defs.hpp"
+
+
+SeperatorItem::SeperatorItem(TxMenu* const menu):
+  MenuItem('\0',"",menu),
+  spacer(STD_SEPERATOR_SPACER),
+  length(STD_MENU_LENGTH)
+{
+  // TODO Auto-generated constructor stub
+
+}
+
+SeperatorItem::SeperatorItem(TxMenu* const menu,char _spacer, int _length):
+  MenuItem('\0',"",menu),
+  spacer(_spacer),
+  length(_length)
+{
+  // TODO Auto-generated constructor stub
+
+}
+
+SeperatorItem::~SeperatorItem()
+{
+  // TODO Auto-generated destructor stub
+}
+
+
+void SeperatorItem::doTrigger(){}
+bool SeperatorItem::checkTrigger(char){
+  return false;
+}
+
+const std::string SeperatorItem::getDescription() {
+  return std::string("");
+}
+
+const std::string SeperatorItem::formatEntry(){
+  std::stringstream s;
+  for(int i=0; i<length;i++)
+    s << spacer;
+  return s.str();
+}
Index: src/UIElements/Menu/TextMenu/SeperatorItem.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/SeperatorItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/SeperatorItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,40 @@
+/*
+ * SeperatorItem.h
+ *
+ *  Created on: Dec 11, 2009
+ *      Author: crueger
+ */
+
+#ifndef SEPERATORITEM_H_
+#define SEPERATORITEM_H_
+
+#include <string>
+
+#include "Menu/TextMenu/MenuItem.hpp"
+
+class TxMenu;
+
+/**
+ * Produce a Seperator within a Menu.
+ *
+ * All triggers are ignored for this Item.
+ */
+class SeperatorItem : public MenuItem
+{
+public:
+  SeperatorItem(TxMenu* const );
+  SeperatorItem(TxMenu* const ,char,int);
+  virtual ~SeperatorItem();
+
+  virtual void doTrigger();
+  virtual bool checkTrigger(char);
+
+  virtual const std::string getDescription();
+
+  virtual const std::string formatEntry();
+private:
+  char spacer;
+  int length;
+};
+
+#endif /* SEPERATORITEM_H_ */
Index: src/UIElements/Menu/TextMenu/SubMenuItem.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/SubMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/SubMenuItem.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,37 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * SubMenuItem.cpp
+ *
+ *  Created on: Dec 10, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <iostream>
+
+#include "Menu/TextMenu/SubMenuItem.hpp"
+#include "Menu/TextMenu/TxMenu.hpp"
+
+SubMenuItem::SubMenuItem(char _trigger,const std::string &_description,TxMenu* const _parent, TxMenu* const _instance) :
+  MenuItem(_trigger,_description,_parent),
+  theMenu(_instance)
+{}
+
+SubMenuItem::~SubMenuItem()
+{}
+
+void SubMenuItem::doTrigger() {
+  theMenu->display();
+}
Index: src/UIElements/Menu/TextMenu/SubMenuItem.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/SubMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/SubMenuItem.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,21 @@
+#ifndef SUBMENUITEM_H_
+#define SUBMENUITEM_H_
+
+#include "Menu/TextMenu/MenuItem.hpp"
+
+#include <iosfwd>
+
+class TxMenu;
+
+class SubMenuItem : public MenuItem
+{
+public:
+  SubMenuItem(char _trigger,const std::string &_description,TxMenu* const _parent, TxMenu* const _instance);
+  virtual ~SubMenuItem();
+
+  virtual void doTrigger();
+private:
+  TxMenu* theMenu;
+};
+
+#endif /* SUBMENUITEM_H_ */
Index: src/UIElements/Menu/TextMenu/TextMenu.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/TextMenu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/TextMenu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,128 @@
+/*
+ * TextMenu.hpp
+ *
+ *  Created on: Nov 5, 2010
+ *      Author: heber
+ */
+
+#ifndef TEXTMENU_HPP_
+#define TEXTMENU_HPP_
+
+#include <map>
+#include <string>
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Menu/Menu.hpp"
+#include "Menu/MenuInterface.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Actions/ActionTraits.hpp"
+#include "Menu/TextMenu/TxMenu.hpp"
+#include "Menu/TextMenu/ActionMenuItem.hpp"
+#include "Menu/TextMenu/SeperatorItem.hpp"
+#include "Menu/TextMenu/SubMenuItem.hpp"
+
+/** TextMenu is a specialization of MenuInterface to access TxMenu-like menus.
+ * \sa QtMenu.
+ */
+template <class T>
+class TextMenu : virtual public MenuInterface, public Menu
+{
+public:
+  TextMenu(std::ostream &_outputter, const std::string &_token) :
+    MenuInterface(_token),
+    Menu(_token),
+    MenuInstance(new T(_outputter, _token)),
+    outputter(_outputter),
+    deleteMenu(true)
+  {}
+
+  explicit TextMenu(T *_MenuInstance) :
+    Menu(_MenuInstance->getTitle()),
+    MenuInstance(_MenuInstance),
+    outputter(_MenuInstance->getOutputter()),
+    deleteMenu(false)
+  {}
+
+  virtual ~TextMenu()
+  {
+    if (deleteMenu)
+      delete MenuInstance;
+  }
+
+  void display()
+  {
+    MenuInstance->display();
+  }
+
+  T * const getMenuInstance()
+  {
+    return MenuInstance;
+  }
+
+  void reserveShortcut(char trigger, const std::string &name)
+  {
+    ShortcutMap.insert( std::pair < char, std::string> (trigger, name) );
+  }
+
+protected:
+  // We need to have a reference of the Menu, as Qt returns reference to added menu as well
+  T *MenuInstance;
+  std::ostream &outputter;
+
+private:
+  bool deleteMenu;
+
+  typedef std::map <char, std::string> MenuShortcutMap;
+  MenuShortcutMap ShortcutMap;
+
+  virtual void addActionItem(const std::string &token, const std::string &description)
+  {
+    new ActionMenuItem(getSuitableShortForm(description), description, MenuInstance, token);
+  }
+
+  virtual void addSeparatorItem()
+  {
+    new SeperatorItem(MenuInstance);
+  }
+
+  virtual void addSubmenuItem(const std::string &token, const std::string &description)
+  {
+    TextMenu<TxMenu> *NewMenu = new TextMenu<TxMenu>(outputter, token);
+    new SubMenuItem(getSuitableShortForm(description), description, MenuInstance, NewMenu->getMenuInstance());
+    NewMenu->reserveShortcut('q',"leave"+token);
+    ActionTraits leaveTrait(
+        OptionTrait("leave"+token, &typeid(void), "leave menu "+token),
+        token,
+        ActionRegistry::getInstance().getLastPosition(token)+2); // have a separator in between
+    new TxMenu::LeaveAction(NewMenu->getMenuInstance(), leaveTrait);
+    NewMenu->init();
+    new ActionMenuItem('q',"leave"+token,NewMenu->getMenuInstance(),"leave"+token);
+  }
+
+  char getSuitableShortForm(const std::string &name)
+  {
+    for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
+      if (ShortcutMap.find(*CharRunner) == ShortcutMap.end()) {
+        ShortcutMap.insert( std::pair < char, std::string> (*CharRunner, name) );
+        return *CharRunner;
+      }
+    }
+    // if no letter matches, take digits
+    int i=0;
+    for (;i<10;++i) {
+      if (ShortcutMap.find((char)i + '0') == ShortcutMap.end())
+        break;
+    }
+    if (i != 10) {
+      ShortcutMap.insert( std::pair < char, std::string > ((char)i + '0', name));
+      return ((char)i + '0');
+    } else {
+      DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for " << name << "." << endl);
+      return '#';
+    }
+  }
+};
+
+#endif /* TEXTMENU_HPP_ */
Index: src/UIElements/Menu/TextMenu/TxMenu.cpp
===================================================================
--- src/UIElements/Menu/TextMenu/TxMenu.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/TxMenu.cpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,170 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * TxMenu.cpp
+ *
+ *  Created on: Dec 10, 2009
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <boost/bind.hpp>
+#include <algorithm>
+#include <iostream>
+#include <cmath>
+#include "Actions/Action.hpp"
+#include "Actions/ActionTraits.hpp"
+#include "Menu/TextMenu/TxMenu.hpp"
+#include "Menu/TextMenu/MenuItem.hpp"
+#include "Helpers/Assert.hpp"
+
+
+/**
+ * produce a text menu with a given title.
+ * The text will later be displayed using the stream passed to the constructor.
+ */
+TxMenu::TxMenu(std::ostream& _outputter, const std::string _title, char _spacer,int _length) :
+  defaultItem(0),
+  outputter(_outputter),
+  title(_title),
+  spacer(_spacer),
+  length(_length),
+  quit(false)
+{
+}
+
+TxMenu::~TxMenu()
+{
+  for(std::list<MenuItem*>::iterator it=items.begin(); it != items.end(); it++)
+    delete (*it);
+}
+
+void TxMenu::addItem(MenuItem* item) {
+  items.push_back(item);
+}
+
+void TxMenu::removeItem(MenuItem* item) {
+  items.remove(item);
+}
+
+void TxMenu::doQuit(){
+  quit = true;
+}
+
+bool TxMenu::hasQuit(){
+  return quit;
+}
+
+void TxMenu::showEntry(MenuItem* entry){
+  if(entry->isActive()==false){
+    outputter << "(";
+  }
+  outputter << entry->formatEntry();
+  if(entry->isActive()==false){
+    outputter << ")";
+  }
+  outputter << "\n";
+}
+
+void TxMenu::display() {
+  char choice;
+  bool somethingChosen = false;
+  quit = false;
+  do {
+    int pre = floor((length - title.length()) /2.0);
+    int post = ceil((length - title.length()) /2.0);
+    for(int i=0;i<pre;i++)
+      outputter << spacer;
+    outputter << title;
+    for(int i=0;i<post;i++)
+          outputter << spacer;
+    outputter << '\n';
+    for_each(items.begin(), items.end(), boost::bind(&TxMenu::showEntry,this,_1));
+    outputter.flush();
+
+    std::cin >> choice;
+
+    std::list<MenuItem*>::iterator iter;
+    for(iter = items.begin(); iter!=items.end();iter++){
+      if((*iter)->isActive()){
+        somethingChosen |= (*iter)->checkTrigger(choice);
+      }
+    }
+    // see if something was chosen and call default Item if not
+    if(!somethingChosen) {
+      if(defaultItem){
+        defaultItem->doTrigger();
+      }
+      else{
+        outputter << "Invalid Choice!" <<  std::endl;
+      }
+    }
+  }while (!hasQuit());
+}
+
+std::string TxMenu::getTitle(){
+  return title;
+}
+
+std::ostream& TxMenu::getOutputter()
+{
+  return outputter;
+}
+
+
+void TxMenu::addDefault(MenuItem* _defaultItem) {
+  defaultItem = _defaultItem;
+}
+
+/****************************** Contained Actions ****************/
+
+TxMenu::LeaveAction::LeaveAction(TxMenu* const _menu, const ActionTraits & LeaveActionTrait) :
+  Action(LeaveActionTrait, true),
+  menu(_menu)
+{}
+
+TxMenu::LeaveAction::~LeaveAction(){}
+
+bool TxMenu::LeaveAction::canUndo(){
+  return false;
+}
+
+bool TxMenu::LeaveAction::shouldUndo(){
+  return false;
+}
+
+void TxMenu::LeaveAction::getParametersfromValueStorage()
+{}
+
+Dialog* TxMenu::LeaveAction::fillDialog(Dialog *dialog){
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+  return dialog;
+}
+
+
+Action::state_ptr TxMenu::LeaveAction::performCall(){
+  menu->doQuit();
+  return Action::success;
+}
+
+
+Action::state_ptr TxMenu::LeaveAction::performUndo(Action::state_ptr){
+  ASSERT(0,"Cannot undo leaving a menu");
+  return Action::success;
+}
+
+Action::state_ptr TxMenu::LeaveAction::performRedo(Action::state_ptr){
+  ASSERT(0,"Cannot redo leaving a menu");
+  return Action::success;
+}
Index: src/UIElements/Menu/TextMenu/TxMenu.hpp
===================================================================
--- src/UIElements/Menu/TextMenu/TxMenu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
+++ src/UIElements/Menu/TextMenu/TxMenu.hpp	(revision b59da6e8dbaa0c9c1ed4e190d2b7cd4ccec6152a)
@@ -0,0 +1,86 @@
+/*
+ * TxMenu.h
+ *
+ *  Created on: Dec 10, 2009
+ *      Author: crueger
+ */
+
+#ifndef TXMENU_H_
+#define TXMENU_H_
+
+#include <list>
+#include <iosfwd>
+#include <string>
+
+#include "Menu/Menu.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionTraits.hpp"
+#include "defs.hpp"
+
+class MenuItem;
+
+/**
+ * Used to produce any kind of text menu
+ *
+ * All Items are displayed and user is prompted for a key. The item corresponding to that key is then activated.
+ */
+class TxMenu
+{
+public:
+  class LeaveAction : public Action {
+  public:
+    LeaveAction(TxMenu* const, const ActionTraits &_trait);
+    virtual ~LeaveAction();
+
+    bool canUndo();
+    bool shouldUndo();
+
+  protected:
+    virtual Dialog* fillDialog(Dialog *dialog);
+  private:
+    virtual void getParametersfromValueStorage();
+    virtual Action::state_ptr performCall();
+    virtual Action::state_ptr performUndo(Action::state_ptr);
+    virtual Action::state_ptr performRedo(Action::state_ptr);
+
+    TxMenu* const menu;
+  };
+
+  TxMenu(std::ostream& _outputter, const std::string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
+  virtual ~TxMenu();
+
+  void addItem(MenuItem*);
+  void removeItem(MenuItem*);
+  void display();
+  std::string getTitle();
+  std::ostream& getOutputter();
+  char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
+
+  /**
+   * Call doQuit if you want to return from this menu.
+   */
+  void doQuit();
+  /**
+   * Check whether someone has chosen to quit
+   */
+  bool hasQuit();
+
+  void addDefault(MenuItem*);
+
+protected:
+  void showEntry(MenuItem*);
+
+private:
+  std::list<MenuItem*> items;
+
+  MenuItem* defaultItem;
+
+  std::ostream& outputter;
+  std::string title;
+  char spacer;
+  int length;
+
+  bool quit;
+};
+
+#endif /* TXMENU_H_ */
