diff mde/gui/widget/TextWidget.d @ 163:24d77c52243f

Provided sensible conversions for setting the value of one AStringContent from another, along with unittest. Updated layout and Translation unittests to run.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 23 May 2009 15:47:32 +0200
parents 2476790223b8
children 55667d048c31
line wrap: on
line diff
--- a/mde/gui/widget/TextWidget.d	Fri May 22 19:59:22 2009 +0200
+++ b/mde/gui/widget/TextWidget.d	Sat May 23 15:47:32 2009 +0200
@@ -150,18 +150,21 @@
     
     /** On click, request keyboard input. */
     override int clickEvent (wdabs cx, wdabs, ubyte, bool state) {
-	if (state) {
-	    //adapter.index = content_.editIndex;
+	if (state)
+	    return 2;
+	else {
 	    content_.editIndex = adapter.setIndex (cx - x);
 	    mgr.requestRedraw;
-	    return 3;	// get keyboard input via keyEvent
+	    return 1;	// get keyboard input via keyEvent
 	}
     }
     
     override bool dragRelease (wdabs, wdabs, IChildWidget widg) {
-	if (widg !is this)	// don't copy content to self
+	if (widg !is this) {	// don't copy content to self
 	    widg.dropContent (content_);
-	return true;
+	    return true;	// don't pass click as well as copy
+	}
+	return false;
     }
     
     override void keyEvent (ushort s, char[] i) {
@@ -176,13 +179,14 @@
 	mgr.requestRedraw;
     }
     override void keyFocusLost () {
-	adapter.text = content_.endEdit;	// update other users of content_ relying on callbacks
+	content_.endEdit;
+	adapter.text = content_.toString (0);
 	adapter.index;
 	mgr.requestRedraw;
     }
     
     override bool dropContent (IContent content) {
-	if (content_.setContent (content))
+	if (content_.set (content))
 	    return true;
 	return parent.dropContent (content);
     }