From 97bbe57e21a28544646da087e2a522390bf2ce5c Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 27 Oct 2007 20:23:48 +0000 Subject: Improved layout handler to support trees of nested arrays. Needed for converting and fixing the trade window. --- src/gui/window.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gui/window.h') diff --git a/src/gui/window.h b/src/gui/window.h index a09a9bbc..df756be3 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -30,11 +30,12 @@ #include "windowlistener.h" -class Cell; class ConfigListener; +class ContainerPlacer; class Image; class ImageRect; class Layout; +class LayoutCell; class ResizeGrip; class WindowContainer; @@ -92,12 +93,6 @@ class Window : public gcn::Window */ void setContentSize(int width, int height); - /** - * Called when either the user or resetToDefaultSize resizes the - * windows, so that the windows can manage its widgets. - */ - virtual void updateContentSize() {} - /** * Sets the size of this window. */ @@ -292,19 +287,24 @@ class Window : public gcn::Window Layout &getLayout(); /** - * Deletes the layout handler. + * Computes the position of the widgets according to the current + * layout. Resizes the window so that the layout fits. Deletes the + * layout. + * @param w if non-zero, force the window to this width. + * @param h if non-zero, force the window to this height. + * @note This function is meant to be called with fixed-size windows. */ - void forgetLayout(); + void reflowLayout(int w = 0, int h = 0); /** - * Resizes the window after computing the position of the widgets. + * Adds a widget to the window and sets it at given cell. */ - void reflowLayout(); + LayoutCell &place(int x, int y, gcn::Widget *, int w = 1, int h = 1); /** - * Adds a widget to the window and sets it at given cell. + * Returns a proxy for adding widgets in an inner table of the layout. */ - Cell &place(int x, int y, gcn::Widget *, int w = 1, int h = 1); + ContainerPlacer getPlacer(int x, int y); private: /** -- cgit v1.2.3-70-g09d2