Mercurial > projects > mde
diff mde/gui/content/Content.d @ 104:ee209602770d
Cleaned up Options.d removing old storage method. It's now possible to get a ContentList of the whole of Options.
Tweaked translation strings (added name and desc to Options classes).
Replaced Options.addSubClass (class, "name") with Options.this("name").
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 26 Nov 2008 13:07:46 +0000 |
parents | 42e241e7be3e |
children |
line wrap: on
line diff
--- a/mde/gui/content/Content.d Tue Nov 25 18:01:44 2008 +0000 +++ b/mde/gui/content/Content.d Wed Nov 26 13:07:46 2008 +0000 @@ -65,20 +65,25 @@ /** A generic way to handle a list of type IContent. */ class ContentList : IContent { - this (IContent[] list = null) { + this (IContent[] list = null, char[] n = null, char[] d = null) { list_ = list; + name_ = n; + desc_ = d; } - this (ValueContent[char[]] l) { + this (ValueContent[char[]] l, char[] n = null, char[] d = null) { list_.length = l.length; size_t i; foreach (c; l) list_[i++] = c; + name_ = n; + desc_ = d; } char[] toString (uint i) { return i == 0 ? Int.toString (list_.length) ~ " elements" - : i == 1 ? "ContentList" - : null; + : i == 1 ? name_ + : i == 2 ? desc_ + : null; } IContent[] list () { @@ -91,6 +96,7 @@ protected: IContent[] list_; + char[] name_, desc_; // name and description } /** Created on errors to display and log a message. */ @@ -135,9 +141,9 @@ /// Get the text. char[] toString (uint i) { - return (i == 0) ? sv - : (i == 1) ? name_ - : (i == 2) ? desc_ + return i == 0 ? sv + : i == 1 ? name_ + : i == 2 ? desc_ : null; } @@ -201,7 +207,7 @@ char[] sv; // string of value; updated on assignment for displaying and editing size_t pos; // editing position; used by keyStroke char[] symb; - char[] name_, desc_;// name and description, loaded by lookup.Translation + char[] name_, desc_;// name and description } template VContentN(T) {