/* * TxMenuLeaveAction.hpp * * Created on: Nov 8, 2010 * Author: heber */ #ifndef TXMENULEAVEACTION_HPP_ #define TXMENULEAVEACTION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Menu/TextMenu/TxMenu.hpp" #include "Actions/Action.hpp" #include "Actions/ActionTrait.hpp" /** This specific action is used to leave a submenu and return to an upper one. * It differs from other Action's (and thus cannot be put into the usual * structure) that we have to store the reference to the menu it belongs to. * There, we call the doQuit() member function on performCall(). */ class TxMenu::LeaveAction : public MoleCuilder::Action { public: LeaveAction(TxMenu* const, const MoleCuilder::ActionTrait &_trait); virtual ~LeaveAction(); bool canUndo(); bool shouldUndo(); Action* clone(enum QueryOptions flag = Interactive) const; void outputAsCLI(std::ostream &ost) const; void outputAsPython(std::ostream &ost, const std::string &prefix) const; void setOptionValue(const std::string &_token, const std::string &_value); protected: virtual Dialog* fillDialog(Dialog *dialog); private: virtual MoleCuilder::ActionState::ptr performCall(); virtual MoleCuilder::ActionState::ptr performUndo(MoleCuilder::ActionState::ptr); virtual MoleCuilder::ActionState::ptr performRedo(MoleCuilder::ActionState::ptr); TxMenu* const menu; }; #endif /* TXMENULEAVEACTION_HPP_ */