comparison mde/gui/widget/miscContent.d @ 114:b16a534f5302

Changes for tango r4201. Added override keyword in a lot of places.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 19 Dec 2008 15:15:06 +0000
parents 9824bee909fd
children 1b1e2297e2fc
comparison
equal deleted inserted replaced
113:9824bee909fd 114:b16a534f5302
83 w = mw = s.x; 83 w = mw = s.x;
84 h = mh = s.y; 84 h = mh = s.y;
85 super (mgr, id, data); 85 super (mgr, id, data);
86 } 86 }
87 87
88 void draw () { 88 override void draw () {
89 mgr.renderer.drawToggle (x,y, content(), pushed); 89 mgr.renderer.drawToggle (x,y, content(), pushed);
90 } 90 }
91 91
92 void activated () { 92 override void activated () {
93 content = !content(); 93 content = !content();
94 } 94 }
95 95
96 protected: 96 protected:
97 BoolContent content; 97 BoolContent content;
105 WDCCheck (data, 1,0, content); 105 WDCCheck (data, 1,0, content);
106 adapter = mgr.renderer.getAdapter (); 106 adapter = mgr.renderer.getAdapter ();
107 super (mgr, id, data); 107 super (mgr, id, data);
108 } 108 }
109 109
110 bool setup (uint n, uint flags) { 110 override bool setup (uint n, uint flags) {
111 if (!(flags & 3)) return false; // string or renderer (and possibly font) changed 111 if (!(flags & 3)) return false; // string or renderer (and possibly font) changed
112 adapter.text = content.toString(1); 112 adapter.text = content.toString(1);
113 adapter.getDimensions (mw, mh); 113 adapter.getDimensions (mw, mh);
114 if (mw != w || mh != h) { 114 if (mw != w || mh != h) {
115 w = mw; 115 w = mw;
116 h = mh; 116 h = mh;
117 } 117 }
118 return true; 118 return true;
119 } 119 }
120 120
121 void draw () { 121 override void draw () {
122 super.draw(); 122 super.draw();
123 adapter.draw (x,y); 123 adapter.draw (x,y);
124 } 124 }
125 125
126 void activated () { 126 override void activated () {
127 content.endEvent; 127 content.endEvent;
128 } 128 }
129 129
130 protected: 130 protected:
131 IRenderer.TextAdapter adapter; 131 IRenderer.TextAdapter adapter;
132 EventContent content; 132 EventContent content;
133 int index; 133 int index;
134 } 134 }
135 /// Pops up a list of selectable values 135 /// Pops up a list of selectable values
136 class EnumContentWidget : AButtonWidget 136 class EnumContentWidget : AButtonWidget
137 { 137 {
138 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { 138 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) {
152 adapter.getDimensions (mw, mh); 152 adapter.getDimensions (mw, mh);
153 w = mw; 153 w = mw;
154 h = mh; 154 h = mh;
155 } 155 }
156 156
157 void activated () { 157 override void activated () {
158 mgr.addPopup (this, internalWidg); 158 mgr.addPopup (this, internalWidg);
159 } 159 }
160 160
161 void draw () { 161 override void draw () {
162 super.draw; 162 super.draw;
163 adapter.draw (x,y); 163 adapter.draw (x,y);
164 } 164 }
165 165
166 protected: 166 protected:
189 w = mw; 189 w = mw;
190 h = mh; 190 h = mh;
191 super (mgr, id, data); 191 super (mgr, id, data);
192 } 192 }
193 193
194 void draw () { 194 override void draw () {
195 super.draw; 195 super.draw;
196 foreach (i,yp; yPos) { 196 foreach (i,yp; yPos) {
197 adapters[i].draw (x,y+yp); 197 adapters[i].draw (x,y+yp);
198 } 198 }
199 } 199 }
200 200
201 /// Called when a mouse click event occurs while held; handles up-click 201 /// Called when a mouse click event occurs while held; handles up-click
202 bool clickWhilePushed (wdabs cx, wdabs cy, ubyte b, bool state) { 202 override bool clickWhilePushed (wdabs cx, wdabs cy, ubyte b, bool state) {
203 if (b == 1 && state == false) { 203 if (b == 1 && state == false) {
204 cy -= y; 204 cy -= y;
205 if (cx >= x && cx < x+w && cy >= 0 && cy < h) { 205 if (cx >= x && cx < x+w && cy >= 0 && cy < h) {
206 uint i = yPos.length-1; 206 uint i = yPos.length-1;
207 for (; i > 0; --i) 207 for (; i > 0; --i)
220 return true; 220 return true;
221 } 221 }
222 return false; 222 return false;
223 } 223 }
224 224
225 void activated () {} 225 override void activated () {}
226 226
227 protected: 227 protected:
228 EnumContent content; 228 EnumContent content;
229 IRenderer.TextAdapter[] adapters; // NOTE: replace with multi-line adapter 229 IRenderer.TextAdapter[] adapters; // NOTE: replace with multi-line adapter
230 wdrel[] yPos; // y position of each adapter 230 wdrel[] yPos; // y position of each adapter