From 72c06a258940696093f255fb1061beb58e1cdd0b Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 29 May 2010 07:25:38 +0000 Subject: copied refactor to trunk --- src/game/client/lineinput.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/game/client/lineinput.h (limited to 'src/game/client/lineinput.h') diff --git a/src/game/client/lineinput.h b/src/game/client/lineinput.h new file mode 100644 index 00000000..f5c65282 --- /dev/null +++ b/src/game/client/lineinput.h @@ -0,0 +1,31 @@ +#ifndef GAME_CLIENT_LINEINPUT_H +#define GAME_CLIENT_LINEINPUT_H + +#include + +// line input helter +class CLineInput +{ + char m_Str[256]; + int m_Len; + int m_CursorPos; +public: + static bool Manipulate(IInput::CEvent e, char *pStr, int StrMaxSize, int *pStrLenPtr, int *pCursorPosPtr); + + class CCallback + { + public: + virtual ~CCallback() {} + virtual bool Event(IInput::CEvent e) = 0; + }; + + CLineInput(); + void Clear(); + void ProcessInput(IInput::CEvent e); + void Set(const char *pString); + const char *GetString() const { return m_Str; } + int GetLength() const { return m_Len; } + unsigned GetCursorOffset() const { return m_CursorPos; } +}; + +#endif -- cgit 1.4.1