comparison mde/gui/widget/Ifaces.d @ 91:4d5d53e4f881

Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too. Some debugging improvements. When multiple .mtt files are read for merging, files with invalid headers are ignored and no error is thrown so long as at least one file os valid.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 16 Oct 2008 17:43:48 +0100
parents b525ff28774b
children 085f2ca31914
comparison
equal deleted inserted replaced
90:b525ff28774b 91:4d5d53e4f881
59 * Creates a widget, using the widget data with index id. Widget data is loaded from files, 59 * Creates a widget, using the widget data with index id. Widget data is loaded from files,
60 * and per design (multiple gui layouts, called designs, may exist; data is per design). 60 * and per design (multiple gui layouts, called designs, may exist; data is per design).
61 */ 61 */
62 IChildWidget makeWidget (widgetID id, IContent content = null); 62 IChildWidget makeWidget (widgetID id, IContent content = null);
63 63
64 /** Record some changes, for saving. */ 64 /** Record some changes, for saving. Should only be called from IWidget.saveChanges() to avoid
65 * multiple calls for instanced widgets of same id. */
65 void setData (widgetID id, WidgetData); 66 void setData (widgetID id, WidgetData);
66 67
67 // Rendering: 68 // Rendering:
68 /** For when a widget needs redrawing. 69 /** For when a widget needs redrawing.
69 * 70 *
143 * IWidgetManager.setData (id, data) to set it and return true. Otherwise it should return 144 * IWidgetManager.setData (id, data) to set it and return true. Otherwise it should return
144 * false. 145 * false.
145 * 146 *
146 * If the widget has subwidgets, it should also be recursively called on these (passing their 147 * If the widget has subwidgets, it should also be recursively called on these (passing their
147 * ids). */ 148 * ids). */
149 // FIXME - no longer necessary to pass id!
148 bool saveChanges (widgetID id); 150 bool saveChanges (widgetID id);
149 151
150 /** Called when the renderer is changed (at least when the changes affect dimensions). 152 /** Called when the renderer is changed (at least when the changes affect dimensions).
151 * Also called after widget creation, before any other methods are called. 153 * Also called after widget creation, before any other methods are called.
152 * 154 *
162 void childChanged (); 164 void childChanged ();
163 +/ 165 +/
164 //END Load and save 166 //END Load and save
165 167
166 //BEGIN Size and position 168 //BEGIN Size and position
167 /** is the width / height resizable? 169 /** Is the width / height resizable?
168 * 170 *
169 * If not, the widget has fixed dimensions equal the output of getMinimalSize. */ 171 * This really means does the widget benifit from being enlarged? Any widget should occupy
172 * additional area when expanded.
173 *
174 * If not, the widget has fixed dimensions equal to it's minimal size. */
170 bool isWSizable (); 175 bool isWSizable ();
171 bool isHSizable (); /// ditto 176 bool isHSizable (); /// ditto
172 177
173 /** The minimal size the widget could be shrunk to (or its fixed size). 178 /** The minimal size the widget could be shrunk to (or its fixed size).
174 * 179 *
175 * Takes into account child-widgets and any other contents. */ 180 * Takes into account child-widgets and any other contents.
181 *
182 * Note: layout uses these calls to initialize it's alignment device. So, after creating a
183 * (layout) widget, minWidth should be the first function called on it! */
176 wdim minWidth (); 184 wdim minWidth ();
177 wdim minHeight (); /// ditto 185 wdim minHeight (); /// ditto
178 186
179 /** Get the current size of the widget. 187 /** Get the current size of the widget. */
180 * 188 wdim width ();
181 * Deprecated: is it needed now? 189 wdim height(); /// ditto
182 */
183 deprecated void getCurrentSize (out wdim w, out wdim h);
184 190
185 /** Used to adjust the size. 191 /** Used to adjust the size.
186 * 192 *
187 * Params: 193 * Params:
188 * nw/nh = The new width/height 194 * nw/nh = The new width/height
189 * dir = Direction to resize from. This is only really applicable to layout widgets. 195 * dir = Direction to resize from. This is only really applicable to layout widgets.
190 * It must be either -1 (start resizing from highest row/col index, decreasing the 196 * It must be either -1 (start resizing from highest row/col index, decreasing the
191 * index as necessary), or +1 (resize from the lowest index, i.e. 0). 197 * index as necessary), or +1 (resize from the lowest index, i.e. 0).
192 * Most widgets can simply ignore it. 198 * Most widgets can simply ignore it.
193 * 199 *
194 * If called with dimensions less than minWidth/minHeight return: the widget may set its size 200 * A widget should never be resized smaller than it's minimal size (if it is, it should assume
195 * to either the dimension given or its minimal dimension (even though this is larger). If the 201 * it's minimal size and print a warning when in debug mode).
196 * larger size is set, events won't be received in the extra area. FIXME: sort out rendering. 202 * A "fixed" size widget should enlarge itself as requested.
197 * Otherwise, the dimensions should always be set exactly.
198 * 203 *
199 * setPosition must be called after calling either setWidth or setHeight. */ 204 * setPosition must be called after calling either setWidth or setHeight. */
200 void setWidth (wdim nw, int dir); 205 void setWidth (wdim nw, int dir);
201 void setHeight (wdim nh, int dir); /// ditto 206 void setHeight (wdim nh, int dir); /// ditto
202 207