Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/shared_lib/src/lib/shell/shell_input.h @ 7616

Last change on this file since 7616 was 7221, checked in by bensch, 19 years ago

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

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