comparison mde/gui/widget/textContent.d @ 105:08651e8a8c51

Quit button, big changes to content system. Moved mde.gui.content to mde.content to reflect it's not only used by the gui. Split Content module into Content and AStringContent. New AContent and EventContent class. Callbacks are now generic and implemented in AContent. Renamed TextContent to StringContent and ValueContent to AStringContent.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 29 Nov 2008 12:36:39 +0000
parents 42e241e7be3e
children 1655693702fc
comparison
equal deleted inserted replaced
104:ee209602770d 105:08651e8a8c51
19 import mde.gui.widget.Widget; 19 import mde.gui.widget.Widget;
20 import mde.gui.widget.TextWidget; 20 import mde.gui.widget.TextWidget;
21 import mde.gui.exception; 21 import mde.gui.exception;
22 import mde.gui.renderer.IRenderer; 22 import mde.gui.renderer.IRenderer;
23 23
24 import mde.gui.content.Content; 24 import mde.content.AStringContent;
25 25
26 debug { 26 debug {
27 import tango.util.log.Log : Log, Logger; 27 import tango.util.log.Log : Log, Logger;
28 private Logger logger; 28 private Logger logger;
29 static this () { 29 static this () {
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 (content.toString(0));
42 super (mgr, id, data); 42 super (mgr, id, data);
43 } 43 }
44 44
45 protected: 45 protected:
46 IContent content; 46 IContent content;
47 } 47 }
48 48
49 /// Capable of editing any ValueContent class 49 /// Capable of editing any ValueContent class
50 class ValueContentWidget : ATextWidget 50 class AStringContentWidget : ATextWidget
51 { 51 {
52 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) { 52 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) {
53 WDMinCheck(data, 1); 53 WDMinCheck(data, 1);
54 content = cast(ValueContent) c; 54 content = cast(AStringContent) c;
55 if (!content) //content = new TextContent (null, null); 55 if (!content) //content = new TextContent (null, null);
56 throw new ContentException (); 56 throw new ContentException ();
57 adapter = mgr.renderer.getAdapter (content.toString(0)); 57 adapter = mgr.renderer.getAdapter (content.toString(0));
58 super (mgr, id, data); 58 super (mgr, id, data);
59 } 59 }
76 content.endEdit; // update other users of content relying on callbacks 76 content.endEdit; // update other users of content relying on callbacks
77 mgr.requestRedraw; 77 mgr.requestRedraw;
78 } 78 }
79 79
80 protected: 80 protected:
81 ValueContent content; 81 AStringContent content;
82 } 82 }