Mercurial > projects > mde
comparison mde/content/AStringContent.d @ 170:e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Added files missing from previous commits.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 29 Jun 2009 21:20:16 +0200 |
parents | 620d4ea30228 |
children | 1cbde9807293 |
comparison
equal
deleted
inserted
replaced
169:bc1cf73dc835 | 170:e45226d3deae |
---|---|
194 char[] sv; | 194 char[] sv; |
195 char[] svBuf; // buffer to reduce reallocs | 195 char[] svBuf; // buffer to reduce reallocs |
196 size_t pos; // editing position; used by keyStroke | 196 size_t pos; // editing position; used by keyStroke |
197 } | 197 } |
198 | 198 |
199 class BoolContent : AStringContent | 199 class BoolContent : AStringContent, IBoolContent |
200 { | 200 { |
201 /** Create a content with _symbol name symbol. */ | 201 /** Create a content with _symbol name symbol. */ |
202 this (char[] symbol) { | 202 this (char[] symbol) { |
203 auto valp = symbol in changed.boolData; | 203 auto valp = symbol in changed.boolData; |
204 if (valp) | 204 if (valp) |
212 v = val; | 212 v = val; |
213 sv = v ? "true" : "false"; | 213 sv = v ? "true" : "false"; |
214 if (pos > sv.length) pos = sv.length; | 214 if (pos > sv.length) pos = sv.length; |
215 endEvent; | 215 endEvent; |
216 } | 216 } |
217 void opAssign (bool val) { | 217 override void opAssign (bool val) { |
218 assignNoCng (val); | 218 assignNoCng (val); |
219 endCng; | 219 endCng; |
220 } | 220 } |
221 bool opCall () { | 221 override bool opCall () { |
222 return v; | 222 return v; |
223 } | 223 } |
224 alias opCall opCast; | 224 alias opCall opCast; |
225 | 225 |
226 override bool endEdit () { | 226 override bool endEdit () { |
530 | 530 |
531 /** Special version of BoolContent for each enumeration to update the | 531 /** Special version of BoolContent for each enumeration to update the |
532 * parent Enum. | 532 * parent Enum. |
533 * | 533 * |
534 * Also should not save its value, since the parent stores the value. */ | 534 * Also should not save its value, since the parent stores the value. */ |
535 //NOTE: Could extend IBoolContent instead of BoolContent now. | |
535 private class EnumValueContent : BoolContent { | 536 private class EnumValueContent : BoolContent { |
536 /** New enumeration of parent with index num. */ | 537 /** New enumeration of parent with index num. */ |
537 this (EnumContent parent, size_t num, char[] symbol) { | 538 this (EnumContent parent, size_t num, char[] symbol) { |
538 this.parent = parent; | 539 this.parent = parent; |
539 i = num; | 540 i = num; |