diff mde/gui/WidgetManager.d @ 110:6acd96f8685f

Translation reloading as far as AContent name/desc supported. Limited & crude support for updating gui. Gave AContent support for multiple callbacks. New locale: "en".
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 05 Dec 2008 11:29:39 +0000
parents c9fc2d303178
children 1655693702fc
line wrap: on
line diff
--- a/mde/gui/WidgetManager.d	Thu Dec 04 10:32:20 2008 +0000
+++ b/mde/gui/WidgetManager.d	Fri Dec 05 11:29:39 2008 +0000
@@ -25,11 +25,12 @@
 import mde.gui.widget.Ifaces;
 import mde.gui.renderer.createRenderer;
 
-// For adding the input event callbacks and requesting redraws:
 import imde = mde.imde;
 import mde.input.Input;
 import mde.scheduler.Scheduler;
 import mde.setup.Screen;
+import Items = mde.content.Items;	// loadTranslation
+import mde.lookup.Options;	// miscOpts.L10n callback
 
 import tango.core.sync.Mutex;
 import tango.util.log.Log : Log, Logger;
@@ -69,6 +70,9 @@
         // Events we want to know about:
         imde.input.addMouseClickCallback(&clickEvent);
         imde.input.addMouseMotionCallback(&motionEvent);
+	
+	Items.loadTranslation ();
+	miscOpts.L10n.addCallback (&reloadStrings);
     }
     
     
@@ -437,6 +441,14 @@
         }
     }
     
+    /** Called when translation strings have been reloaded. */
+    void reloadStrings (AContent c) {
+	Items.loadTranslation;
+	child.reloadStrings;	//FIXME : all widgets, resize
+	requestRedraw;
+    }
+    
+protected:
     /** Second stage of loading the widgets.
     * 
     * loadDesign handles the data; this method needs to:
@@ -484,8 +496,9 @@
     
     /** Called before saving (usually when the GUI is about to be destroyed, although not
     *  necessarily). */
-    void preSave () {}
+    void preSave ();
     
+public:
     //BEGIN IWidgetManager methods
     IChildWidget makeWidget (widgetID id, IContent content = null) {
         debug (mdeWidgets) logger.trace ("Creating widget \""~id~'"');