diff mde/content/Content.d @ 162:2476790223b8

First drag and drop support: can drag from AStringContentWidget to any content editable. No visual feedback while dragging.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 22 May 2009 19:59:22 +0200
parents 9f035cd139c6
children 24d77c52243f
line wrap: on
line diff
--- a/mde/content/Content.d	Thu May 21 22:15:40 2009 +0200
+++ b/mde/content/Content.d	Fri May 22 19:59:22 2009 +0200
@@ -116,13 +116,6 @@
 	return this;
     }
     
-    override char[] toString (uint i) {
-	return i == 0 ? "No value"
-	: i == 1 ? name_
-	: i == 2 ? desc_
-	: null;
-    }
-    
     /** End of an event, e.g. a button release or end of an edit (calls callbacks).
      *
      * Content holding a value should override this, setting its new value in
@@ -136,6 +129,19 @@
 	    dg (this);
     }
     
+    override char[] toString (uint i) {
+	return i == 0 ? "No value"
+	: i == 1 ? name_
+	: i == 2 ? desc_
+	: null;
+    }
+    
+    /** A naive implementation which assumes the passed content is
+     * incompatible. */
+    override bool setContent (IContent) {
+	return false;
+    }
+    
 protected:
     char[] symbol;
     char[] name_, desc_;	// translated name and description
@@ -184,6 +190,15 @@
         list_ ~= x;
     }
     
+    override bool setContent (IContent c) {
+	IContentList cl = cast (IContentList) c;
+	if (cl !is null) {
+	    list_ = cl.list();
+	    return true;
+	}
+	return false;
+    }
+    
 protected:
     final Content[] list_;
 }