comparison mde/gui/widget/Ifaces.d @ 146:783969f4665c

Simple, inefficient context menus (displaying content description).
author Diggory Hardy <diggory.hardy@gmail.com>
date Wed, 11 Feb 2009 12:00:12 +0000
parents 66c58e5b0062
children c67d074a7111
comparison
equal deleted inserted replaced
145:1048b5c7cab1 146:783969f4665c
29 *****************************************************************************/ 29 *****************************************************************************/
30 module mde.gui.widget.Ifaces; 30 module mde.gui.widget.Ifaces;
31 31
32 public import mde.gui.types; 32 public import mde.gui.types;
33 public import mde.gui.renderer.IRenderer; 33 public import mde.gui.renderer.IRenderer;
34 import mde.content.IContent; 34 public import mde.content.IContent;
35 35
36 36
37 /****************************************************************************** 37 /******************************************************************************
38 * Interface for parent widgets, including IWidgetManager. 38 * Interface for parent widgets, including IWidgetManager.
39 * 39 *
197 WidgetData widgetData (widgetID id); 197 WidgetData widgetData (widgetID id);
198 void widgetData (widgetID id, WidgetData data); /// ditto 198 void widgetData (widgetID id, WidgetData data); /// ditto
199 wdims dimData (widgetID id); /// ditto 199 wdims dimData (widgetID id); /// ditto
200 void dimData (widgetID id, wdims d); /// ditto 200 void dimData (widgetID id, wdims d); /// ditto
201 201
202 /** Position popup left or right of parent, or left or right of parent 202 /** Position popup below or above parent, or right or left of parent
203 * (flags & 1 == 1). */ 203 * (flags & 1 == 1). */
204 void positionPopup (IChildWidget parent, IChildWidget popup, int flags = 0); 204 void positionPopup (IChildWidget parent, IChildWidget popup, int flags = 0);
205 205
206 // Rendering: 206 // Rendering:
207 /** For when a widget needs redrawing. 207 /** For when a widget needs redrawing.
238 238
239 239
240 /****************************************************************************** 240 /******************************************************************************
241 * Interface for (child) widgets, i.e. all widgets other than the manager. 241 * Interface for (child) widgets, i.e. all widgets other than the manager.
242 * 242 *
243 * A widget is a region of a GUI window which handles rendering and user-interaction for itself 243 * A widget is a region of a GUI window which handles rendering and user-
244 * and is able to communicate with its manager and child widgets as necessary. (Passing widgets 244 * interaction for itself and is able to communicate with its manager and other
245 * a reference to their parent has not been found useful.) 245 * widgets as necessary.
246 * 246 *
247 * If a widget is to be creatable by IWidgetManager.makeWidget, it must be listed in the 247 * If a widget is to be creatable by IWidgetManager.makeWidget, it must be
248 * createWidget module, and have a constructor of the following form. It should also update it's 248 * listed in the AWidgetManager WIDGET_TYPE enum and WIDGETS list, and have a
249 * creation data if necessary, either when changed or when saveChanges() is called, using 249 * constructor of the following form.
250 * IWidgetManager.setData().
251 * It should use Ddoc to explain what initialization data is used. 250 * It should use Ddoc to explain what initialization data is used.
252 * ---------------------------------- 251 * ----------------------------------
253 * /++ Constructor for a ... widget. 252 * /++ Constructor for a ... widget.
254 * + 253 * +
255 * + Widget uses the initialisation data: 254 * + Widget uses the initialisation data:
256 * + [widgetID, x, y] 255 * + [widgetID, x, y]
257 * + where x is ... and y is ... +/ 256 * + where x is ... and y is ... +/
258 * this (IWidgetManager mgr, widgetID id, WidgetData data); 257 * this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data);
259 * 258 *
260 * /// The CTOR may take an IContent reference: 259 * /// The CTOR may take an IContent reference:
261 * this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content); 260 * this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data, IContent content);
262 * ---------------------------------- 261 * ----------------------------------
263 * Where mgr is the widget manager, id is the _id passed to makeWidget() and data is 262 * Where mgr is the widget manager, parent is the widget's _parent (another
264 * initialisation data. The method should throw a WidgetDataException (created without 263 * child widget or the widget manager), id is the _id passed to makeWidget()
265 * parameters) if the data has wrong length or is otherwise invalid. 264 * and data is initialisation _data. The method should throw a
266 * 265 * WidgetDataException if the data is invalid, and throw other GuiExceptions on
267 * All widgets should set their own size in this() or setup() (must be setup() if it could change), 266 * other errors.
268 * although some parents may set child-widgets' size during their creation. 267 *
268 * All widgets should set their own size in this() or setup() (must be setup()
269 * if it could change), although some parents may set child-widgets' size
270 * during their creation.
269 *****************************************************************************/ 271 *****************************************************************************/
270 //NOTE: add another this() without the data for default initialization, for the GUI editor? 272 //NOTE: add another this() without the data for default initialization, for the GUI editor?
271 interface IChildWidget 273 interface IChildWidget
272 { 274 {
273 //BEGIN Load and save 275 //BEGIN Load and save
302 * 304 *
303 * Should be propegated up to parents. */ 305 * Should be propegated up to parents. */
304 void childChanged (); 306 void childChanged ();
305 +/ 307 +/
306 308
309 /** Return the widget's content, or null. */
310 IContent content ();
307 //END Load and save 311 //END Load and save
308 312
309 //BEGIN Size and position 313 //BEGIN Size and position
310 /** Is the width / height resizable? 314 /** Is the width / height resizable?
311 * 315 *