Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7387 was 7374, checked in by bensch, 18 years ago

orxonox/trunk: added new Files shell_completion_plugin for the new Plugin Structure.
Also created the first namespace: OrxShell

File size: 2.7 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"
[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   */
30  class ShellInput : public Text,  public EventListener
31  {
[1853]32
[7374]33  public:
34    ShellInput();
35    virtual ~ShellInput();
[1853]36
[7374]37    /** @returns the inputLine */
38    const std::string& getInput() const { return this->inputLine; };
[3245]39
[7374]40    // InputLine
41    void flush();
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);
46    void setRepeatDelay(float repeatDelay, float repeatRate);
47    bool executeCommand();
[5243]48
[7374]49    /** sets the count of the History's entries */
50    void setHistoryLength(unsigned int historyLength) { this->historyLength = historyLength; };
51    void historyMoveUp();
52    void historyMoveDown();
[5243]53
[7374]54    void help(const std::string& className = "", const std::string& function = "");
[5178]55
[7374]56    virtual void tick(float dt);
57    virtual void process(const Event &event);
[5180]58
[7374]59  private:
[5178]60    // HANDLING TEXT INPUT
[7374]61    ShellCompletion                   completion;       //!< The Completion Interface.
[5181]62
[7374]63    std::string                       inputLine;        //!< the Char-Array of the Buffer
64    float                             repeatRate;       //!< The Repeat-Delay.
65    float                             repeatDelay;      //!< The delay of the first Character of a given Character.
66    float                             delayed;          //!< how much of the delay is remaining.
67    Uint16                            pressedKey;       //!< the pressed key that will be repeated.
[3245]68
[7374]69    std::list<std::string>            history;          //!< The history of given commands.
70    std::list<std::string>::iterator  historyIT;        //!< The locator that tells us, where we are in the history.
71    unsigned int                      historyLength;    //!< The maximum length of the InputHistory.
72    bool                              historyScrolling; //!< true if we are scrolling through the history.
73  };
[1853]74
[7374]75}
76
[5178]77#endif /* _SHELL_INPUT_H */
Note: See TracBrowser for help on using the repository browser.