Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10641 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 3.0 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
[7458]12#include "text.h"
[5180]13#include "event_listener.h"
[7343]14#include "shell_completion.h"
15
[5784]16#include <list>
[5179]17
[7374]18namespace OrxShell
19{
20  // FORWARD DECLARATION
21  class ShellCompletion;
[3543]22
[7374]23  //! An InputLine for the Shell
24  /**
25   * The ShellInput has the ability to catch and display user input.
26   * The ShellInput is auto-completed after the user presses [TAB]
27   * The ShellInput is executed (and sent back to the Application) on Pressing [ENTER]
28   * [UP] and [DOWN] move through the history of allready given commands.
29   */
[7458]30  class ShellInput : public Text,  public EventListener
[7374]31  {
[9869]32    ObjectListDeclaration(ShellInput);
[1853]33
[7374]34  public:
35    ShellInput();
36    virtual ~ShellInput();
[1853]37
[7374]38    /** @returns the inputLine */
[9869]39    std::string getInput() const { return this->inputLineBegin + this->inputLineEnd; };
[3245]40
[7374]41    // InputLine
42    void setInputText(const std::string& text);
43    void addCharacter(char character);
44    void addCharacters(const std::string& characters);
45    void removeCharacters(unsigned int characterCount = 1);
[7403]46    void flush();
47
[7374]48    void setRepeatDelay(float repeatDelay, float repeatRate);
[7393]49
[7374]50    bool executeCommand();
[5243]51
[7374]52    /** sets the count of the History's entries */
53    void setHistoryLength(unsigned int historyLength) { this->historyLength = historyLength; };
54    void historyMoveUp();
55    void historyMoveDown();
[5243]56
[9869]57    void moveCursor(int chars);
58
[7374]59    void help(const std::string& className = "", const std::string& function = "");
[5178]60
[7374]61    virtual void tick(float dt);
62    virtual void process(const Event &event);
[5180]63
[7374]64  private:
[5178]65    // HANDLING TEXT INPUT
[7374]66    ShellCompletion                   completion;       //!< The Completion Interface.
[5181]67
[9869]68    std::string                       inputLineBegin;   //!< The Line up to the cursor.
69    std::string                       inputLineEnd;     //!< The Line from the cursor on
70
[7374]71    float                             repeatRate;       //!< The Repeat-Delay.
72    float                             repeatDelay;      //!< The delay of the first Character of a given Character.
73    float                             delayed;          //!< how much of the delay is remaining.
74    Uint16                            pressedKey;       //!< the pressed key that will be repeated.
[7858]75    Uint16                            pressedEvent;     //!< The Event, that lead to the pressing of the Key.
[3245]76
[7729]77    static std::list<std::string>     history;          //!< The history of given commands.
[7374]78    std::list<std::string>::iterator  historyIT;        //!< The locator that tells us, where we are in the history.
79    unsigned int                      historyLength;    //!< The maximum length of the InputHistory.
80    bool                              historyScrolling; //!< true if we are scrolling through the history.
81  };
[1853]82
[7374]83}
84
[5178]85#endif /* _SHELL_INPUT_H */
Note: See TracBrowser for help on using the repository browser.