Mercurial > projects > mde
comparison mde/gui/widget/textContent.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 |
---|---|
36 { | 36 { |
37 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { | 37 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { |
38 WDMinCheck(data, 1); | 38 WDMinCheck(data, 1); |
39 content = c; | 39 content = c; |
40 if (!content) throw new ContentException (); | 40 if (!content) throw new ContentException (); |
41 adapter = mgr.renderer.getAdapter (content.toString(0)); | 41 adapter = mgr.renderer.getAdapter (); |
42 adapter.text = content.toString(0); | |
42 super (mgr, id, data); | 43 super (mgr, id, data); |
43 } | 44 } |
44 | 45 |
45 protected: | 46 protected: |
46 IContent content; | 47 IContent content; |
52 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { | 53 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { |
53 WDMinCheck(data, 1); | 54 WDMinCheck(data, 1); |
54 content = cast(AStringContent) c; | 55 content = cast(AStringContent) c; |
55 if (!content) //content = new TextContent (null, null); | 56 if (!content) //content = new TextContent (null, null); |
56 throw new ContentException (); | 57 throw new ContentException (); |
57 adapter = mgr.renderer.getAdapter (content.toString(0)); | 58 adapter = mgr.renderer.getAdapter (); |
58 super (mgr, id, data); | 59 adapter.text = content.toString(0); |
60 super (mgr, id, data); | |
59 } | 61 } |
62 | |
63 bool isWSizable () { return true; } | |
64 bool isHSizable () { return true; } | |
60 | 65 |
61 /** On click, request keyboard input. */ | 66 /** On click, request keyboard input. */ |
62 int clickEvent (wdabs, wdabs, ubyte, bool state) { | 67 int clickEvent (wdabs, wdabs, ubyte, bool state) { |
63 adapter.index = content.editIndex; | 68 adapter.index = content.editIndex; |
64 mgr.requestRedraw; | 69 mgr.requestRedraw; |