comparison mde/gui/types.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
children 08a4ae11454b
comparison
equal deleted inserted replaced
79:61ea26abe4dd 80:ea58f277f487
1 /* LICENSE BLOCK
2 Part of mde: a Modular D game-oriented Engine
3 Copyright © 2007-2008 Diggory Hardy
4
5 This program is free software: you can redistribute it and/or modify it under the terms
6 of the GNU General Public License as published by the Free Software Foundation, either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16 /*************************************************************************************************
17 * Basic data types used by widgets.
18 *************************************************************************************************/
19 module mde.gui.types;
20
21
22 /** Widget ID type. Each ID is unique under this window.
23 *
24 * Type is int since this is the widget data type. */
25 alias char[] widgetID;
26
27 /** Window coordinate and dimension/size type (int).
28 *
29 * Used to disambiguate between general integers and coordinates; all widget positions/sizes should
30 * use this type (or one of the aliases below).
31 *
32 * Aliases of wdim providing extra information about what their contents hold: absolute position,
33 * position relative to the containing widget (wdrel should not be used if relative to anything
34 * else), or size. Their use instead of wdim is optional (and in some cases wdim values aren't of
35 * any of these types). Also don't use these aliases for variables which may also be used to other
36 * effects, e.g. if they can have special values with special meanings. */
37 typedef int wdim;
38 alias wdim wdabs; /// ditto
39 alias wdim wdrel; /// ditto
40 alias wdim wdsize; /// ditto
41
42 /** A pair of wdim variables, and strictly no other data (methods may be added if deemed useful).
43 *
44 * Potentially usable to return two wdim variables, e.g. width and height, from a function.
45 * However, the current usage of out variables looks like it's better. */
46 struct wdimPair {
47 wdim x, y; /// data
48 }
49
50
51 /*************************************************************************************************
52 * The data type all widgets creatable by the widget manager receive on creation.
53 *
54 * Conversion code to/from MT tags is contained in the addTag and writeAll methods of
55 * WidgetDataSet and WidgetDataChanges.
56 *************************************************************************************************/
57 struct WidgetData
58 {
59 int[] ints; /// Integer data
60 char[][] strings; /// char[] data
61
62 /** For creating a DebugWidget. */
63 static WidgetData dbg = { ints : [0xF] }; // 0xf is current code for debug widget
64 }