summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/channeltab.h9
-rw-r--r--src/gui/widgets/chattab.cpp10
-rw-r--r--src/gui/widgets/chattab.h20
-rw-r--r--src/gui/widgets/whispertab.h8
4 files changed, 39 insertions, 8 deletions
diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h
index 149eb5ec..91b4f7c6 100644
--- a/src/gui/widgets/channeltab.h
+++ b/src/gui/widgets/channeltab.h
@@ -32,6 +32,12 @@ class Channel;
class ChannelTab : public ChatTab
{
public:
+
+ Channel *getChannel() { return mChannel; }
+
+ protected:
+ friend class Channel;
+
/**
* Constructor.
*/
@@ -42,9 +48,6 @@ class ChannelTab : public ChatTab
*/
~ChannelTab();
- Channel *getChannel() { return mChannel; }
-
- protected:
void sendChat(std::string &msg);
private:
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index ff856361..120d4e21 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -62,15 +62,23 @@ ChatTab::ChatTab(const std::string &name) : Tab()
gcn::ScrollArea::SHOW_ALWAYS);
mScrollArea->setScrollAmount(0, 1);
mScrollArea->setOpaque(false);
+
+ chatWindow->addTab(this);
}
ChatTab::~ChatTab()
{
+ chatWindow->removeTab(this);
delete mTextOutput;
delete mScrollArea;
}
-void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
+void ChatTab::chatLog(const char* line, int own, bool ignoreRecord)
+{
+ chatLog(std::string(line), own, ignoreRecord);
+}
+
+void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
{
// Trim whitespace
trim(line);
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 9e2aff6b..a478abeb 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -32,6 +32,21 @@ class BrowserBox;
class Recorder;
class ScrollArea;
+enum
+{
+ BY_GM,
+#ifdef EATHENA_SUPPORT
+ BY_PARTY,
+#endif
+ BY_PLAYER,
+ BY_OTHER,
+ BY_SERVER,
+ BY_CHANNEL,
+ ACT_WHISPER, // getting whispered at
+ ACT_IS, // equivalent to "/me" on IRC
+ BY_LOGGER
+};
+
/**
* A tab for the chat window. This is special to ease chat handling.
*/
@@ -56,7 +71,8 @@ class ChatTab : public Tab
* @param channelName which channel to send the message to.
* @param ignoreRecord should this not be recorded?
*/
- void chatLog(std::string line, int own, bool ignoreRecord);
+ void chatLog(std::string line, int own = BY_SERVER, bool ignoreRecord = false);
+ void chatLog(const char* line, int own = BY_SERVER, bool ignoreRecord = false);
/**
* Adds the text to the message list
@@ -97,4 +113,6 @@ class ChatTab : public Tab
//Recorder *mRecorder;
};
+extern ChatTab *localChatTab;
+
#endif // CHATTAB_H
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 66ec2720..059346fa 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -32,6 +32,11 @@ class Channel;
class WhisperTab : public ChatTab
{
public:
+ std::string getNick() { return mNick; }
+
+ protected:
+ friend class ChatWindow;
+
/**
* Constructor.
*/
@@ -42,9 +47,6 @@ class WhisperTab : public ChatTab
*/
~WhisperTab();
- std::string getNick() { return mNick; }
-
- protected:
void sendChat(std::string &msg);
private: