comparison mde/gui/widget/Widget.d @ 65:891211f034f2

Changes to widgets: widgets may now get strings as creation data. Strings for TextWidgets can be set in files (in a temporary mannor).
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 29 Jun 2008 15:40:37 +0100
parents d43523ed4b62
children f54ae4fc2b2f
comparison
equal deleted inserted replaced
64:cc3763817b8a 65:891211f034f2
30 * IWidget); they are simply provided for convenience and to promote code reuse. */ 30 * IWidget); they are simply provided for convenience and to promote code reuse. */
31 abstract class Widget : IWidget 31 abstract class Widget : IWidget
32 { 32 {
33 //BEGIN Load and save 33 //BEGIN Load and save
34 // Base this(). All widgets must check data.length is correct before calling this method. 34 // Base this(). All widgets must check data.length is correct before calling this method.
35 // The widget ID is saved to widgetType, for correct saving.
35 this (IWindow wind, int[] data) { 36 this (IWindow wind, int[] data) {
36 window = wind; 37 window = wind;
37 widgetType = data[0]; 38 widgetType = data[0];
38 } 39 }
39 40
112 } 113 }
113 114
114 /** A base for fixed-size widgets taking their size from the creation data. */ 115 /** A base for fixed-size widgets taking their size from the creation data. */
115 class FixedWidget : Widget { 116 class FixedWidget : Widget {
116 // Check data.length is at least 3 before calling! 117 // Check data.length is at least 3 before calling!
118 /** Constructor for a fixed-size [blank] widget.
119 *
120 * Widget uses the initialisation data:
121 * [widgetID, w, h]
122 * where w, h is the fixed size. */
117 this (IWindow wind, int[] data) { 123 this (IWindow wind, int[] data) {
118 mw = cast(wdim) data[1]; 124 mw = cast(wdim) data[1];
119 mh = cast(wdim) data[2]; 125 mh = cast(wdim) data[2];
120 super (wind, data); 126 super (wind, data);
121 w = mw; 127 w = mw;
127 } 133 }
128 } 134 }
129 /** A base for resizable widgets. */ 135 /** A base for resizable widgets. */
130 class SizableWidget : Widget { 136 class SizableWidget : Widget {
131 // Check data.length is at least 1 before calling! 137 // Check data.length is at least 1 before calling!
138 /// Constructor for a completely resizable [blank] widget.
132 this (IWindow wind, int[] data) { 139 this (IWindow wind, int[] data) {
133 super (wind, data); 140 super (wind, data);
134 } 141 }
135 142
136 bool isWSizable () { return true; } 143 bool isWSizable () { return true; }