summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-21 10:03:44 -0700
committerIra Rice <irarice@gmail.com>2009-01-21 10:03:44 -0700
commit427f1319dc2890dfb2e5ed189d47cb16fa450554 (patch)
tree2852cb850e6ab7abb0345de96ccd5fdd895bcc90
parent4bee113beffd52517ca0414909248ea9b00970cd (diff)
downloadmana-427f1319dc2890dfb2e5ed189d47cb16fa450554.tar.gz
mana-427f1319dc2890dfb2e5ed189d47cb16fa450554.tar.bz2
mana-427f1319dc2890dfb2e5ed189d47cb16fa450554.tar.xz
mana-427f1319dc2890dfb2e5ed189d47cb16fa450554.zip
Reflowed chat window to use layout code.
Signed-off-by: Ira Rice <irarice@gmail.com>
-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 a0f12b2c..7ce5d395 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 "../beingmanager.h"
#include "../configuration.h"
#include "../extensions.h"
@@ -78,8 +80,11 @@ Window(""), mNetwork(network), mTmpVisible(false)
mScrollArea->setScrollAmount(0, 1);
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();
@@ -109,21 +114,6 @@ ChatWindow::~ChatWindow()
delete mRecorder;
}
-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, bool ignoreRecord)
{
// Trim whitespace
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 03b2062a..2967e204 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -122,11 +122,6 @@ class ChatWindow : public Window, public gcn::ActionListener,
~ChatWindow();
/**
- * 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.