diff mde/gui/widget/Ifaces.d @ 90:b525ff28774b

Widgets generated dynamically from a list can now be standard widgets selected from data files. Started on allowing alignment to be shared between instances of a layout widget in a dynamic list (to allow column alignment of list's rows).
author Diggory Hardy <diggory.hardy@gmail.com>
date Wed, 01 Oct 2008 23:37:51 +0100
parents 56c0ddd90193
children 4d5d53e4f881
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d	Mon Sep 29 18:27:17 2008 +0100
+++ b/mde/gui/widget/Ifaces.d	Wed Oct 01 23:37:51 2008 +0100
@@ -25,6 +25,7 @@
 
 public import mde.gui.types;
 public import mde.gui.renderer.IRenderer;
+import mde.gui.content.Content; //NOTE - maybe move IContent to a separate module
 
 
 /*************************************************************************************************
@@ -46,21 +47,19 @@
  * 
  * This class handles widget rendering, input, loading and saving.
  *************************************************************************************************/
-interface IWidgetManager : IParentWidget
+interface IWidgetManager : IWidget
 {
     // Loading/saving:
     /** Create a widget by ID.
      *
      * Params:
      *  id      = Identifier, within data files, of the data for the widget.
-     *  parent  = Reference to the widget's parent, passed if the widget supports recieving it.
+     *  content = An IContent may be passed to some widgets on creation.
      *
      * Creates a widget, using the widget data with index id. Widget data is loaded from files,
      * and per design (multiple gui layouts, called designs, may exist; data is per design).
-     * 
-     * Note: this method is only for widgets with an identifier; generic widgets instanciated in
-     * lists are created directly and have no WidgetData of their own. */
-    IChildWidget makeWidget (widgetID id, IParentWidget parent = null);
+     */
+    IChildWidget makeWidget (widgetID id, IContent content = null);
     
     /** Record some changes, for saving. */
     void setData (widgetID id, WidgetData);
@@ -106,22 +105,11 @@
 
 
 /*************************************************************************************************
- * Interface for parent widgets, including the gui manager.
- *
- * A widget may call these methods on its parent, and on the gui manager.
- *************************************************************************************************/
-interface IParentWidget : IWidget
-{
-    // NOTE: Likely some day this interface will really be used.
-    // NOTE: What widget is NOT going to implement this? It will probably be inherited.
-}
-
-
-/*************************************************************************************************
  * Interface for (child) widgets, i.e. all widgets other than the manager.
  *
  * A widget is a region of a GUI window which handles rendering and user-interaction for itself
- * and is able to communicate with its manager and parent/child widgets as necessary.
+ * and is able to communicate with its manager and child widgets as necessary. (Passing widgets
+ * a reference to their parent has not been found useful.)
  *
  * If a widget is to be creatable by IWidgetManager.makeWidget, it must be listed in the
  * createWidget module, and have a constructor of the following form. It should also update it's
@@ -135,6 +123,9 @@
  *  + [widgetID, x, y]
  *  + where x is ... and y is ... +/
  * this (IWidgetManager mgr, WidgetData data);
+ * 
+ * /// The CTOR may take an IContent reference:
+ * this (IWidgetManager mgr, WidgetData data, IContent content);
  * ----------------------------------
  * Where mgr is the widget manager and data is
  * initialisation data. The method should throw a WidgetDataException (created without