Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7235 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
RevLine 
[4838]1/*!
[5178]2 * @file shell_input.h
[5245]3 * @brief Shell Input is an InputLine for the Shell.
[5254]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)
[3245]7*/
[1853]8
[5178]9#ifndef _SHELL_INPUT_H
10#define _SHELL_INPUT_H
[1853]11
[5344]12#include "text.h"
[5180]13#include "event_listener.h"
[5784]14#include <list>
[5179]15
[4838]16// FORWARD DECLARATION
[5181]17class ShellCompletion;
[3543]18
[5245]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 */
[5180]26class ShellInput : public Text,  public EventListener {
[1853]27
[1904]28 public:
[5178]29  ShellInput();
30  virtual ~ShellInput();
[1853]31
[5185]32  /** @returns the inputLine */
[7221]33  const std::string& getInput() const { return this->inputLine; };
[3245]34
[5178]35  // InputLine
36  void flush();
[7221]37  void setInputText(const std::string& text);
[5178]38  void addCharacter(char character);
[7221]39  void addCharacters(const std::string& characters);
[5178]40  void removeCharacters(unsigned int characterCount = 1);
41  void setRepeatDelay(float repeatDelay, float repeatRate);
[5179]42  bool executeCommand();
[5243]43
[5245]44  /** sets the count of the History's entries */
45  void setHistoryLength(unsigned int historyLength) { this->historyLength = historyLength; };
[5243]46  void historyMoveUp();
47  void historyMoveDown();
48
[7221]49  void help(const std::string& className = "", const std::string& function = "");
[5178]50
[5180]51  virtual void tick(float dt);
52  virtual void process(const Event &event);
53
[3245]54 private:
[5178]55    // HANDLING TEXT INPUT
[7221]56   ShellCompletion*                  completion;       //!< The Completion Interface.
[5181]57
[7221]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.
[3245]63
[7221]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.
[1853]68};
69
[5178]70#endif /* _SHELL_INPUT_H */
Note: See TracBrowser for help on using the repository browser.