Changes in src/Menu/TextMenu.cpp [24a5e0:f9352d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Menu/TextMenu.cpp
r24a5e0 rf9352d 11 11 #include "Menu/TextMenu.hpp" 12 12 #include "Menu/MenuItem.hpp" 13 #include "Helpers/Assert.hpp" 13 14 14 15 … … 51 52 52 53 void 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"; 54 62 } 55 63 … … 74 82 list<MenuItem*>::iterator iter; 75 83 for(iter = items.begin(); iter!=items.end();iter++){ 76 somethingChosen |= (*iter)->checkTrigger(choice); 84 if((*iter)->isActive()){ 85 somethingChosen |= (*iter)->checkTrigger(choice); 86 } 77 87 } 78 88 // see if something was chosen and call default Item if not … … 88 98 } 89 99 100 string TextMenu::getTitle(){ 101 return title; 102 } 103 90 104 void TextMenu::addDefault(MenuItem* _defaultItem) { 91 105 defaultItem = _defaultItem; 92 106 } 107 108 /****************************** Contained Actions ****************/ 109 110 const string TextMenu::LeaveAction::nameBase = "Leave menu: "; 111 112 TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) : 113 Action(nameBase+_menu->getTitle()), 114 menu(_menu) 115 {} 116 117 TextMenu::LeaveAction::~LeaveAction(){} 118 119 bool TextMenu::LeaveAction::canUndo(){ 120 return false; 121 } 122 123 bool TextMenu::LeaveAction::shouldUndo(){ 124 return false; 125 } 126 127 Action::state_ptr TextMenu::LeaveAction::performCall(){ 128 menu->doQuit(); 129 return Action::success; 130 } 131 132 133 Action::state_ptr TextMenu::LeaveAction::performUndo(Action::state_ptr){ 134 ASSERT(0,"Cannot undo leaving a menu"); 135 return Action::success; 136 } 137 138 Action::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.