summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/gui/chat.cpp17
-rw-r--r--src/gui/chat.h10
3 files changed, 20 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ea235d1e..785a27ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-05 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/chat.h, src/gui/chat.cpp: Only update the size of chat
+ window widgets when it is resized.
+
2008-04-29 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/localplayer.cpp, src/gui/changeemaildialog.h, src/localplayer.h:
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);