diff options
author | Dennis Friis <peavey@placid.dk> | 2008-05-08 00:39:29 +0000 |
---|---|---|
committer | Dennis Friis <peavey@placid.dk> | 2008-05-08 00:39:29 +0000 |
commit | 41906acb990895831e3b2c39102f41c9b580ae10 (patch) | |
tree | 736c61438719471e75ea3da20d389742d1a2d9da /src/gui/chat.cpp | |
parent | 4b07864a32c409c390f2561f9c75962f3b96444f (diff) | |
download | mana-41906acb990895831e3b2c39102f41c9b580ae10.tar.gz mana-41906acb990895831e3b2c39102f41c9b580ae10.tar.bz2 mana-41906acb990895831e3b2c39102f41c9b580ae10.tar.xz mana-41906acb990895831e3b2c39102f41c9b580ae10.zip |
Allow page up and page down to scroll the chat window, based on patch by fate.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 8b53ef98..5e3aaf60 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -411,6 +411,19 @@ ChatWindow::const_msg(CHATSKILL act) } void +ChatWindow::scroll(int amount) +{ + if (!isVisible()) + return; + + int range = mScrollArea->getHeight() / 8 * amount; + gcn::Rectangle scr; + scr.y = mScrollArea->getVerticalScrollAmount() + range; + scr.height = abs(range); + mTextOutput->showPart(scr); +} + +void ChatWindow::keyPressed(gcn::KeyEvent &event) { if (event.getKey().getValue() == gcn::Key::DOWN && @@ -446,11 +459,13 @@ ChatWindow::setInputText(std::string input_str) void ChatWindow::setVisible(bool isVisible) { - Window::setVisible(isVisible); + Window::setVisible(isVisible); - /* - * For whatever reason, if setVisible is called, the mTmpVisible effect - * should be disabled. - */ - mTmpVisible = false; + /* + * For whatever reason, if setVisible is called, the mTmpVisible effect + * should be disabled. + */ + + mTmpVisible = false; } + |