diff mde/gui/widget/Ifaces.d @ 65:891211f034f2

Changes to widgets: widgets may now get strings as creation data. Strings for TextWidgets can be set in files (in a temporary mannor).
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 29 Jun 2008 15:40:37 +0100
parents d43523ed4b62
children f54ae4fc2b2f
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d	Sun Jun 29 11:55:55 2008 +0100
+++ b/mde/gui/widget/Ifaces.d	Sun Jun 29 15:40:37 2008 +0100
@@ -17,7 +17,7 @@
 module mde.gui.widget.Ifaces;
 
 public import mde.gui.renderer.IRenderer;
-import mde.gui.IGui;
+public import mde.gui.IGui;
 
 /** Interface for Window, allowing widgets to call some of Window's methods.
  *
@@ -40,9 +40,15 @@
      * been created, creates it using the Window's widget creation data. */
     IWidget makeWidget (widgetID i);
     
+    /** Get a string from the widgetString associative array. */
+    char[] getWidgetString (int i);
+    
     /** Add widget's saveData to the data to be saved, returning it's widgetID. */
     widgetID addCreationData (IWidget widget);
     
+    /** Add a string to the widgetString associative array, returning it's index. */
+    int addWidgetString (char[] str);
+    
     /** Returns the window's gui. */
     IGui gui ();
     
@@ -64,8 +70,14 @@
  * A widget is a region of a GUI window which handles rendering and user-interaction for itself
  * and is able to communicate with it's window and parent/child widgets as necessary.
  *
- * A widget's constructor should have this prototype:
+ * A widget's constructor should have the prototype and doc explaining what initialization data is
+ * used (excluding the widget ID, which every widget recieves):
  * ----------------------------------
+ * /++ Constructor for a ... widget.
+ *  +
+ *  + Widget uses the initialisation data:
+ *  + [widgetID, x, y]
+ *  + where x is ... and y is ... +/
  * this (IWindow window, int[] data);
  * ----------------------------------
  * Where window is the root window (the window to which the widget belongs) and data is an array of
@@ -95,6 +107,9 @@
     
     /** Output data suitible for recreating the widget (data to be passed to this()).
      *
+     * Function may need to call Window's addCreationData() and addWidgetString() methods to save
+     * other data.
+     *
      * Creation data is data only changed when the gui is edited. */
     int[] getCreationData ();