diff options
author | Andrei Karas <akaras@inbox.ru> | 2009-10-31 15:42:28 +0200 |
---|---|---|
committer | Blue <bluesansdouze@gmail.com> | 2010-01-07 23:12:10 +0100 |
commit | be5460f2a294bb8e50b40f498f29a556b31bedd7 (patch) | |
tree | 5256167e0b8487fdb2c49090986cc883614fb9b1 /src/gui/widgets | |
parent | 84da747711ed1713984ca514a8bb786219a85d9b (diff) | |
download | mana-client-be5460f2a294bb8e50b40f498f29a556b31bedd7.tar.gz mana-client-be5460f2a294bb8e50b40f498f29a556b31bedd7.tar.bz2 mana-client-be5460f2a294bb8e50b40f498f29a556b31bedd7.tar.xz mana-client-be5460f2a294bb8e50b40f498f29a556b31bedd7.zip |
Chat auto completing
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/chattab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 13 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 2 |
6 files changed, 33 insertions, 4 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index e3ba4874..443fab3d 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -270,3 +270,8 @@ void ChatTab::handleCommand(const std::string &msg) { commandHandler->handleCommand(msg, this); } + +int ChatTab::getType() const +{ + return INPUT; +} diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 4cb6a58f..40a1c1f5 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -47,6 +47,14 @@ enum class ChatTab : public Tab { public: + enum Type + { + UNKNOWN, + INPUT, + WHISPER, + PARTY + }; + /** * Constructor. */ @@ -110,6 +118,11 @@ class ChatTab : public Tab const std::string &args) { return false; } + /** + * Returns type of the being. + */ + virtual int getType() const; + protected: friend class ChatWindow; friend class WhisperWindow; diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index f19b4d82..0f0caa00 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -41,12 +41,14 @@ int TextField::instances = 0; float TextField::mAlpha = 1.0; ImageRect TextField::skin; -TextField::TextField(const std::string &text): +TextField::TextField(const std::string &text, bool loseFocusOnTab): gcn::TextField(text), mNumeric(false) { setFrameSize(2); + mLoseFocusOnTab = loseFocusOnTab; + if (instances == 0) { // Load the skin @@ -245,7 +247,9 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; case Key::TAB: - return; + if (mLoseFocusOnTab) + return; + break; } keyEvent.consume(); diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 9130e441..e101e112 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -38,8 +38,7 @@ class TextField : public gcn::TextField /** * Constructor, initializes the text field with the given string. */ - TextField(const std::string &text = ""); - + TextField(const std::string &text = "", bool loseFocusOnTab = true); ~TextField(); /** @@ -98,6 +97,7 @@ class TextField : public gcn::TextField bool mNumeric; int mMinimum; int mMaximum; + bool mLoseFocusOnTab; }; #endif diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 5509a589..537aa2cc 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -113,3 +113,8 @@ bool WhisperTab::handleCommand(const std::string &type, return true; } + +int WhisperTab::getType() const +{ + return ChatTab::WHISPER; +} diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index af71025b..750e7f09 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -39,6 +39,8 @@ class WhisperTab : public ChatTab bool handleCommand(const std::string &type, const std::string &args); + int getType() const; + protected: friend class ChatWindow; |