summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp17
-rw-r--r--src/gui/chat.h10
2 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 8944d521..3d63491c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -49,13 +49,11 @@
#include "../utils/trim.h"
ChatWindow::ChatWindow():
- Window(""),
+ Window("Chat"),
mTmpVisible(false)
{
setResizable(true);
setDefaultSize(0, (windowContainer->getHeight() - 105), 400, 100);
- setTitleBarHeight(5);
- loadWindowState("Chat");
mChatInput = new ChatInput();
mChatInput->setActionEventId("chatinput");
@@ -75,7 +73,8 @@ ChatWindow::ChatWindow():
mChatTabs = new TabbedArea();
mChatTabs->addTab("General", scrollArea);
- mChatTabs->setPosition(mChatTabs->getFrameSize(), mChatTabs->getFrameSize());
+ mChatTabs->setPosition(mChatTabs->getFrameSize(),
+ mChatTabs->getFrameSize());
mChannels.insert(
std::make_pair("General", ChatArea(textOutput, scrollArea)));
@@ -86,6 +85,8 @@ ChatWindow::ChatWindow():
// Add key listener to chat input to be able to respond to up/down
mChatInput->addKeyListener(this);
mCurHist = mHistory.end();
+
+ loadWindowState("Chat");
}
ChatWindow::~ChatWindow()
@@ -94,10 +95,10 @@ ChatWindow::~ChatWindow()
delete mChatTabs;
}
-void
-ChatWindow::logic()
+void ChatWindow::widgetResized(const gcn::Event &event)
{
- // todo: only do this when the size changes (updateWidgets?)
+ Window::widgetResized(event);
+
const gcn::Rectangle area = getChildrenArea();
mChatInput->setPosition(mChatInput->getFrameSize(),
@@ -117,8 +118,6 @@ ChatWindow::logic()
mChatInput->getHeight() - 5);
scroll->logic();
}
-
- Window::logic();
}
void
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 08fed0be..26e30374 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -105,7 +105,8 @@ struct CHATSKILL
*
* \ingroup Interface
*/
-class ChatWindow : public Window, public gcn::ActionListener,
+class ChatWindow : public Window,
+ public gcn::ActionListener,
public gcn::KeyListener
{
public:
@@ -120,9 +121,10 @@ class ChatWindow : public Window, public gcn::ActionListener,
~ChatWindow();
/**
- * Logic (updates components' size)
+ * Called when the widget changes size. Used for adapting the size of
+ * the tabbed area.
*/
- void logic();
+ void widgetResized(const gcn::Event &event);
/*
* Adds a line of text to our message list. Parameters:
@@ -188,8 +190,10 @@ class ChatWindow : public Window, public gcn::ActionListener,
/** Called to remove the channel from the channel manager */
void
removeChannel(short channelId);
+
void
removeChannel(const std::string &channelName);
+
void
removeChannel(Channel *channel);