Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6689 was 5786, checked in by bensch, 19 years ago

orxonox/trunk: key-repeat in the Shell is smoother now

File size: 2.5 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 */
33  const char* getInput() const { return this->inputLine; };
[3245]34
[5178]35  // InputLine
36  void flush();
[5244]37  void setInputText(const char* text);
[5178]38  void addCharacter(char character);
39  void addCharacters(const char* characters);
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
[5204]49  void help(const char* className = "", const char* 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
[5784]56   ShellCompletion*            completion;             //!< The Completion Interface.
[5181]57
[5784]58   char*                       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.
[5786]62   Uint16                      pressedKey;             //!< the pressed key that will be repeated.
[3245]63
[5784]64   std::list<char*>            history;                //!< The history of given commands.
65   std::list<char*>::iterator  historyIT;
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.