Mercurial > projects > dynamin
comparison dynamin/gui/container.d @ 58:712ea1ea845a
Add some comments
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Sat, 08 Aug 2009 17:16:11 -0500 |
parents | 1db4cb3abbb0 |
children | 60832e1eef04 |
comparison
equal
deleted
inserted
replaced
57:1db4cb3abbb0 | 58:712ea1ea845a |
---|---|
336 | 336 |
337 protected void remove(Control child) { | 337 protected void remove(Control child) { |
338 _children.remove(child); | 338 _children.remove(child); |
339 } | 339 } |
340 | 340 |
341 int opApply(int delegate(inout Control item) dg) { | 341 /** |
342 * Calls the specified delegate with each child of this container, for | |
343 * use with foreach. | |
344 */ | |
345 int opApply(int delegate(ref Control item) dg) { | |
342 for(uint i = 0; i < _children.count; ++i) { | 346 for(uint i = 0; i < _children.count; ++i) { |
343 auto tmp = _children[i]; | 347 auto tmp = _children[i]; |
344 if(int result = dg(tmp)) | 348 if(int result = dg(tmp)) |
345 return result; | 349 return result; |
346 } | 350 } |
347 return 0; | 351 return 0; |
348 } | 352 } |
349 int opApply(int delegate(inout uint index, inout Control item) dg) { | 353 /// ditto |
354 int opApply(int delegate(ref uint index, ref Control item) dg) { | |
350 for(uint i = 0; i < _children.count; ++i) { | 355 for(uint i = 0; i < _children.count; ++i) { |
351 auto tmp = _children[i]; | 356 auto tmp = _children[i]; |
352 if(int result = dg(i, tmp)) | 357 if(int result = dg(i, tmp)) |
353 return result; | 358 return result; |
354 } | 359 } |
419 list.add(c); | 424 list.add(c); |
420 assert(list.data == [cast(Control)container1, control1, container2, | 425 assert(list.data == [cast(Control)container1, control1, container2, |
421 control2, control3]); | 426 control2, control3]); |
422 } | 427 } |
423 | 428 |
429 /// | |
424 class Panel : Container { | 430 class Panel : Container { |
431 /// | |
425 ControlList children() { return _children; } | 432 ControlList children() { return _children; } |
433 /// | |
426 void add(Control child) { super.add(child); }; | 434 void add(Control child) { super.add(child); }; |
435 /// | |
427 void remove(Control child) { super.remove(child); }; | 436 void remove(Control child) { super.remove(child); }; |
428 int opApply(int delegate(inout Control item) dg) { | 437 /// |
438 int opApply(int delegate(ref Control item) dg) { | |
429 return super.opApply(dg); | 439 return super.opApply(dg); |
430 } | 440 } |
431 int opApply(int delegate(inout uint index, inout Control item) dg) { | 441 /// |
442 int opApply(int delegate(ref uint index, ref Control item) dg) { | |
432 return super.opApply(dg); | 443 return super.opApply(dg); |
433 } | 444 } |
434 } | 445 } |
435 | 446 |