From be25d46954a98b2590b522de5f8aa470ba4f9e81 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 7 Dec 2008 15:21:36 +0100 Subject: Use widgetResized to adjust chat window contents Previously was using the logic() method, adjusting window contents 100 times per second. --- src/gui/chat.cpp | 6 ++---- src/gui/chat.h | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 1e22772b..5477ad4a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -75,10 +75,9 @@ ChatWindow::ChatWindow(Network *network): mCurHist = mHistory.end(); } -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(); @@ -89,7 +88,6 @@ ChatWindow::logic() mScrollArea->setWidth(area.width - 2 * mScrollArea->getFrameSize()); mScrollArea->setHeight(area.height - 2 * mScrollArea->getFrameSize() - mChatInput->getHeight() - 5); - mScrollArea->logic(); } void diff --git a/src/gui/chat.h b/src/gui/chat.h index 76a8146c..09c3712b 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -127,9 +127,9 @@ class ChatWindow : public Window, public gcn::ActionListener, ChatWindow(Network *network); /** - * Logic (updates components' size) + * Called whenever the widget changes size. */ - void logic(); + void widgetResized(const gcn::Event &event); /* * Adds a line of text to our message list. Parameters: -- cgit v1.2.3-70-g09d2