comparison mde/gui/widget/createWidget.d @ 77:3dfd934100f7

Continuing widget data changes started in last commit: all previous widgets work again now (but lacking saving).
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 29 Jul 2008 17:11:22 +0100
parents 25cb7420dc91
children ea58f277f487
comparison
equal deleted inserted replaced
76:65780e0e48e6 77:3dfd934100f7
18 18
19 import mde.gui.widget.Ifaces; 19 import mde.gui.widget.Ifaces;
20 import mde.gui.exception : WidgetDataException; 20 import mde.gui.exception : WidgetDataException;
21 21
22 // Widgets to create: 22 // Widgets to create:
23 //import mde.gui.widget.layout; 23 import mde.gui.widget.layout;
24 import mde.gui.widget.miscWidgets; 24 import mde.gui.widget.miscWidgets;
25 //import mde.gui.widget.TextWidget; 25 import mde.gui.widget.TextWidget;
26 26
27 /** Create a widget of type data[0] (see enum WIDGET_TYPES) under manager mgr, with initialisation 27 /** Create a widget of type data[0] (see enum WIDGET_TYPES) under manager mgr, with initialisation
28 * data [1..$]. */ 28 * data [1..$]. */
29 IChildWidget createWidget (IWidgetManager mgr, WidgetData data) 29 IChildWidget createWidget (IWidgetManager mgr, WidgetData data)
30 in { 30 in {
54 HSIZABLE = 0x2000, // vertically resizable 54 HSIZABLE = 0x2000, // vertically resizable
55 INTERACTIBLE = 0x4000, // any specific interaction 55 INTERACTIBLE = 0x4000, // any specific interaction
56 LAYOUT = 0x8000, // is a layout widget (i.e. has sub-widgets)? 56 LAYOUT = 0x8000, // is a layout widget (i.e. has sub-widgets)?
57 57
58 // Use widget names rather than usual capitals convention 58 // Use widget names rather than usual capitals convention
59 Unnamed = 0x0, // Only for use by widgets not created with createWidget
59 60
60 // blank: 0x1 61 // blank: 0x1
61 FixedBlank = 0x1, 62 FixedBlank = 0x1,
62 SizableBlank = WSIZABLE | HSIZABLE | 0x1, 63 SizableBlank = WSIZABLE | HSIZABLE | 0x1,
63 64
75 //const char[][int] WIDGET_NAMES; 76 //const char[][int] WIDGET_NAMES;
76 77
77 // Only used for binarySearch algorithm generation; must be ordered by numerical values. 78 // Only used for binarySearch algorithm generation; must be ordered by numerical values.
78 const char[][] WIDGETS = [ 79 const char[][] WIDGETS = [
79 "FixedBlank", 80 "FixedBlank",
80 //"Text", 81 "Text",
81 //"Int", 82 "Int",
82 "SizableBlank", 83 "SizableBlank",
83 "Button", 84 "Button",
84 //"GridLayout", 85 "GridLayout",
85 /+"TrialContentLayout"+/]; 86 "TrialContentLayout"];
86 87
87 /* Generates a binary search algorithm. */ 88 /* Generates a binary search algorithm. */
88 char[] binarySearch (char[] var, char[][] consts) { 89 char[] binarySearch (char[] var, char[][] consts) {
89 if (consts.length > 3) { 90 if (consts.length > 3) {
90 return "if (" ~ var ~ " <= WIDGET_TYPE." ~ consts[$/2 - 1] ~ ") {\n" ~ 91 return "if (" ~ var ~ " <= WIDGET_TYPE." ~ consts[$/2 - 1] ~ ") {\n" ~