changeset 174:3d58adc17d20

Temporary commit to allow backup
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 31 Aug 2009 13:54:23 +0200
parents a1ba9157510e
children 1cbde9807293
files codeDoc/ideas.txt codeDoc/jobs.txt codeDoc/policies.txt data/conf/guiDemo.mtt examples/guiDemo.d mde/gui/WMScreen.d mde/gui/WidgetLoader.d mde/gui/widget/AChildWidget.d mde/gui/widget/AParentWidget.d mde/gui/widget/Floating.d mde/gui/widget/Ifaces.d mde/gui/widget/ParentContent.d mde/gui/widget/TextWidget.d mde/gui/widget/contentFunctions.d mde/gui/widget/layout.d
diffstat 15 files changed, 147 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/codeDoc/ideas.txt	Sat Aug 08 15:53:10 2009 +0200
+++ b/codeDoc/ideas.txt	Mon Aug 31 13:54:23 2009 +0200
@@ -68,29 +68,22 @@
     >   each floating/popup widget has its own renderer (last two above)
 	+>  combined rendering (to texture?) of each "layer" to enable nice transparancy
 	>   lower performance?
+> Data:
+  > remove "designs" concept from WidgetLoader:
+    > have one design per file
+    > to load multiple designs, have multiple WidgetLoaders in memory (so each just stores one set of data)
+    > pass a reference to a WidgetLoader or whatever it's called to the WidgetManager
+      > instead of class extension
+      > allows easily swapping data sets
 
 
 Content:
 ->  Per-content undo support?
->   Services:
+>   Possible extra services:
     >   All content:
-    	+>  Clipboard
     >   Some content:
     	+>  Spellchecking
     	+>  Calculator
-    -2> Fixed list of services working on IContent/Content:
-        >   Clipboard - can't store Content (callbacks)
-            ->  needs to check content type
-            >   unless stored as char[] which all content can take
-            	->  extra conversions (minor)
-    	->  Need to check type of content for specific services
-    +1> List for each type of content:
-    	+>  can use a static list widget for each type
-    	->  clipboard is type specific; need to decide when to convert, etc.
-            ?>  enables better copying; e.g. from double 3.5e9 to int 4×10⁹
-	>   Use a list of content as the service menu
-	    >	each item is a BoolContent and has value true if it can interact with the current content type
-	    >	wrapped in a CollapsibleWidget, displaying based on own value
   > Context menus:
     > Context menu serves (editable?) content most directly under mouse cursor
     > plus content higher up widget tree?
--- a/codeDoc/jobs.txt	Sat Aug 08 15:53:10 2009 +0200
+++ b/codeDoc/jobs.txt	Mon Aug 31 13:54:23 2009 +0200
@@ -24,12 +24,23 @@
 So make sure draw() and a few others are public, and invariants get called at these points. Thus a lot more must have at least package protection.
 
 Implement a RootWidget moving functionality out of AWidgetManager, etc., now, or later?
+RequestRedraw becomes a function of the renderer.
+
+Undefined reference problem: (see ~/d/small/tests/compilerErrors/packageFunc.d)
+Solution: access via a class base instead of an interface base.
+Two ways to implement:
+  Leave IChildWidget an interface, but change stored refs to AChildWidget and cast references passed in functions before calling member functions.
+  Use AChildWidget directly or an abstract base class instead of IChildWidget, so that interfaced functions can pass the same type stored.
+Making IChildWidget an abstact class seems to have partially solved it. But IPopupParentWidget (needs to be an interface), etc., still need some help.
+Presumably setWidth is getting called from IChildWidget instead of AChildWidget now. ??
+More link errors with ldc.
 
 
 To do (importance 0-5: 0 pointless, 1 no obvious impact now, 2 todo sometime, 3 useful, 4 important, 5 urgent):
 Also search for FIXME/NOTE/BUG/WARNING comment marks.
 4   Move createWidget code out of WidgetManager.
 4   GUI: up-clicks get passed as events and activate objects
+3   May be useful to make all widgets override draw() to ensure the invariant runs locally.
 3   Closing menus when release-click is not on menu or parent (ordinary & context).
 3   Dragging and dropping of editable data: should content immediately appear as being dragged?
 3   Dragging from anything other than AStringContentWidget.
