Mercurial > projects > mde
diff mde/gui/widget/Ifaces.d @ 80:ea58f277f487
Gui reorganization and changes; partial implementation of floating widgets.
Moved contents of mde/gui/WidgetData.d elsewhere; new gui/WidgetDataSet.d and gui/types.d modules.
Changes to widget/createWidget.d
Partially implemented FloatingAreaWidget to provide an area for floating "window" widgets.
New DebugWidget and some uses of it (e.g. bad widget data).
Decoupled OptionChanges from Options.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 07 Aug 2008 11:25:27 +0100 |
parents | 79a1809421aa |
children | 56c0ddd90193 |
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d Tue Aug 05 11:51:51 2008 +0100 +++ b/mde/gui/widget/Ifaces.d Thu Aug 07 11:25:27 2008 +0100 @@ -23,41 +23,10 @@ *************************************************************************************************/ module mde.gui.widget.Ifaces; +public import mde.gui.types; public import mde.gui.renderer.IRenderer; -/** Widget ID type. Each ID is unique under this window. - * - * Type is int since this is the widget data type. */ -alias char[] widgetID; - -/** Window coordinate and dimension/size type (int). - * - * Used to disambiguate between general integers and coordinates; all widget positions/sizes should - * use this type (or one of the aliases below). - * - * --- - * typedef int wdim; // Declared in IRenderer to avoid a circular import. - * --- - * - * Aliases of wdim providing extra information about what their contents hold: absolute position, - * position relative to the containing widget (wdrel should not be used if relative to anything - * else), or size. Their use instead of wdim is optional (and in some cases wdim values aren't of - * any of these types). Also don't use these aliases for variables which may also be used to other - * effects, e.g. if they can have special values with special meanings. */ -alias wdim wdabs; -alias wdim wdrel; /// ditto -alias wdim wdsize; /// ditto - -/** A pair of wdim variables, and strictly no other data (methods may be added if deemed useful). - * - * Potentially usable to return two wdim variables, e.g. width and height, from a function. - * However, the current usage of out variables looks like it's better. */ -struct wdimPair { - wdim x, y; /// data -} - - /************************************************************************************************* * Common interface for all widgets. * @@ -82,12 +51,16 @@ // Loading/saving: /** Create a widget by ID. * + * Params: + * id = Identifier, within data files, of the data for the widget. + * parent = Reference to the widget's parent, passed if the widget supports recieving it. + * * Creates a widget, using the widget data with index id. Widget data is loaded from files, * and per design (multiple gui layouts, called designs, may exist; data is per design). * - * Note: this method is only for "named" widgets; generic widgets instanciated in lists are - * created differently. */ - IChildWidget makeWidget (widgetID id); + * Note: this method is only for widgets with an identifier; generic widgets instanciated in + * lists are created directly and have no WidgetData of their own. */ + IChildWidget makeWidget (widgetID id, IParentWidget parent = null); /** Record some changes, for saving. */ void setData (widgetID id, WidgetData); @@ -266,16 +239,3 @@ * part of the widget is visible: scroll bars or a hidden window. */ void draw (); } - - -/************************************************************************************************* - * The data type all widgets creatable by the widget manager receive on creation. - * - * Conversion code to/from MT tags is contained in the addTag and writeAll methods of - * WidgetDataSet and WidgetDataChanges. - *************************************************************************************************/ -struct WidgetData -{ - int[] ints; - char[][] strings; -}