summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorMaximilian Philipps <Turmfalke2007@web.de>2009-07-30 21:50:15 +0200
committerBertram <bertram@cegetel.net>2009-07-31 00:14:39 +0200
commit92dae33631e5b2f43c280aa6b05861a4f2aa25e2 (patch)
tree7c004cdf207870dcb8155902ab61c623742a0cc1 /src/gui/chat.cpp
parent256391f7bff25440218e7b10e445fe91f232f6a9 (diff)
downloadmana-92dae33631e5b2f43c280aa6b05861a4f2aa25e2.tar.gz
mana-92dae33631e5b2f43c280aa6b05861a4f2aa25e2.tar.bz2
mana-92dae33631e5b2f43c280aa6b05861a4f2aa25e2.tar.xz
mana-92dae33631e5b2f43c280aa6b05861a4f2aa25e2.zip
patch for ticket #767
bigger "hold here to drag" area for the chatbox and a scroll lock for resize
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 1d06edd1..1561002a 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -141,9 +141,14 @@ void ChatWindow::adjustTabSize()
ChatTab *tab = getFocused();
if (tab) {
gcn::Widget *content = tab->mScrollArea;
+ bool scrollLock = false;
+ if(tab->mScrollArea->getVerticalMaxScroll() == tab->mScrollArea->getVerticalScrollAmount())
+ scrollLock = true;
content->setSize(mChatTabs->getWidth() - 2 * content->getFrameSize(),
mChatTabs->getContainerHeight() - 2 * content->getFrameSize());
content->logic();
+ if(scrollLock)
+ tab->mScrollArea->setVerticalScrollAmount(tab->mScrollArea->getVerticalMaxScroll());
}
}
@@ -362,6 +367,35 @@ void ChatWindow::scroll(int amount)
if (tab)
tab->scroll(amount);
}
+void ChatWindow::mousePressed(gcn::MouseEvent &event)
+{
+Window::mousePressed(event);
+
+if(event.isConsumed())
+return;
+
+mMoved = event.getY() <= mCurrentTab->getHeight();
+mDragOffsetX = event.getX();
+mDragOffsetY = event.getY();
+
+}
+void ChatWindow::mouseDragged(gcn::MouseEvent &event)
+{
+Window::mouseDragged(event);
+
+if(event.isConsumed())
+return;
+
+if(isMovable() && mMoved)
+{
+ int newX = std::max(0, getX() + event.getX() - mDragOffsetX);
+ int newY = std::max(0, getY() + event.getY() - mDragOffsetY);
+ newX = std::min(graphics->getWidth() - getWidth(), newX);
+ newY = std::min(graphics->getHeight() - getHeight(), newY);
+ setPosition(newX, newY);
+}
+}
+
void ChatWindow::keyPressed(gcn::KeyEvent &event)
{