--- a/codeDoc/policies.txt	Sat Aug 08 15:53:10 2009 +0200
+++ b/codeDoc/policies.txt	Mon Aug 31 13:54:23 2009 +0200
@@ -36,15 +36,17 @@
 
 4   Initialisation / cleanup
 
-5   Testing
+5   Callbacks
 
-6   Logging
+6   Testing
+
+7   Logging
 
-7   Exceptions
+8   Exceptions
 
-8   Translating strings
+9   Translating strings
 
-9 Floating point types 
+10  Floating point types 
 
 
 
@@ -101,6 +103,11 @@
 
 
 
+--- Callbacks ---
+I suggest making callbacks called by external objects public, so that invariants are called.
+
+
+
 --- Testing ---
 Testing should, as far as reasonably possible, be done by unittests, defined either in the appropriate module or another module. Any modules containing unittests must be imported by test.mdeTest.
 
@@ -138,7 +145,7 @@
 --- Exceptions ---
 Exceptions should only be used for errors (see comment on log levels above). Thus when an exception is caught, by definition an error occured.
 
-Thrown exceptions should, where documented, be documented via the logger.
+Caught exceptions should be documented via the logger. TODO: work out the best way of incorporating a stack trace. Then lots of specific exception types and messages aren't necessary.
 
 Thrown exceptions should use an exception class specific to at least the package involved to enable specific catching of errors. Exception classes should be defined within a module exception.d in the package directory. Exception classes should generally follow the conventions within mde/exception.d to aid in providing reasonable error messages.
 
@@ -152,4 +159,4 @@
 
 
 --- Floating point types ---
-The issue is whether to use float, double or real as the basic floating point type. In some cases which types are appropriate for use is set by the prototypes of external methods being used. In other cases, which type to use is left entirely to the user's discretion. Since even modern 32-bit CPUs support native 80-bit floating point operations, there seems little point in using floats. Since doubles are more widely supported than reals and provide sufficient precision for most purposes, double seems to be the ideal type to use. Actually some basic tests with 32-bit dmd on my athlon-64 (under 64-bit linux) show floats to be slower to use than doubles but faster than reals, so this appears to be a good choice for now.
\ No newline at end of file
+The issue is whether to use float, double or real as the basic floating point type. In some cases which types are appropriate for use is set by the prototypes of external methods being used. In other cases, which type to use is left entirely to the user's discretion. Since even modern 32-bit CPUs support native 80-bit floating point operations, there seems little point in using floats. Since doubles are more widely supported than reals and provide sufficient precision for most purposes, double seems to be the ideal type to use. Actually some basic tests with 32-bit dmd on my athlon-64 (under 64-bit linux) show floats to be slower to use than doubles but faster than reals, so this appears to be a good choice for now.
--- a/data/conf/guiDemo.mtt	Sat Aug 08 15:53:10 2009 +0200
+++ b/data/conf/guiDemo.mtt	Mon Aug 31 13:54:23 2009 +0200
@@ -1,6 +1,6 @@
 {MT01}
 <char[]|Renderer="Simple">
-<char[]|Design="Working">
+<char[]|Design="Basic">
 {Working}
 <WidgetData|root={0:[0x4100,0,2,1],1:["bar","float"]}>
 <WidgetData|float={0:[0x4200,14,14],1:["options","sliderCB"]}>
@@ -53,3 +53,4 @@
 <WidgetData|contextMenu2={0:[0x6033,0,1],1:["contextMenuCollapse2"]}>
 {Basic}
 <WidgetData|root={0:[0x21,0x90D970],1:["A string!"]}>
+<WidgetData|context={0:[0x4040]}>
--- a/examples/guiDemo.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/examples/guiDemo.d	Mon Aug 31 13:54:23 2009 +0200
@@ -28,7 +28,7 @@
 import tango.core.Thread : Thread;	// Thread.sleep()
 import tango.time.Clock;                // Clock.now()
 import tango.util.log.Log : Log, Logger;
-import tango.core.stacktrace.TraceExceptions;
+//import tango.core.stacktrace.TraceExceptions;
 
 int main(char[][] args)
 {
--- a/mde/gui/WMScreen.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/WMScreen.d	Mon Aug 31 13:54:23 2009 +0200
@@ -21,7 +21,7 @@
  *****************************************************************************/
 module mde.gui.WMScreen;
 
-import mde.gui.WidgetManager;
+import mde.gui.widget.WidgetManager;
 import mde.gui.WidgetLoader;
 import mde.gui.widget.Ifaces;
 
@@ -74,11 +74,11 @@
     }
     
     /** Draw the gui. */
