From 55786731e0517efdc123d4e8245b2aa94fa55cbe Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 28 Aug 2007 00:01:38 +0000 Subject: Made buy dialog resizable and added a WindowListener class for listening for window resize and move events. --- src/gui/window.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/gui/window.h') diff --git a/src/gui/window.h b/src/gui/window.h index 625d7541..b83aa78b 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -28,6 +28,8 @@ #include "../guichanfwd.h" +#include "windowlistener.h" + class ConfigListener; class GCContainer; class ImageRect; @@ -114,6 +116,21 @@ class Window : public gcn::Window */ void setDimension(const gcn::Rectangle &dimension); + /** + * Sets the position of this window. + */ + void setPosition(int x, int y); + + /** + * Sets the window x coordinate. + */ + void setX(int x); + + /** + * Sets the window y coordinate. + */ + void setY(int y); + /** * Sets the location relative to the given widget. */ @@ -255,6 +272,20 @@ class Window : public gcn::Window */ virtual void resetToDefaultSize(); + /** + * Adds a listener to the list that's notified when the window is + * moved or resized. + */ + void addWindowListener(WindowListener *listener) + { mListeners.push_back(listener); } + + /** + * Removes a listener from the list that's notified when the window is + * moved or resized. + */ + void removeWindowListener(WindowListener *listener) + { mListeners.remove(listener); } + enum ResizeHandles { TOP = 0x01, @@ -310,6 +341,14 @@ class Window : public gcn::Window * where two borders are moved at the same time. */ static const int resizeBorderWidth = 10; + + private: + /** + * Sends out a window event to the list of selection listeners. + */ + void fireWindowEvent(const WindowEvent &event); + + WindowListeners mListeners; }; #endif -- cgit v1.2.3-60-g2f50