diff mde/gui/widget/Widget.d @ 92:085f2ca31914

Shared alignments supported in more complex cases.
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 21 Oct 2008 09:57:19 +0100
parents 4d5d53e4f881
children 08a4ae11454b
line wrap: on
line diff
--- a/mde/gui/widget/Widget.d	Thu Oct 16 17:43:48 2008 +0100
+++ b/mde/gui/widget/Widget.d	Tue Oct 21 09:57:19 2008 +0100
@@ -49,7 +49,17 @@
         this.mgr = mgr;
     }
     
+    // Most widgets don't need this; all initialization os usually done in this()
+    void prefinalize () {}
+    void finalize () {}
+    
+    // ParentWidget is inteded for parent widgets to derive
+    IChildWidget[] children () {
+        return null;
+    }
+    
     // Don't save any data: fine for many widgets.
+    // FIXME: implementation could be added to ParentWidget
     bool saveChanges (widgetID) {
         return false;
     }
@@ -141,6 +151,23 @@
     				// resizible; both types of widgets should actually be expandable.
 }
 
+/*************************************************************************************************
+* An abstract base widget class for parent widgets.
+*************************************************************************************************/
+abstract class ParentWidget : Widget
+{
+    this (IWidgetManager mgr, widgetID id, WidgetData data) {
+        super (mgr, id, data);
+    }
+    
+    IChildWidget[] children () {
+        return subWidgets;
+    }
+    
+protected:
+    IChildWidget[] subWidgets;
+}
+
 /** A base for fixed-size widgets taking their size from the creation data. */
 class FixedWidget : Widget {
     // Check data.length is at least 3 before calling!