-    void draw() {
+    override void draw() {
         synchronized(mutex) {
 	    debug (mdeDrawEvents)
 		logger.trace ("drawing");
-            wmDrawWidgets();
+            super.draw;
 	}
     }
     
@@ -109,18 +109,10 @@
      *
      * Should be called before createWidgets to prevent widgets being squashed
      * to min-dims on loading (losing saved dimensions of columns, etc). */
-    void sizeEvent (int nw, int nh) {   // IDrawable function
-        mutex.lock;
-        scope(exit) mutex.unlock;
-        
-        w = cast(wdim) nw;
-        h = cast(wdim) nh;
-        matchMinimalSize;
-        
-        if (!childRoot) return;     // if not created yet.
-        childRoot.setWidth  (w, -1);
-        childRoot.setHeight (h, -1);
-        childRoot.setPosition (0,0);
+    override void sizeEvent (int nw, int nh) {   // IDrawable function
+        synchronized (mutex) {
+	    wmSizeEvent (nw, nh);
+	}
     }
     
 protected:
--- a/mde/gui/WidgetLoader.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/WidgetLoader.d	Mon Aug 31 13:54:23 2009 +0200
@@ -20,7 +20,7 @@
  *****************************************************************************/
 module mde.gui.WidgetLoader;
 
-import mde.gui.WidgetManager;
+import mde.gui.widget.WidgetManager;
 import mde.gui.WidgetDataSet;
 import mde.gui.exception;
 
--- a/mde/gui/widget/AChildWidget.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/AChildWidget.d	Mon Aug 31 13:54:23 2009 +0200
@@ -39,7 +39,7 @@
  * This abstract class, and the more concrete FixedWidget and ScalableWidget
  * classes provides useful basic implementations for widgets.
  *****************************************************************************/
-abstract class AChildWidget : IChildWidget
+abstract class AChildWidget : IChildWidget, IWidget
 {
 //BEGIN Load and save
     // Base this() for child Widgets.
@@ -55,7 +55,7 @@
     }
     
     // Don't save any data: fine for many widgets.
-    override bool saveChanges () {
+    public override bool saveChanges () {
         return false;
     }
     
@@ -133,36 +133,38 @@
     }
     
     /* Dummy functions; many widgets don't need to respond to dragging. */
-    void dragMotion (wdabs cx, wdabs cy, IChildWidget) {}
-    bool dragRelease (wdabs cx, wdabs cy, IChildWidget) {
+    override void dragMotion (wdabs cx, wdabs cy, IChildWidget) {}
+    override bool dragRelease (wdabs cx, wdabs cy, IChildWidget) {
 	return false;	// any widgets not handling events should let them be passed as normal to clickEvent
     }
     
     /* Dummy functions: suitable for widgets with no text input. */
-    override void keyEvent (ushort, char[]) {}
-    override void keyFocusLost () {}
+    public override void keyEvent (ushort, char[]) {}
+    public override void keyFocusLost () {}
     
     // Called when mouse moves over or off this
     override void underMouse (bool state) {}
     
-    override bool dropContent (IContent content) {
+    public override bool dropContent (IContent content) {
 	return parent.dropContent (content);
     }
     
     // Only useful to widgets creating popups.
-    override void popupClose () {}
-    override bool popupParentClick () {
+    protected override void popupClose () {}
+    protected override bool popupParentClick () {
         return true;
     }
 //END Events
     
     /* Basic draw method: draw the background (all widgets should do this). */
-    override void draw () {
+    public override void draw () {
+	//TODO: possibly enforce all widgets to implement this so their invariant runs:
+	//assert (false, "all widgets should override draw");
         mgr.renderer.drawWidgetBack (x,y, w,h);
     }
     
     // Debug function to print size info. Intended to be correct not optimal.
-    debug override void logWidgetSize () {
+    debug public override void logWidgetSize () {
         logger.trace ("size: {,4},{,4}; minimal: {,4},{,4}; sizable: {},{} - {,-50} {}", this.width, this.height, this.minWidth, this.minHeight, cast(int)this.isWSizable, cast(int)this.isHSizable, this, id);
     }
     
@@ -211,6 +213,11 @@
         mgr.requestRedraw;
     }
     
+    invariant {
+	assert (w >= mw);
+	assert (h >= mh);
+    }
+    
     IWidgetManager mgr;		// the enclosing window
     IParentWidget parent;	// the parent widget
     wdim x, y;			// position
@@ -309,7 +316,7 @@
     }
     
     /// The action triggered when the button is clicked...
-    void activated ();
+    abstract void activated ();
     
 protected:
     bool pushed = false;        /// True if button is pushed in (visually)
--- a/mde/gui/widget/AParentWidget.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/AParentWidget.d	Mon Aug 31 13:54:23 2009 +0200
@@ -58,7 +58,7 @@
 	return c;
     }
     
-    override bool saveChanges () {
+    public override bool saveChanges () {
         bool c = false;
         foreach (w; subWidgets)
             c |= w.saveChanges;
@@ -74,30 +74,30 @@
     }
     
     // Parents taking a content should override, only throwing if both the
-    // widget id and the content are the same (as its it and content).
-    override void recursionCheck (widgetID wID, IContent c) {
+    // widget id and the content are the same (as its id and content).
+    public override void recursionCheck (widgetID wID, IContent c) {
         debug assert (id !is null && parent !is null, "recursionCheck called before parent and id set");
-        if (wID == id)
+        if (wID is id)
             throw new WidgetRecursionException (wID);
         parent.recursionCheck (wID, c);
     }
     
-    IPopupParentWidget getParentIPPW () {
+    public override IPopupParentWidget getParentIPPW () {
         return parent.getParentIPPW;
     }
     
     // Most parent widgets need to implement these, although not all
     // They must at a minimum make sure widget's size is at least nmw by nmh.
-    override void minWChange (IChildWidget widget, wdim nmw) {
+    public  override void minWChange (IChildWidget widget, wdim nmw) {
 	if (widget.width < nmw)
 	    widget.setWidth (nmw, -1);
     }
-    override void minHChange (IChildWidget widget, wdim nmh) {
+    public override void minHChange (IChildWidget widget, wdim nmh) {
 	if (widget.height < nmh)
 	    widget.setHeight (nmh, -1);
     }
     
-    debug override void logWidgetSize () {
+    debug public override void logWidgetSize () {
         super.logWidgetSize;
         foreach (widg; subWidgets)
             widg.logWidgetSize;
@@ -191,12 +191,17 @@
             childIPPW.drawPopup;
     }
     
-    debug invariant () {
+    debug invariant {
         // True as long as removedIPPW gets called:
-        if (!parentIPPW.isChild (this)) {
+        /+TODO:
+	if (!parentIPPW.isChild (this)) {
             assert (childIPPW is null, "APPW: childIPPW");
             assert (mAIPPW is false, "APPW: mAIPPW");
-        }
+        }+/
+    }
+    
+    debug override bool isChild (IPopupParentWidget ippw) {
+        return ippw is childIPPW;
     }
     
 protected:
@@ -207,10 +212,6 @@
         mgr.positionPopup (this, popup);
     }+/
     
-    debug override bool isChild (IPopupParentWidget ippw) {
-        return ippw is childIPPW;
-    }
-    
     IPopupParentWidget parentIPPW;
     IPopupParentWidget childIPPW;
     IChildWidget popup;
--- a/mde/gui/widget/Floating.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/Floating.d	Mon Aug 31 13:54:23 2009 +0200
@@ -226,7 +226,7 @@
         }
 	return 0;
     }
-    void dragMotion (wdabs cx, wdabs cy, IChildWidget) {
+    override void dragMotion (wdabs cx, wdabs cy, IChildWidget) {
     if (resizeType == RESIZE.NONE) {
         with (sWData[active]) {
                 x = cx-xDrag;
@@ -288,7 +288,7 @@
         mgr.requestRedraw;
     }
     }
-    bool dragRelease (wdabs, wdabs, IChildWidget) {
+    override bool dragRelease (wdabs, wdabs, IChildWidget) {
 	return true;    // we've handled the up-click
     }
     
--- a/mde/gui/widget/Ifaces.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/Ifaces.d	Mon Aug 31 13:54:23 2009 +0200
@@ -26,6 +26,11 @@
  * 
  * It's recommended that widgets inherit one of the A*Widget classes rather
  * than impement I*Widget directly.
+ * 
+ * Protection: please keep it as tight as possible. List it explicitly for
+ * every function in this module; then the compiler checks overridden functions
+ * have the correct protection attribute.
+ * BUG: currently it's a bit of a mess, because of a compiler bug.
  *****************************************************************************/
 module mde.gui.widget.Ifaces;
 
@@ -49,13 +54,19 @@
      * 
      * Actually the return value is ignored; I think widgets still return it
      * correctly though. */
-    bool saveChanges ();
+    public bool saveChanges ();
+    
+    /** Draw, using the stored values of x and y.
+     *
+     * Maybe later enforce clipping of all sub-widget drawing, particularly for cases where only
+     * part of the widget is visible: scroll bars or a hidden window. */
+    public void draw ();
     
     /** Called on a widget when something is dragged onto it.
      *
      * Generally, content editing widgets should implement this as:
      * ---
-    override bool dropContent (IContent content) {
+    public override bool dropContent (IContent content) {
 	if (content_.setContent (content))
 	    return true;
 	return parent.dropContent (content);
@@ -68,7 +79,7 @@
      *
      * Returns: true if the content was received (false if it reaches the
      *	WidgetManager and is still not used). */
-    bool dropContent (IContent content);
+    public bool dropContent (IContent content);
 }
 
 /******************************************************************************
@@ -83,7 +94,10 @@
  *****************************************************************************/
 interface IParentWidget : IWidget
 {
-    /** Checks for recursion of unsafe widgets to prevent infinite recursion. */
+    /** Checks for recursion of unsafe widgets to prevent infinite recursion.
+     *
+     * Only called by makeWidget() when creating child widgets and recursively
+     * from the same method in a child widget. */
     void recursionCheck (widgetID, IContent);
     
     /** IPPWs return self, other widgets recurse call on parent. */
@@ -93,9 +107,13 @@
      * changes, since they cannot properly resize themselves.
      * 
      * Parents $(I must) increase their child's size if the child is too small.
-     * Parents $(I must not) decrease their own size, even if they are not
-     * sizable; they may only decrease their childrens' sizes if it does not
-     * affect their own (i.e. WidgetManager and FloatingAreaWidget).
+     * Parents $(I must not) change their own size, even if they are not
+     * sizable; they may only change their childrens' sizes if it does not
+     * affect their own (i.e. WidgetManager and floating / popup widgets).
+     * 
+     * (Hence most parents need to call this function on their parents to change
+     * size. In this case they also must propegate setWidth/setHeight calls on
+     * the child originally calling min[WH]Change.)
      * 
      * Child widgets may depend on setPosition being called afterwards.
      * 
@@ -114,7 +132,7 @@
      * 
      * Note: ANY_SUBWIDGETS can cause problems like enlarging a menu bar containing a resizable
      * blank instead of the main part of a window. */
-    enum SIZABILITY_ENUM {
+    protected enum SIZABILITY_ENUM {
         NEVER		= 0,	/// Parents are never resizable
         ALL_SUBWIDGETS	= 3,	/// Parents are only resizable if all sub-widgets are
         ANY_SUBWIDGETS	= 2,	/// Parents are resizable if any sub-widgets are
@@ -122,7 +140,7 @@
         START_TRUE	= 1,	/// Flag set by ALWAYS and ALL_SUBWIDGETS
         SUBWIDGETS	= 2,	/// Flag set by ALL_SUBWIDGETS and ANY_SUBWIDGETS
     }
-    static const SIZABILITY = SIZABILITY_ENUM.ANY_SUBWIDGETS;	/// ditto
+    protected static const SIZABILITY = SIZABILITY_ENUM.ANY_SUBWIDGETS;	/// ditto
 }
 
 /******************************************************************************
@@ -332,7 +350,7 @@
  * during their creation.
  *****************************************************************************/
 //NOTE: add another this() without the data for default initialization, for the GUI editor?
-interface IChildWidget : IWidget
+abstract class IChildWidget : IWidget
 {
 //BEGIN Load and save
     /** 2nd stage of initialization for widgets; also called on some changes.
@@ -351,7 +369,7 @@
      * Returns:
      *	The method must return true on initial setup and if its dimensions
      *	(may) have changed. */
-    bool setup (uint n, uint flags);
+    bool setup (uint n, uint flags) {return 0;}
     
     /+ Use when widget editing is available? Requires widgets to know their parents.
     /** Called when a child widget's size has changed.
@@ -369,22 +387,22 @@
      * 
      * Parents normally take their resizability from sub-widgets; see SIZABILITY for how they do
      * this. */
-    bool isWSizable ();
-    bool isHSizable (); /// ditto
+    bool isWSizable () {return 0;}
+    bool isHSizable () {return 0;} /// ditto
     
     /** The minimal size the widget could be shrunk to (or its fixed size).
      *
      * Takes into account child-widgets and any other contents. */
-    wdim minWidth ();
-    wdim minHeight ();	/// ditto
+    wdim minWidth () {return 0;}
+    wdim minHeight() {return 0;}	/// ditto
     
     /** Get the current size of the widget. */
-    wdim width ();
-    wdim height();      /// ditto
+    wdim width () {return 0;}
+    wdim height() {return 0;}      /// ditto
     
     /** (Smallest) coordinates of widget. */
-    wdabs xPos ();
-    wdabs yPos ();	/// ditto
+    wdabs xPos () {return 0;}
+    wdabs yPos () {return 0;}	/// ditto
     
     /** Used to adjust the size.
      *
@@ -400,21 +418,21 @@
      * A "fixed" size widget should enlarge itself as requested.
      *
      * setPosition must be called after calling either setWidth or setHeight. */
-    void setWidth (wdim nw, int dir);
-    void setHeight (wdim nh, int dir);	/// ditto
+    void setWidth (wdim nw, int dir) {}
+    void setHeight (wdim nh, int dir) {}	/// ditto
     
     /** Set the current position (called after setup and to move widget). */
-    void setPosition (wdim x, wdim y);
+    void setPosition (wdim x, wdim y) {}
 //END Size and position
     
 //BEGIN Content
     /** Return the widget's content, or null. */
-    IContent content ();
+    IContent content () {return null;}
     
     /** Set the widget's content, if the widget takes content and changing it
      * at this stage is feasible. (Also pass to sub-widgets, where the
      * constructor normally does so.) */
-    void setContent (IContent);
+    void setContent (IContent) {}
 //END Content
     
 //BEGIN Events
@@ -427,10 +445,10 @@
      * (cx,cy).
      *
      * Note: use global coordinates (cx,cy) not coordinates relative to the widget. */
-    IChildWidget getWidget (wdabs cx, wdabs cy);
+    IChildWidget getWidget (wdabs cx, wdabs cy) {return null;}
     
     /** Return true if (cx,cy) is on self's box (doesn't matter if actually on a subwidget). */
-    bool onSelf (wdabs cx, wdabs cy);
+    bool onSelf (wdabs cx, wdabs cy) {return 0;}
     
     /** Receive a mouse click event at cx,cy from button b (1-5 correspond to L,M,B, wheel up,down)
      * which is a down-click if state is true.
@@ -443,14 +461,14 @@
      * $(TR $(TD 2) $(TD Request the functions dragMotion and dragRelease are called))
      * $(TR $(TD 4) $(TD Display the widget's content while dragging (requires 2)))
      * ) */
-    int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state);
+    int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {return 0;}
     
     /** Called when dragging motion occurs, originating from this widget.
      *
      * Params: target = The widget under the mouse
      *
      * Only called if requested by clickEvent. */
-    void dragMotion (wdabs cx, wdabs cy, IChildWidget target);
+    void dragMotion (wdabs cx, wdabs cy, IChildWidget target) {}
     
     /** Called at the end of a drag which originated from this widget.
      *
@@ -460,24 +478,24 @@
      * clickEvent on the relevent widget.
      *
      * Only called if requested by clickEvent. */
-    bool dragRelease (wdabs cx, wdabs cy, IChildWidget target);
+    bool dragRelease (wdabs cx, wdabs cy, IChildWidget target) {return 0;}
     
     /** Receives keyboard events when requested.
      *
      * Params:
      *	sym	SDLKey key sym, useful for keys with no character code such as arrow keys
      *	letter	The character input, in UTF-8 */
-    void keyEvent (ushort sym, char[] letter);
+    public void keyEvent (ushort sym, char[] letter);
     
     /** Called when keyboard input focus is lost. */
-    void keyFocusLost ();
+    public void keyFocusLost ();
     
     /** Called on all widgets when the mouse moves over it (state == true) and
      * when it leaves (state == false). */
-    void underMouse (bool state);
+    void underMouse (bool state) {}
     
     /** When a pop-up is closed the manager calls requestRedraw and this function on its parent. */
-    void popupClose ();
+    protected void popupClose ();
     /** When a click is on the parent of a popup, this function is called instead of the usual
      * clickEvent.
      * 
@@ -485,16 +503,10 @@
      *	true to close the popup.
      *
      * Note: this means the parent can't receive text input without code changes. */
-    bool popupParentClick ();
+    protected bool popupParentClick ();
     
 //END Events
     
-    /** Draw, using the stored values of x and y.
-     *
-     * Maybe later enforce clipping of all sub-widget drawing, particularly for cases where only
-     * part of the widget is visible: scroll bars or a hidden window. */
-    void draw ();
-    
     /// Logs the current and minimal size of every widget.
-    debug void logWidgetSize ();
+    debug public void logWidgetSize ();
 }
--- a/mde/gui/widget/ParentContent.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/ParentContent.d	Mon Aug 31 13:54:23 2009 +0200
@@ -468,12 +468,11 @@
     
 protected:
     invariant {
-	// this() calls makeWidget() which calls recursionCheck(); invariant is called at this point before this() finishes
-	if (subWidgets.length) {
-	    assert (subWidgets.length == 1);
-	    assert (mw == subWidgets[0].minWidth + border.x1 + border.x2);
-	    assert (mh == subWidgets[0].minHeight + border.y1 + border.y2);
-	}
+	/+TODO
+	assert (subWidgets.length == 1);
+	assert (mw == subWidgets[0].minWidth + border.x1 + border.x2);
+	assert (mh == subWidgets[0].minHeight + border.y1 + border.y2);
+	+/
     }
     
     alias IRenderer.Border.BTYPE BTYPE;
--- a/mde/gui/widget/TextWidget.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/TextWidget.d	Mon Aug 31 13:54:23 2009 +0200
@@ -70,7 +70,8 @@
     /** Constructor for a widget containing [fixed] content.
      *
      * Widget uses the initialisation data:
-     * [widgetID, contentID, colour]
+     * ints: [widgetID, colour]
+     * strings: [text]
      * where contentID is an ID for the string ID of the contained content
      * and colour is an 8-bit-per-channel RGB colour of the form 0xRRGGBB. */
     this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data) {
@@ -186,7 +187,7 @@
 	return false;
     }
     
-    override void keyEvent (ushort s, char[] i) {
+    public override void keyEvent (ushort s, char[] i) {
 	adapter.text = content_.keyStroke (s, i);
 	adapter.index = content_.editIndex;
         wdim omw = mw, omh = mh;
@@ -197,7 +198,7 @@
             parent.minHChange (this, mh);
 	mgr.requestRedraw;
     }
-    override void keyFocusLost () {
+    public override void keyFocusLost () {
 	content_.endEdit;
 	adapter.text = content_.toString (0);
 	adapter.index;
--- a/mde/gui/widget/contentFunctions.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/contentFunctions.d	Mon Aug 31 13:54:23 2009 +0200
@@ -28,6 +28,7 @@
 import mde.content.AStringContent;
 import mde.content.miscContent;
 
+
 /******************************************************************************
  * 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
--- a/mde/gui/widget/layout.d	Sat Aug 08 15:53:10 2009 +0200
+++ b/mde/gui/widget/layout.d	Mon Aug 31 13:54:23 2009 +0200
@@ -129,7 +129,7 @@
 	logger.warn ("ContentListWidget: resetting content is not yet supported");
     }
     
-    override bool dropContent (IContent content) {
+    public override bool dropContent (IContent content) {
 	if (cList.set (content))
 	    return true;
 	return parent.dropContent (content);
@@ -363,7 +363,7 @@
             mgr.renderer.drawSpacers (x,y, w,h, col.pos[1..$], row.pos[1..$]);
     }
     
-package:
+private:
     /* Calculations which need to be run whenever a new sub-widget structure is set
      * or other changes affecting widget sizes. Most of these need to happen regardless of whether
      * changes have occurred, since AlignColumns have been reset.
@@ -439,7 +439,6 @@
         }
     }
     
-private:
     override void setColWidth (size_t i, wdim w, int dir) {
         for (size_t j = 0; j < rows; ++j) {
             subWidgets[i + cols*j].setWidth (w, dir);
@@ -909,7 +908,7 @@
     alias IParentWidget.SIZABILITY SIZABILITY;
     alias IParentWidget.SIZABILITY_ENUM SIZABILITY_ENUM;
     
-    debug invariant()
+    invariant
     {
         if (setupWidths) {
             assert (width.length == cols, "invariant: bad width length");