| 1 | /*! |
|---|
| 2 | * @file shell_input.h |
|---|
| 3 | * @brief Definition of ... |
|---|
| 4 | * @todo AutoCompletion should print nice output |
|---|
| 5 | * @todo move up and down in Buffer |
|---|
| 6 | * @todo display old shell Commands |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | #ifndef _SHELL_INPUT_H |
|---|
| 10 | #define _SHELL_INPUT_H |
|---|
| 11 | |
|---|
| 12 | #include "text_engine.h" |
|---|
| 13 | #include "event_listener.h" |
|---|
| 14 | |
|---|
| 15 | // FORWARD DECLARATION |
|---|
| 16 | template<class T> class tList; |
|---|
| 17 | class ShellCompletion; |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | //! A class for ... |
|---|
| 21 | class ShellInput : public Text, public EventListener { |
|---|
| 22 | |
|---|
| 23 | public: |
|---|
| 24 | ShellInput(); |
|---|
| 25 | virtual ~ShellInput(); |
|---|
| 26 | |
|---|
| 27 | /** @returns the inputLine */ |
|---|
| 28 | const char* getInput() const { return this->inputLine; }; |
|---|
| 29 | |
|---|
| 30 | // InputLine |
|---|
| 31 | void flush(); |
|---|
| 32 | void addCharacter(char character); |
|---|
| 33 | void addCharacters(const char* characters); |
|---|
| 34 | void removeCharacters(unsigned int characterCount = 1); |
|---|
| 35 | void setRepeatDelay(float repeatDelay, float repeatRate); |
|---|
| 36 | bool executeCommand(); |
|---|
| 37 | void help(const char* className = "", const char* function = ""); |
|---|
| 38 | |
|---|
| 39 | virtual void tick(float dt); |
|---|
| 40 | virtual void process(const Event &event); |
|---|
| 41 | |
|---|
| 42 | private: |
|---|
| 43 | // HANDLING TEXT INPUT |
|---|
| 44 | ShellCompletion* completion; //!< The Completion Interface. |
|---|
| 45 | |
|---|
| 46 | char* inputLine; //!< the Char-Array of the Buffer @todo not needed anymore |
|---|
| 47 | float repeatRate; //!< The Repeat-Delay. |
|---|
| 48 | float repeatDelay; //!< The delay of the first Character of a given Character. |
|---|
| 49 | float delayed; //!< how much of the delay is remaining. |
|---|
| 50 | int pressedKey; //!< the pressed key that will be repeated. |
|---|
| 51 | |
|---|
| 52 | tList<char>* inputHistory; //!< The history of given commands. |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | #endif /* _SHELL_INPUT_H */ |
|---|