Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_input.h @ 5247

Last change on this file since 5247 was 5245, checked in by bensch, 19 years ago

orxonox/trunk: autoCompletion now gives a very nice output

File size: 2.3 KB
Line 
1/*!
2 * @file shell_input.h
3 * @brief Shell Input is an InputLine for the Shell.
4*/
5
6#ifndef _SHELL_INPUT_H
7#define _SHELL_INPUT_H
8
9#include "text_engine.h"
10#include "event_listener.h"
11
12// FORWARD DECLARATION
13template<class T> class tList;
14template<class T> class tIterator;
15class ShellCompletion;
16
17//! An InputLine for the Shell
18/**
19 * The ShellInput has the ability to catch and display user input.
20 * The ShellInput is auto-completed after the user presses [TAB]
21 * The ShellInput is executed (and sent back to the Application) on Pressing [ENTER]
22 * [UP] and [DOWN] move through the history of allready given commands.
23 */
24class ShellInput : public Text,  public EventListener {
25
26 public:
27  ShellInput();
28  virtual ~ShellInput();
29
30  /** @returns the inputLine */
31  const char* getInput() const { return this->inputLine; };
32
33  // InputLine
34  void flush();
35  void setInputText(const char* text);
36  void addCharacter(char character);
37  void addCharacters(const char* characters);
38  void removeCharacters(unsigned int characterCount = 1);
39  void setRepeatDelay(float repeatDelay, float repeatRate);
40  bool executeCommand();
41
42  /** sets the count of the History's entries */
43  void setHistoryLength(unsigned int historyLength) { this->historyLength = historyLength; };
44  void historyMoveUp();
45  void historyMoveDown();
46
47  void help(const char* className = "", const char* function = "");
48
49  virtual void tick(float dt);
50  virtual void process(const Event &event);
51
52 private:
53    // HANDLING TEXT INPUT
54   ShellCompletion*         completion;             //!< The Completion Interface.
55
56   char*                    inputLine;              //!< the Char-Array of the Buffer
57   float                    repeatRate;             //!< The Repeat-Delay.
58   float                    repeatDelay;            //!< The delay of the first Character of a given Character.
59   float                    delayed;                //!< how much of the delay is remaining.
60   int                      pressedKey;             //!< the pressed key that will be repeated.
61
62   tList<char>*             history;                //!< The history of given commands.
63   tIterator<char>*         historyIT;
64   unsigned int             historyLength;          //!< The maximum length of the InputHistory.
65   bool                     historyScrolling;       //!< true if we are scrolling through the history.
66};
67
68#endif /* _SHELL_INPUT_H */
Note: See TracBrowser for help on using the repository browser.