Mercurial > projects > mde
comparison mde/gui/widget/layout.d @ 115:1b1e2297e2fc
Enums handled more generically now via either a popup list or flat list of BoolContentWidgets.
EnumContent is an IContentList with BoolContent sub-contents.
Content modules moved around (again).
ContentListWidget can now list horizontally.
Log-level setting callback.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 20 Dec 2008 17:57:05 +0000 |
parents | b16a534f5302 |
children | 9ac208b53582 |
comparison
equal
deleted
inserted
replaced
114:b16a534f5302 | 115:1b1e2297e2fc |
---|---|
17 module mde.gui.widget.layout; | 17 module mde.gui.widget.layout; |
18 | 18 |
19 import mde.gui.widget.Widget; | 19 import mde.gui.widget.Widget; |
20 import mde.gui.exception; | 20 import mde.gui.exception; |
21 | 21 |
22 import mde.content.Content; | 22 import mde.content.miscContent; |
23 | 23 |
24 import tango.util.container.HashMap; | 24 import tango.util.container.HashMap; |
25 | 25 |
26 debug { | 26 debug { |
27 import tango.util.log.Log : Log, Logger; | 27 import tango.util.log.Log : Log, Logger; |
97 * ContentList. | 97 * ContentList. |
98 *************************************************************************************************/ | 98 *************************************************************************************************/ |
99 class ContentListWidget : GridWidget | 99 class ContentListWidget : GridWidget |
100 { | 100 { |
101 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content) { | 101 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content) { |
102 cList = cast(ContentList) content; | 102 cList = cast(IContentList) content; |
103 WDCCheck (data, 2, 1, cList); | 103 WDCCheck (data, 2, 1, cList); |
104 | 104 |
105 cols = 1; | 105 cols = 1; |
106 if ((rows = cList.list.length) > 0) { | 106 if ((rows = cList.list.length) > 0) { |
107 subWidgets.length = rows; | 107 subWidgets.length = rows; |
110 } | 110 } |
111 } else { | 111 } else { |
112 rows = 1; | 112 rows = 1; |
113 subWidgets = [mgr.makeWidget (data.strings[0], new ErrorContent ("<empty list>"))]; | 113 subWidgets = [mgr.makeWidget (data.strings[0], new ErrorContent ("<empty list>"))]; |
114 } | 114 } |
115 if (data.ints[1] & 8) { // orient horizontally | |
116 cols = rows; | |
117 rows = 1; | |
118 } | |
115 super (mgr, id, data); | 119 super (mgr, id, data); |
116 } | 120 } |
117 | 121 |
118 override bool saveChanges () { | 122 override bool saveChanges () { |
119 // Since all sub-widgets have the same id, it only makes sense to call on one | 123 // Since all sub-widgets have the same id, it only makes sense to call on one |
121 return false; | 125 return false; |
122 return subWidgets[0].saveChanges; | 126 return subWidgets[0].saveChanges; |
123 } | 127 } |
124 | 128 |
125 private: | 129 private: |
126 ContentList cList; | 130 IContentList cList; |
127 } | 131 } |
128 | 132 |
129 | 133 |
130 /************************************************************************************************* | 134 /************************************************************************************************* |
131 * Backend for grid-based (includes column/row) layout widgets. | 135 * Backend for grid-based (includes column/row) layout widgets. |