sources/interface.h

changeset 183
9b6a0daedfc0
parent 179
7fc34735178e
child 186
9330b93d9946
equal deleted inserted replaced
182:20ca0a6be175 183:9b6a0daedfc0
47 INPUTSTATE_PASSWORD, 47 INPUTSTATE_PASSWORD,
48 INPUTSTATE_CONFIRM_DISCONNECTION, 48 INPUTSTATE_CONFIRM_DISCONNECTION,
49 }; 49 };
50 50
51 Interface(); 51 Interface();
52 void connect(String address, String password); 52 void connect(std::string address, std::string password);
53 void disconnected(); 53 void disconnected();
54 RCONSession* getSession() { return &m_session; } 54 RCONSession* getSession() { return &m_session; }
55 void handleCommand(const String& input); 55 void handleCommand(const std::string& input);
56 void handleInput(); 56 void handleInput();
57 void needRefresh(); 57 void needRefresh();
58 void __cdecl print(const char* fmtstr, ...); 58 void __cdecl print(const char* fmtstr, ...);
59 void __cdecl printWarning(const char* fmtstr, ...); 59 void __cdecl printWarning(const char* fmtstr, ...);
60 void __cdecl printError(const char* fmtstr, ...); 60 void __cdecl printError(const char* fmtstr, ...);
61 void __cdecl printText(const char* fmtstr, ...); 61 void __cdecl printText(const char* fmtstr, ...);
62 void render(); 62 void render();
63 void renderFull(); 63 void renderFull();
64 void setPlayerNames(const StringList& names); 64 void setPlayerNames(const std::vector<std::string>& names);
65 void setTitle(const String& message); 65 void setTitle(const std::string& message);
66 void tabComplete(const String& part, String complete); 66 void tabComplete(const std::string& part, std::string complete);
67 void updateStatusBar(); 67 void updateStatusBar();
68 void vprint(const char* fmtstr, va_list args); 68 void vprint(const char* fmtstr, va_list args);
69 69
70 private: 70 private:
71 StringList m_inputHistory; 71 std::vector<std::string> m_inputHistory;
72 int m_inputCursor; 72 int m_inputCursor;
73 int m_cursorPosition; 73 int m_cursorPosition;
74 int m_inputPanning; 74 int m_inputPanning;
75 bool m_needRefresh; 75 bool m_needRefresh;
76 bool m_needStatusBarRender; 76 bool m_needStatusBarRender;
78 bool m_needOutputRender; 78 bool m_needOutputRender;
79 bool m_needNicklistRender; 79 bool m_needNicklistRender;
80 struct { char ch; int x; } m_cursorCharacter; 80 struct { char ch; int x; } m_cursorCharacter;
81 Vector<ColoredLine> m_outputLines; 81 Vector<ColoredLine> m_outputLines;
82 int m_outputScroll; 82 int m_outputScroll;
83 String m_title; 83 std::string m_title;
84 InputState m_inputState; 84 InputState m_inputState;
85 std::function<void(bool)> m_disconnectCallback; 85 std::function<void(bool)> m_disconnectCallback;
86 IPAddress m_remoteAddress; 86 IPAddress m_remoteAddress;
87 String m_statusBarText; 87 std::string m_statusBarText;
88 std::vector<ColoredLine> m_playerNames; 88 std::vector<ColoredLine> m_playerNames;
89 String m_pasteBuffer; 89 std::string m_pasteBuffer;
90 RCONSession m_session; 90 RCONSession m_session;
91 91
92 void detachInput(); 92 void detachInput();
93 int findNextWord(); 93 int findNextWord();
94 int findPreviousWord(); 94 int findPreviousWord();
95 void flushInput(); 95 void flushInput();
96 chtype getColorPair(Color fg, Color bg); 96 chtype getColorPair(Color fg, Color bg);
97 const String& getCurrentInput(); 97 const std::string& getCurrentInput();
98 String& getEditableInput(); 98 std::string& getEditableInput();
99 String getPromptString(); 99 std::string getPromptString();
100 void moveInputCursor(int delta); 100 void moveInputCursor(int delta);
101 int nicklistWidth(); 101 int nicklistWidth();
102 void positionCursor(); 102 void positionCursor();
103 void printToConsole(String message); 103 void printToConsole(std::string message);
104 int renderColorline(int y, int x0, int width, const ColoredLine& line, bool allowWrap); 104 int renderColorline(int y, int x0, int width, const ColoredLine& line, bool allowWrap);
105 void renderInput(); 105 void renderInput();
106 void renderNicklist(); 106 void renderNicklist();
107 void renderOutput(); 107 void renderOutput();
108 void renderStatusBar(); 108 void renderStatusBar();

mercurial