diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2005-08-16 18:44:55 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2005-08-16 18:44:55 +0000 |
commit | 9e11a93d3b7281c4927357ce8be4a2f3dd7c88e0 (patch) | |
tree | 7f466690b65f61ab6ec884b1582afc2dbcb43bf1 | |
parent | 2fec3c49297048f109c47ba5a90c10ea0a2b01aa (diff) | |
download | mana-9e11a93d3b7281c4927357ce8be4a2f3dd7c88e0.tar.gz mana-9e11a93d3b7281c4927357ce8be4a2f3dd7c88e0.tar.bz2 mana-9e11a93d3b7281c4927357ce8be4a2f3dd7c88e0.tar.xz mana-9e11a93d3b7281c4927357ce8be4a2f3dd7c88e0.zip |
Some other fixes and an attempt to use MouseOut().
-rw-r--r-- | src/gui/window.cpp | 39 | ||||
-rw-r--r-- | src/gui/window.h | 5 |
2 files changed, 39 insertions, 5 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 5c18194c..7aca26f6 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -213,7 +213,7 @@ void Window::setResizable(bool r) resizable = r; } -bool Window::getResizable() +bool Window::isResizable() { return resizable; } @@ -245,7 +245,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 && + if (isResizable() && button == 1 && getGripDimension().isPointInRect(x, y) && hasMouse() && !(mMouseDrag && y > (int)getPadding())) @@ -257,6 +257,39 @@ void Window::mousePress(int x, int y, int button) } } +void Window::mouseOut() +{ + +/* Doesn't seem to help, maybe somebody will have an idea based on this... + + // If the mouse is a little bit too quick, + // Throw it back to the window area when resizing. + // Or else the resizing will stop. + if ( mMouseResize && isResizable() ) + { + // Get the Win old dimension + gcn::Rectangle newDim = getDimension(); + int mouseX, mouseY; + SDL_GetMouseState(&mouseX, &mouseY); + // And update it to put the mouse in the middle of the grip image + newDim.width = mouseX - newDim.x + (resizeGrip->getWidth() / 2); + newDim.height = mouseY - newDim.y + (resizeGrip->getHeight() / 2); + + // Set the new window and content dimensions + mMouseYOffset += newDim.height - getHeight(); + mMouseXOffset += newDim.width - getWidth(); + setDimension(newDim); + + if (mContent != NULL) + { + mContent->setDimension(getContentDimension()); + } + + } + +*/ +} + void Window::mouseMotion(int x, int y) { if (mMouseDrag || mMouseResize) @@ -266,7 +299,7 @@ void Window::mouseMotion(int x, int y) gcn::Rectangle newDim = getDimension(); // Change the dimension according to dragging and moving - if (mMouseResize && getResizable()) + if (mMouseResize && isResizable()) { // We're dragging bottom right newDim.height += dy; diff --git a/src/gui/window.h b/src/gui/window.h index be9c9ea1..1bdac52c 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -110,7 +110,7 @@ class Window : public gcn::Window, public ConfigListener /** * Returns whether the window can be resized. */ - bool getResizable(); + bool isResizable(); /** * Sets the minimum width of the window. @@ -146,12 +146,13 @@ class Window : public gcn::Window, public ConfigListener void scheduleDelete(); /** - * Window dragging and resizing. These methods also makes sure the + * Window dragging and resizing mouse related. These methods also makes sure the * window is not dragged/resized outside of the screen. */ void mousePress(int x, int y, int button); void mouseMotion(int mx, int my); void mouseRelease(int x, int y, int button); + void mouseOut(); /** * Called when an config option changes. |