summaryrefslogtreecommitdiff
path: root/src/gui/window.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-08-16 10:11:33 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-08-16 10:11:33 +0000
commitf6fabeacc35b67ca0a44bf50cf6ca7d2378c289d (patch)
tree636fa896306452cd0ccbe9febdb855d29ddaf74f /src/gui/window.cpp
parent9e6c0ca8f20f5ba4cbfafe19938d0bb34d6ee031 (diff)
downloadmana-client-f6fabeacc35b67ca0a44bf50cf6ca7d2378c289d.tar.gz
mana-client-f6fabeacc35b67ca0a44bf50cf6ca7d2378c289d.tar.bz2
mana-client-f6fabeacc35b67ca0a44bf50cf6ca7d2378c289d.tar.xz
mana-client-f6fabeacc35b67ca0a44bf50cf6ca7d2378c289d.zip
Added a resize grip to resizable window, fixed some compiling errors.
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r--src/gui/window.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 07b85ea5..67bd224f 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -21,10 +21,9 @@
* $Id$
*/
-#include "window.h"
-
#include <guichan/exception.hpp>
+#include "window.h"
#include "windowcontainer.h"
#include "../configuration.h"
@@ -39,6 +38,7 @@
WindowContainer *Window::windowContainer = NULL;
int Window::instances = 0;
ImageRect Window::border;
+Image *Window::resizeGrip;
Window::Window(const std::string& caption, bool modal, Window *parent):
gcn::Window(caption),
@@ -69,6 +69,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
border.grid[6] = dBorders->getSubImage(0, 15, 4, 4);
border.grid[7] = dBorders->getSubImage(4, 15, 3, 4);
border.grid[8] = dBorders->getSubImage(7, 15, 4, 4);
+ resizeGrip = resman->getImage("graphics/gui/resize.png");
dBorders->decRef();
}
@@ -138,6 +139,17 @@ void Window::draw(gcn::Graphics* graphics)
dynamic_cast<Graphics*>(graphics)->drawImageRect(x, y, getWidth(), getHeight(),
border);
+ // Draw grip
+ if (resizable)
+ {
+ dynamic_cast<Graphics*>(graphics)->drawImage(Window::resizeGrip,
+ x + getWidth() - 18,
+ y + getHeight() - 15);
+ }
+
+
+
+
// Draw title
if (title) {
graphics->setFont(getFont());
@@ -236,7 +248,7 @@ void Window::mousePress(int x, int y, int button)
// If the mouse is not inside the content, the press must have been on the
// border, and is a candidate for a resize.
if (getResizable() && button == 1 &&
- !getContentDimension().isPointInRect(x, y) &&
+ getGripDimension().isPointInRect(x, y) &&
!(mMouseDrag && y > (int)getPadding()))
{
mMouseResize = true;
@@ -244,10 +256,10 @@ void Window::mousePress(int x, int y, int button)
mMouseYOffset = y;
// Determine which borders are being dragged
- mLeftBorderDrag = (x < 10);
- mTopBorderDrag = (y < 10);
- mRightBorderDrag = (x >= getWidth() - 10);
- mBottomBorderDrag = (y >= getHeight() - 10);
+ mLeftBorderDrag = false;//(x < 10);
+ mTopBorderDrag = false;//(y < 10);*/
+ mRightBorderDrag = true;//(x >= getWidth() - 10);
+ mBottomBorderDrag = true;//(y >= getHeight() - 10);
}
}
@@ -410,3 +422,10 @@ void Window::optionChanged(const std::string &name)
}
}
}
+
+gcn::Rectangle Window::getGripDimension () {
+ int x, y;
+ getAbsolutePosition(x, y);
+ return gcn::Rectangle(getWidth() - 18, getHeight() - 15, getWidth(),
+ getHeight());
+}