Ignore:
Timestamp:
Mar 25, 2010, 12:01:27 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
c3294f, fe3540
Parents:
521e29
git-author:
Tillmann Crueger <crueger@…> (03/25/10 11:59:56)
git-committer:
Tillmann Crueger <crueger@…> (03/25/10 12:01:27)
Message:

Added full undo functioniality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Menu/TextMenu.cpp

    r521e29 r8d9984  
    1111#include "Menu/TextMenu.hpp"
    1212#include "Menu/MenuItem.hpp"
     13#include "Helpers/Assert.hpp"
    1314
    1415
     
    8889}
    8990
     91string TextMenu::getTitle(){
     92  return title;
     93}
     94
    9095void TextMenu::addDefault(MenuItem* _defaultItem) {
    9196  defaultItem = _defaultItem;
    9297}
     98
     99/****************************** Contained Actions ****************/
     100
     101const string TextMenu::LeaveAction::nameBase = "Leave menu: ";
     102
     103TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) :
     104Action(nameBase+_menu->getTitle()),
     105menu(_menu)
     106{}
     107
     108TextMenu::LeaveAction::~LeaveAction(){}
     109
     110bool TextMenu::LeaveAction::canUndo(){
     111  return false;
     112}
     113
     114bool TextMenu::LeaveAction::shouldUndo(){
     115  return false;
     116}
     117
     118Action::state_ptr TextMenu::LeaveAction::performCall(){
     119  menu->doQuit();
     120  return Action::success;
     121}
     122
     123
     124Action::state_ptr TextMenu::LeaveAction::performUndo(Action::state_ptr){
     125  ASSERT(0,"Cannot undo leaving a menu");
     126  return Action::success;
     127}
     128
     129Action::state_ptr TextMenu::LeaveAction::performRedo(Action::state_ptr){
     130  ASSERT(0,"Cannot redo leaving a menu");
     131  return Action::success;
     132}
Note: See TracChangeset for help on using the changeset viewer.