comparison mde/gui/widget/Ifaces.d @ 45:0fd51d2c6c8a

Several changes to resising windows and layout widgets. This commit still has some bugs. Moved the implementable widgets from mde.gui.widget.Widget to miscWidgets, leaving base widgets in Widget. Rewrote some of GridLayoutWidget's implementation. Made many operations general to work for either columns or rows. Some optimisations were intended but ended up being removed due to problems. Allowed layout's to resize from either direction (only with window resizes). committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 22 May 2008 11:34:09 +0100
parents b3a6ca4516b4
children 03fa79a48c48
comparison
equal deleted inserted replaced
44:07bd1a09e161 45:0fd51d2c6c8a
108 * 108 *
109 * If not, the widget has fixed dimensions equal the output of getMinimalSize. */ 109 * If not, the widget has fixed dimensions equal the output of getMinimalSize. */
110 bool isWSizable (); 110 bool isWSizable ();
111 bool isHSizable (); /// ditto 111 bool isHSizable (); /// ditto
112 112
113 /** Calculate the minimal size the widget could be shrunk to, taking into account 113 /** Calculate the minimal size the widget could be shrunk to (or its fixed size), taking into
114 * child-widgets. */ 114 * account child-widgets or other contents. */
115 void getMinimalSize (out int w, out int h); 115 void getMinimalSize (out int w, out int h);
116 116
117 /** Get the current size of the widget. */ 117 /** Get the current size of the widget. */
118 void getCurrentSize (out int w, out int h); 118 void getCurrentSize (out int w, out int h);
119 119
120 /** Used to adjust the size. 120 /** Used to adjust the size.
121 * 121 *
122 * setPosition should always be called after setSize (for layout widgets). Adding this 122 * w,h is the new size. The boolean parameters describe which direction to resize from and is
123 * restriction appears to be the most efficient approach without a lot more tests. 123 * only really relevent to layout widgets (see GridLayoutWidget's implementation). When
124 * calling, just past true,true if it doesn't matter.
124 * 125 *
125 * Implementation: 126 * Implementation:
126 * The size should be clamped to the widget's minimal size, i.e. the size set may be larger 127 * The size should be clamped to the widget's minimal size, i.e. the size set may be larger
127 * than that given by the parameters. Conversely, the size should not be reduced to the 128 * than that given by the parameters. Conversely, the size should not be reduced to the
128 * widget's maximal size (if any) but expanded as necessary (alignment to be implemented). 129 * widget's maximal size (if any) but expanded as necessary (alignment to be implemented).
130 * This should be true for both resizable and fixed widgets; fixed widgets may still be scaled
131 * to fill a whole row/column in a layout widget.
129 * 132 *
130 * If the actual size is needed, call getCurrentSize afterwards. */ 133 * If the actual size is needed, call getCurrentSize afterwards. */
131 void setSize (int w, int h); 134 void setSize (int w, int h, bool, bool);
132 135
133 /** Set the current position (i.e. called on init and move). */ 136 /** Set the current position (i.e. called on init and move). */
134 void setPosition (int x, int y); 137 void setPosition (int x, int y);
135 //END Size and position 138 //END Size and position
136 139