Mana
Loading...
Searching...
No Matches
chattab.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "gui/chatwindow.h"
25
26#include "gui/widgets/tab.h"
27
28class BrowserBox;
29class Recorder;
30class ScrollArea;
31
35class ChatTab : public Tab, public AutoCompleteLister, public EventListener
36{
37 public:
38 ChatTab(const std::string &name);
39 ~ChatTab() override;
40
48 void chatLog(std::string line, Own own = BY_SERVER,
49 bool ignoreRecord = false);
50
56 void chatLog(const std::string &nick, const std::string &msg);
57
65 void chatInput(const std::string &msg);
66
74 void scroll(int amount);
75
79 void clearText();
80
85 virtual void showHelp() {}
86
94 virtual bool handleCommand(const std::string &type,
95 const std::string &args)
96 { return false; }
97
98
99 void getAutoCompleteList(std::vector<std::string> &names) const override;
100
101 virtual void saveToLogFile(std::string &msg);
102
103 void event(Event::Channel channel, const Event &event) override;
104
105 protected:
106 friend class ChatWindow;
107 friend class WhisperWindow;
108
109 void setCurrent() override { setFlash(false); }
110
111 virtual void handleInput(const std::string &msg);
112
113 virtual void handleCommand(const std::string &msg);
114
122 virtual bool checkNotify(Own own) const;
123
128 void updateTextFormat(int alpha);
129
132 //Recorder *mRecorder;
133};
134
135extern ChatTab *localChatTab;
ChatTab * localChatTab
Definition game.cpp:117
Own
Definition chatwindow.h:46
@ BY_SERVER
Definition chatwindow.h:50
A simple browser box able to handle links and forward events to the parent conteiner.
Definition browserbox.h:74
A tab for the chat window.
Definition chattab.h:36
void chatLog(std::string line, Own own=BY_SERVER, bool ignoreRecord=false)
Adds a line of text to our message list.
Definition chattab.cpp:111
virtual void handleInput(const std::string &msg)
Definition chattab.cpp:317
virtual bool handleCommand(const std::string &type, const std::string &args)
Handle special commands.
Definition chattab.h:94
~ChatTab() override
Definition chattab.cpp:72
virtual void showHelp()
Add any extra help text to the output.
Definition chattab.h:85
friend class WhisperWindow
Definition chattab.h:107
ScrollArea * mScrollArea
Definition chattab.h:130
void updateTextFormat(int alpha)
Adapts the text format to the current gui opacity, for better readability.
Definition chattab.cpp:81
virtual void saveToLogFile(std::string &msg)
Definition chattab.cpp:337
void scroll(int amount)
Scrolls the chat window.
Definition chattab.cpp:303
void setCurrent() override
Definition chattab.h:109
void getAutoCompleteList(std::vector< std::string > &names) const override
Definition chattab.cpp:332
void event(Event::Channel channel, const Event &event) override
Definition chattab.cpp:100
void chatInput(const std::string &msg)
Determines whether the message is a command or message, then sends the given message to the game serv...
Definition chattab.cpp:259
void clearText()
Clears the text from the tab.
Definition chattab.cpp:312
BrowserBox * mTextOutput
Definition chattab.h:131
virtual bool checkNotify(Own own) const
Returns whether a notify sound may be played for the given type of message.
Definition chattab.cpp:327
The chat window.
Definition chatwindow.h:73
Definition event.h:42
Channel
Definition event.h:45
A scroll area.
Definition scrollarea.h:38
A tab, the same as the Guichan tab in 0.8, but extended to allow transparency.
Definition tab.h:33
void setFlash(bool flash)
Set tab flashing state.
Definition tab.cpp:122