Mercurial > projects > mde
comparison mde/gui/widget/miscContent.d @ 111:1655693702fc
Resolved ticket #4, allowing widgets to reload strings and recalculate sizes mid-run.
Removed prefinalize and finalize and added setup as the new second initialization phase, which can be re-run.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 06 Dec 2008 17:41:42 +0000 |
parents | 08651e8a8c51 |
children | fe061009029d |
comparison
equal
deleted
inserted
replaced
110:6acd96f8685f | 111:1655693702fc |
---|---|
90 { | 90 { |
91 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { | 91 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { |
92 WDCheck (data, 1); | 92 WDCheck (data, 1); |
93 content = cast(EventContent) c; | 93 content = cast(EventContent) c; |
94 if (!content) throw new ContentException (); | 94 if (!content) throw new ContentException (); |
95 adapter = mgr.renderer.getAdapter (content.toString (1)); | 95 adapter = mgr.renderer.getAdapter (); |
96 super (mgr, id, data); | |
97 } | |
98 | |
99 bool setup (uint n, uint flags) { | |
100 if (!(flags & 3)) return false; // string or renderer (and possibly font) changed | |
101 adapter.text = content.toString(1); | |
96 adapter.getDimensions (mw, mh); | 102 adapter.getDimensions (mw, mh); |
97 w = mw; | 103 if (mw != w || mh != h) { |
98 h = mh; | 104 w = mw; |
99 super (mgr, id, data); | 105 h = mh; |
106 } | |
107 return true; | |
100 } | 108 } |
101 | 109 |
102 void draw () { | 110 void draw () { |
103 super.draw(); | 111 super.draw(); |
104 adapter.draw (x,y); | 112 adapter.draw (x,y); |