Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Menu/TextMenu.cpp

    r24a5e0 rf9352d  
    1111#include "Menu/TextMenu.hpp"
    1212#include "Menu/MenuItem.hpp"
     13#include "Helpers/Assert.hpp"
    1314
    1415
     
    5152
    5253void TextMenu::showEntry(MenuItem* entry){
    53   outputter << entry->formatEntry() << "\n";
     54  if(entry->isActive()==false){
     55    outputter << "(";
     56  }
     57  outputter << entry->formatEntry();
     58  if(entry->isActive()==false){
     59    outputter << ")";
     60  }
     61  outputter << "\n";
    5462}
    5563
     
    7482    list<MenuItem*>::iterator iter;
    7583    for(iter = items.begin(); iter!=items.end();iter++){
    76       somethingChosen |= (*iter)->checkTrigger(choice);
     84      if((*iter)->isActive()){
     85        somethingChosen |= (*iter)->checkTrigger(choice);
     86      }
    7787    }
    7888    // see if something was chosen and call default Item if not
     
    8898}
    8999
     100string TextMenu::getTitle(){
     101  return title;
     102}
     103
    90104void TextMenu::addDefault(MenuItem* _defaultItem) {
    91105  defaultItem = _defaultItem;
    92106}
     107
     108/****************************** Contained Actions ****************/
     109
     110const string TextMenu::LeaveAction::nameBase = "Leave menu: ";
     111
     112TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) :
     113Action(nameBase+_menu->getTitle()),
     114menu(_menu)
     115{}
     116
     117TextMenu::LeaveAction::~LeaveAction(){}
     118
     119bool TextMenu::LeaveAction::canUndo(){
     120  return false;
     121}
     122
     123bool TextMenu::LeaveAction::shouldUndo(){
     124  return false;
     125}
     126
     127Action::state_ptr TextMenu::LeaveAction::performCall(){
     128  menu->doQuit();
     129  return Action::success;
     130}
     131
     132
     133Action::state_ptr TextMenu::LeaveAction::performUndo(Action::state_ptr){
     134  ASSERT(0,"Cannot undo leaving a menu");
     135  return Action::success;
     136}
     137
     138Action::state_ptr TextMenu::LeaveAction::performRedo(Action::state_ptr){
     139  ASSERT(0,"Cannot redo leaving a menu");
     140  return Action::success;
     141}
Note: See TracChangeset for help on using the changeset viewer.