diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/window.cpp | 38 | ||||
-rw-r--r-- | src/gui/window.h | 68 |
2 files changed, 53 insertions, 53 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index c9c51032..62daa9cd 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -33,11 +33,11 @@ Window::Window(const std::string& caption, bool modal, Window *parent): parent(parent), snapSize(8), modal(modal), + resizeable(false), minWinWidth(256), minWinHeight(128), maxWinWidth(512), - maxWinHeight(512), - isWinResizeable(false) + maxWinHeight(512) { logger.log("Window::Window(\"%s\")", caption.c_str()); @@ -183,12 +183,12 @@ void Window::setMaxHeight(unsigned int height) void Window::setResizeable(bool r) { - isWinResizeable = r; + resizeable = r; } bool Window::getResizeable() { - return isWinResizeable; + return resizeable; } Window *Window::getParentWindow() @@ -229,24 +229,24 @@ void Window::mouseMotion(int mx, int my) //if (y < snapSize) y = 0; //if (x + winWidth + snapSize > screen->w) x = screen->w - winWidth; //if (y + winHeight + snapSize > screen->h) y = screen->h - winHeight; - - if (isWinResizeable && mx > getWidth() - 16) { - //resize - if (mx < minWinWidth) - mx = minWinWidth; - if (my < minWinHeight) - my = minWinHeight; - if (mx >= maxWinWidth) - mx = maxWinWidth - 1; - if (my >= maxWinHeight) - my = maxWinHeight - 1; + + if (resizeable && mx > getWidth() - 16) { + // Resize + if (mx < minWinWidth) + mx = minWinWidth; + if (my < minWinHeight) + my = minWinHeight; + if (mx >= maxWinWidth) + mx = maxWinWidth - 1; + if (my >= maxWinHeight) + my = maxWinHeight - 1; setWidth(mx); - setHeight(my); - } else { - //move + setHeight(my); + } else { + // Move setPosition(x, y); - } + } } } diff --git a/src/gui/window.h b/src/gui/window.h index b7cab031..f2f87cc0 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -50,11 +50,11 @@ class Window : public gcn::Window, public ConfigListener ImageRect border; /**< The window border */ - bool isWinResizeable; /**< Window can be resized */ - int minWinWidth; /**< Minimum window width */ - int minWinHeight; /**< Minimum window height */ - int maxWinWidth; /**< Maximum window width */ - int maxWinHeight; /**< Maximum window height */ + bool resizeable; /**< Window can be resized */ + int minWinWidth; /**< Minimum window width */ + int minWinHeight; /**< Minimum window height */ + int maxWinWidth; /**< Maximum window width */ + int maxWinHeight; /**< Maximum window height */ /** The window container windows add themselves to. */ @@ -124,35 +124,35 @@ class Window : public gcn::Window, public ConfigListener */ void setContentSize(int width, int height); - /** - * Sets whether of not the window can be resized - */ - void setResizeable(bool resize); - - /** - * Returns the current value of isResizable - */ - bool getResizeable(); - - /** - * Sets the minimum width of the window - */ - void setMinWidth(unsigned int width); - - /** - * Sets the minimum height of the window - */ - void setMinHeight(unsigned int height); - - /** - * Sets the maximum width of the window - */ - void setMaxWidth(unsigned int width); - - /** - * Sets the minimum height of the window - */ - void setMaxHeight(unsigned int height); + /** + * Sets whether of not the window can be resized. + */ + void setResizeable(bool resize); + + /** + * Returns whether the window can be resized. + */ + bool getResizeable(); + + /** + * Sets the minimum width of the window. + */ + void setMinWidth(unsigned int width); + + /** + * Sets the minimum height of the window. + */ + void setMinHeight(unsigned int height); + + /** + * Sets the maximum width of the window. + */ + void setMaxWidth(unsigned int width); + + /** + * Sets the minimum height of the window. + */ + void setMaxHeight(unsigned int height); /** |