1 /* 2 Vimpc 3 Copyright (C) 2010 Nathan Sweetman 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 mode.hpp - abstract class for all modes 19 */ 20 21 #ifndef __UI__MODE 22 #define __UI__MODE 23 24 namespace Ui 25 { 26 class Mode 27 { 28 public: 29 virtual ~Mode() { } 30 31 public: 32 //! Called whenever the mode is initialised 33 //! 34 //! \param input The input that caused the mode change 35 virtual void Initialise(int input) = 0; 36 37 //! Called whenever a mode is going to be canceled/completed 38 //! 39 //! \param input The input that caused the mode change 40 virtual void Finalise(int input) = 0; 41 42 //! Called when the screen requires refreshing, which 43 //! may require a change to the mode 44 virtual void Refresh() = 0; 45 46 //! Handles the given input 47 //! 48 //! \param input Single character input to handle 49 virtual bool Handle(int input) = 0; 50 51 //! Determines whether the given input will cause a switch 52 //! to this mode 53 //! 54 //! \param input input to check for a mode change 55 virtual bool CausesModeToStart(int input) const = 0; 56 virtual bool CausesModeToEnd(int input) const = 0; 57 }; 58 } 59 60 #endif 61 /* vim: set sw=3 ts=3: */ 62