summaryrefslogtreecommitdiff
path: root/src/gui/itemshortcutwindow.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-28 00:01:38 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-28 00:01:38 +0000
commit55786731e0517efdc123d4e8245b2aa94fa55cbe (patch)
tree17d64454f3daeb9f55241e8c9a95b5671f2da023 /src/gui/itemshortcutwindow.cpp
parent76291862ce0e26040f251bc4764539d8ff6634a0 (diff)
downloadMana-55786731e0517efdc123d4e8245b2aa94fa55cbe.tar.gz
Mana-55786731e0517efdc123d4e8245b2aa94fa55cbe.tar.bz2
Mana-55786731e0517efdc123d4e8245b2aa94fa55cbe.tar.xz
Mana-55786731e0517efdc123d4e8245b2aa94fa55cbe.zip
Made buy dialog resizable and added a WindowListener class for listening for
window resize and move events.
Diffstat (limited to 'src/gui/itemshortcutwindow.cpp')
-rw-r--r--src/gui/itemshortcutwindow.cpp32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp
index 2ee2cfde..efac9353 100644
--- a/src/gui/itemshortcutwindow.cpp
+++ b/src/gui/itemshortcutwindow.cpp
@@ -38,7 +38,7 @@ ItemShortcutWindow::ItemShortcutWindow()
mItems = new ItemShortcutContainer();
- int border = (SCROLL_PADDING * 2) + (getPadding() * 2);
+ int border = SCROLL_PADDING * 2 + getPadding() * 2;
setMinWidth(mItems->getBoxWidth() + border);
setMinHeight(mItems->getBoxHeight() + border);
setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border);
@@ -50,6 +50,7 @@ ItemShortcutWindow::ItemShortcutWindow()
add(mInvenScroll);
+ addWindowListener(this);
loadWindowState();
}
@@ -64,32 +65,11 @@ void ItemShortcutWindow::logic()
Window::logic();
}
-void ItemShortcutWindow::mouseDragged(gcn::MouseEvent &event)
-{
- const int tWidth = getWidth(), tHeight = getHeight();
- Window::mouseDragged(event);
- if (getWidth() != tWidth || getHeight() != tHeight)
- {
- updateWidgets();
- }
-}
-
-void ItemShortcutWindow::updateWidgets()
+void ItemShortcutWindow::windowResized(const WindowEvent &event)
{
const gcn::Rectangle area = getChildrenArea();
- mInvenScroll->setSize(area.width - SCROLL_PADDING,
- area.height - SCROLL_PADDING);
-}
-
-void ItemShortcutWindow::loadWindowState()
-{
- Window::loadWindowState();
- updateWidgets();
-}
-
-void ItemShortcutWindow::resetToDefaultSize()
-{
- Window::resetToDefaultSize();
- updateWidgets();
+ mInvenScroll->setSize(
+ area.width - SCROLL_PADDING,
+ area.height - SCROLL_PADDING);
}