Mercurial > projects > mde
diff mde/gui/widget/Ifaces.d @ 46:03fa79a48c48
Fixed resizing bugs in previous commit and made code cleaner and more efficient.
setSize replaced by setWidth & setHeight.
setPosition must be called after setWidth/Height.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 22 May 2008 12:51:47 +0100 |
parents | 0fd51d2c6c8a |
children | a98ffb64f066 |
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d Thu May 22 11:34:09 2008 +0100 +++ b/mde/gui/widget/Ifaces.d Thu May 22 12:51:47 2008 +0100 @@ -21,7 +21,12 @@ /** Interface for Window, allowing widgets to call some of Window's methods. * - * Contains the methods in Window available for widgets to call on their root. */ + * Contains the methods in Window available for widgets to call on their root. + * + * Notation: + * Positive/negative direction: along the x/y axis in this direction. + * Layout widget: a widget containing multiple sub-widges (which hence controls how they are laid + * out). */ interface IWindow : IWidget { /** Widget ID type. Each ID is unique under this window. @@ -119,9 +124,12 @@ /** Used to adjust the size. * - * w,h is the new size. The boolean parameters describe which direction to resize from and is - * only really relevent to layout widgets (see GridLayoutWidget's implementation). When - * calling, just past true,true if it doesn't matter. + * Params: + * nw/nh = The new width/height + * dir = Direction to resize from. This is only really applicable to layout widgets. + * It must be either -1 (start resizing from highest row/col index, decreasing the + * index as necessary), or +1 (resize from the lowest index, i.e. 0). + * Most widgets can simply ignore it. * * Implementation: * The size should be clamped to the widget's minimal size, i.e. the size set may be larger @@ -130,8 +138,10 @@ * This should be true for both resizable and fixed widgets; fixed widgets may still be scaled * to fill a whole row/column in a layout widget. * - * If the actual size is needed, call getCurrentSize afterwards. */ - void setSize (int w, int h, bool, bool); + * If the actual size is needed, call getCurrentSize afterwards. setPosition must be called + * afterwards if the widget might be a layout widget. */ + void setWidth (int nw, int dir); + void setHeight (int nh, int dir); /// ditto /** Set the current position (i.e. called on init and move). */ void setPosition (int x, int y);