Mercurial > projects > mde
diff mde/gui/widget/TextWidget.d @ 172:0dd49f333189
Implemented "void setContent (IContent)".
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 29 Jul 2009 20:28:22 +0200 |
parents | e45226d3deae |
children | 3d58adc17d20 |
line wrap: on
line diff
--- a/mde/gui/widget/TextWidget.d Sun Jul 26 11:04:17 2009 +0200 +++ b/mde/gui/widget/TextWidget.d Wed Jul 29 20:28:22 2009 +0200 @@ -109,6 +109,15 @@ override IContent content () { return content_; } + override void setContent (IContent c) { + auto cont = cast(Content) c; + if (!cont) { + logger.warn ("DisplayContentWidget: invalid content set: {}; ignoring", c); + return; + } + content_ = cont; + updateVal (content_); + } protected: void updateVal (IContent) { // callback @@ -140,6 +149,16 @@ override IContent content () { return content_; } + override void setContent (IContent c) { + content_.endEdit; // save in case we were editing (FIXME: this has other side effects?) + auto cont = cast(AStringContent) c; + if (!cont) { + logger.warn ("AStringContentWidget: invalid content set: {}; ignoring", c); + return; + } + content_ = cont; + update (content_); + } override bool isWSizable () { return true;