diff mde/gui/widget/miscContent.d @ 116:5ee69b3ed9c9

Partial implementation of infinite widget recursion protection; some cleanup. Implemented recursion protection which only allowed unsafe widgets to be instantiated once; realised this was far too restrictive (multiple sibling instances are needed) and a check against parent widgets would be needed. Could be implemented by passing widgets a reference to parents. Removed ButtonWidget aka First interactible widget.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 21 Dec 2008 12:03:50 +0000
parents 1b1e2297e2fc
children d28aea50c6da
line wrap: on
line diff
--- a/mde/gui/widget/miscContent.d	Sat Dec 20 17:57:05 2008 +0000
+++ b/mde/gui/widget/miscContent.d	Sun Dec 21 12:03:50 2008 +0000
@@ -27,7 +27,6 @@
 import mde.gui.renderer.IRenderer;
 import mde.content.AStringContent;
 import mde.content.miscContent;
-import Items = mde.content.Items;
 
 debug {
     import tango.util.log.Log : Log, Logger;
@@ -38,27 +37,13 @@
 }
 
 /*************************************************************************************************
- * A function which uses Items.get (data.strings[0]) to get a content and creates a widget from
- * data.ints[1]. The first item in each ints and strings is removed before passing data to the new
- * widget.
- * 
- * The function only takes an IContent parameter to satisfy createWidget; it's value is ignored.
- *************************************************************************************************/
-IChildWidget addContent (IWidgetManager mgr, widgetID id, WidgetData data, IContent) {
-    if (data.ints.length < 2 || data.strings.length < 1) throw new WidgetDataException;
-    char[] cItem = data.strings[0];
-    data.strings = data.strings[1..$];
-    data.ints    = data.ints   [1..$];
-    return mgr.makeWidget (id, data, Items.get (cItem));
-}
-
-/*************************************************************************************************
  * A function which returns the most appropriate content editing widget.
  *
  * Widgets which can be returned: BoolContentWidget (toggle button), ValueContentWidget (generic
  * text-box editor), DisplayContentWidget (generic text label).
  *************************************************************************************************/
 IChildWidget editContent (IWidgetManager mgr, widgetID id, WidgetData data, IContent c) {
+    // Note: SAFE_RECURSION enabled
     if (c is null) throw new ContentException;
     else if (cast(AStringContent) c) {
         if (cast(EnumContent) c)	// can be PopupMenuWidget or ContentListWidget