diff mde/gui/widget/Ifaces.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 ccd01fde535e
children 55667d048c31
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d	Thu May 21 22:15:40 2009 +0200
+++ b/mde/gui/widget/Ifaces.d	Fri May 22 19:59:22 2009 +0200
@@ -35,6 +35,33 @@
 
 
 /******************************************************************************
+ * The root widget interface, for methods required by both IParentWidget and
+ * IChildWidget.
+ *****************************************************************************/
+interface IWidget
+{
+    
+    /** Called on a widget when something is dragged onto it.
+     *
+     * Generally, content editing widgets should implement this as:
+     * ---
+    override bool dropContent (IContent content) {
+	if (content_.setContent (content))
+	    return true;
+	return parent.dropContent (content);
+    }
+     * ---
+     * And other widgets should just:
+     * ---
+     * return parent.dropContent (content);
+     * ---
+     *
+     * Returns: true if the content was received (false if it reaches the
+     *	WidgetManager and is still not used). */
+    bool dropContent (IContent content);
+}
+
+/******************************************************************************
  * Interface for parent widgets, including IWidgetManager.
  *
  * All widgets implement this via AWidget to make things simpler (code sharing).
@@ -44,7 +71,7 @@
  *  Layout widget: a widget containing multiple sub-widges (which hence
  *   controls how they are laid out).
  *****************************************************************************/
-interface IParentWidget
+interface IParentWidget : IWidget
 {
     /** Checks for recursion of unsafe widgets to prevent infinite recursion. */
     void recursionCheck (widgetID, IContent);
@@ -273,7 +300,7 @@
  * during their creation.
  *****************************************************************************/
 //NOTE: add another this() without the data for default initialization, for the GUI editor?
-interface IChildWidget
+interface IChildWidget : IWidget
 {
 //BEGIN Load and save
     /** 2nd stage of initialization for widgets; also called on some changes.