Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5640 was 5344, checked in by bensch, 19 years ago

orxonox/trunk: new Way to load and unload Text

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