summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-24 15:28:30 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-24 15:28:46 +0100
commit5cb25cbc0b6b6d05a642d4a9d62b6b5895ef94b8 (patch)
treedc8b3c6a5029e73e54124134ef613bc47f621d31
parentc82ba1aaed3a46553de804ad313ca917d4931ff5 (diff)
downloadmana-5cb25cbc0b6b6d05a642d4a9d62b6b5895ef94b8.tar.gz
mana-5cb25cbc0b6b6d05a642d4a9d62b6b5895ef94b8.tar.bz2
mana-5cb25cbc0b6b6d05a642d4a9d62b6b5895ef94b8.tar.xz
mana-5cb25cbc0b6b6d05a642d4a9d62b6b5895ef94b8.zip
Reflowed chat window to use layout code.
Signed-off-by: Ira Rice <irarice@gmail.com> (cherry picked from Aethyra commit 427f1319dc2890dfb2e5ed189d47cb16fa450554) Conflicts: src/gui/chat.cpp src/gui/chat.h
-rw-r--r--src/gui/chat.cpp24
-rw-r--r--src/gui/chat.h5
2 files changed, 7 insertions, 22 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 4854f1ca..a5a3438d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -32,6 +32,8 @@
#include "sdlinput.h"
#include "windowcontainer.h"
+#include "widgets/layout.h"
+
#include "../configuration.h"
#include "../game.h"
#include "../localplayer.h"
@@ -68,8 +70,11 @@ ChatWindow::ChatWindow(Network *network):
gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
mScrollArea->setOpaque(false);
- add(mScrollArea);
- add(mChatInput);
+ place(0, 0, mScrollArea, 5, 5);
+ place(0, 5, mChatInput, 5);
+
+ Layout &layout = getLayout();
+ layout.setRowHeight(0, Layout::AUTO_SET);
loadWindowState();
@@ -78,21 +83,6 @@ ChatWindow::ChatWindow(Network *network):
mCurHist = mHistory.end();
}
-void ChatWindow::widgetResized(const gcn::Event &event)
-{
- Window::widgetResized(event);
-
- const gcn::Rectangle area = getChildrenArea();
-
- mChatInput->setPosition(mChatInput->getFrameSize(),
- area.height - mChatInput->getHeight() -
- mChatInput->getFrameSize());
- mChatInput->setWidth(area.width - 2 * mChatInput->getFrameSize());
- mScrollArea->setWidth(area.width - 2 * mScrollArea->getFrameSize());
- mScrollArea->setHeight(area.height - 2 * mScrollArea->getFrameSize() -
- mChatInput->getHeight() - 5);
-}
-
void ChatWindow::chatLog(std::string line, int own)
{
// Trim whitespace
diff --git a/src/gui/chat.h b/src/gui/chat.h
index db03aa47..2baafdef 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -127,11 +127,6 @@ class ChatWindow : public Window, public gcn::ActionListener,
ChatWindow(Network *network);
/**
- * Called whenever the widget changes size.
- */
- void widgetResized(const gcn::Event &event);
-
- /*
* Adds a line of text to our message list. Parameters:
*
* @param line Text message.