00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef CHATTAB_H
00023 #define CHATTAB_H
00024 
00025 #include "gui/widgets/tab.h"
00026 #include "gui/chat.h"
00027 
00028 class BrowserBox;
00029 class Recorder;
00030 class ScrollArea;
00031 
00032 enum
00033 {
00034     BY_GM,
00035     BY_PLAYER,
00036     BY_OTHER,
00037     BY_SERVER,
00038     BY_CHANNEL,
00039     ACT_WHISPER,      
00040     ACT_IS,           
00041     BY_LOGGER
00042 };
00043 
00047 class ChatTab : public Tab
00048 {
00049     public:
00053         ChatTab(const std::string &name);
00054         ~ChatTab();
00055 
00064         void chatLog(std::string line, int own = BY_SERVER, bool ignoreRecord = false);
00065 
00071         void chatLog(const std::string &nick, const std::string &msg);
00072 
00080         void chatInput(std::string &msg);
00081 
00089         void scroll(int amount);
00090 
00094         void clearText();
00095 
00100         virtual void showHelp() {}
00101 
00109         virtual bool handleCommand(const std::string &type,
00110                                    const std::string &args)
00111         { return false; }
00112 
00113     protected:
00114         friend class ChatWindow;
00115         friend class WhisperWindow;
00116 
00117         virtual void setCurrent() { setHighlighted(false); }
00118 
00119         virtual void handleInput(const std::string &msg);
00120 
00121         virtual void handleCommand(const std::string &msg);
00122 
00123         ScrollArea *mScrollArea;
00124         BrowserBox *mTextOutput;
00125         
00126 };
00127 
00128 extern ChatTab *localChatTab;
00129 
00130 #endif // CHATTAB_H