Index: Makefile
===================================================================
--- Makefile	(revision 0)
+++ Makefile	(revision 0)
@@ -0,0 +1,83 @@
+# Makefile for building harmonia library the D language:
+# Use this makefile with DigitalMars make.
+# make build -f release.mak project=samples/hello1
+
+DC      = dmd
+DFLAGS  = -c -inline -O -release -version=SDL
+#LIBS    = kernel32.lib gdi32.lib user32.lib ./imageio/imageio.lib 
+
+#native/win32.d - do not compile it as it is just a 'header'
+
+GENERIC_OBJECTS 	= harmonia/string.o \
+			harmonia/tools.o \
+			harmonia/types.o
+
+GRAPHICS_OBJECTS 	= harmonia/gx/geometry.o \
+			harmonia/gx/graphics.o \
+			harmonia/gx/images.o
+
+HTML_OBJECTS		= harmonia/html/document.o \
+			harmonia/html/html.o \
+			harmonia/html/measure.o \
+			harmonia/html/parser.o \
+			harmonia/html/render.o \
+			harmonia/html/scanner.o \
+			harmonia/html/style.o \
+			harmonia/html/tablengine.o \
+			harmonia/html/view.o
+
+IO_OBJECTS		= harmonia/io/mmfile.o \
+			harmonia/io/url.o
+
+THEMES_OBJECTS 		= harmonia/themes/pathfinder.o \
+			harmonia/themes/theme.o
+
+UI_PACKAGE_OBJECTS = 	harmonia/ui/application.o \
+			harmonia/ui/commands.o \
+			harmonia/ui/control.o \
+			harmonia/ui/definitions.o \
+			harmonia/ui/dialog.o \
+			harmonia/ui/events.o \
+			harmonia/ui/frame.o \
+			harmonia/ui/menu.o \
+			harmonia/ui/tooltip.o \
+			harmonia/ui/widget.o \
+			harmonia/ui/widgets.o \
+			harmonia/ui/window.o \
+			harmonia/ui/containers/splitter.o \
+			harmonia/ui/containers/statusbar.o \
+			harmonia/ui/containers/tabs.o \
+			harmonia/ui/containers/toolbar.o \
+			harmonia/ui/controls/alist.o \
+			harmonia/ui/controls/all.o \
+			harmonia/ui/controls/behaviors.o \
+			harmonia/ui/controls/buttons.o \
+			harmonia/ui/controls/common.o \
+			harmonia/ui/controls/editbox.o \
+			harmonia/ui/controls/listbox.o \
+			harmonia/ui/controls/scrollbar.o \
+			harmonia/ui/controls/tree.o \
+			harmonia/ui/exchange/clipboard.o 
+
+NATIVE_SDL_OBJECTS =    harmonia/ui/native/sdlapplication.o \
+			harmonia/ui/native/sdlexchange.o \
+			harmonia/ui/native/sdlgraphics.o \
+			harmonia/ui/native/sdlwindow.o
+
+#non-harmonia modules (external)
+
+EXTERNAL_OBJECTS = 	std/boxer.o 
+#imageio/imageio.o
+
+OBJECTS = $(GENERIC_OBJECTS) $(GRAPHICS_OBJECTS) $(HTML_OBJECTS) $(IO_OBJECTS) $(THEMES_OBJECTS) $(UI_PACKAGE_OBJECTS) $(NATIVE_SDL_OBJECTS) $(EXTERNAL_OBJECTS)
+
+%.o: %.c
+	gcc -c $< -o $@
+%.o: %.d
+	$(DC) $(DFLAGS) $< -of$@
+
+build: $(OBJECTS)
+	$(DC) $(OBJECTS) $(LIBS) 
+
+clean:
+	rm -rf $(OBJECTS)
Index: harmonia/html/parser.d
===================================================================
--- harmonia/html/parser.d	(revision 31)
+++ harmonia/html/parser.d	(working copy)
@@ -34,6 +34,26 @@
 private import harmonia.html.view;
 
 import std.format;
+
+version (Windows)
+{
+    wchar[] utfConvert(wchar[] s)
+    {
+        return s;
+    }
+}
+else
+version (SDL)
+{
+    std.c.stddef.wchar_t[] utfConvert(wchar[] s)
+    {
+        return std.utf.toUTF32(s);
+    }
+}
+else
+{
+    static assert (0);
+}
  
 class ParserError 
 {
@@ -576,7 +596,7 @@
   wchar c1 = 0;
   wchar c2 = 0;
   float v = 0;
-  int n = std.c.stdio.swscanf(s, "%f%c%c", &v, &c1, &c2);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%f%c%c", &v, &c1, &c2);
   s.length = s.length - 1; 
   if( n == 3 )
   {
@@ -606,7 +626,7 @@
   s ~= '\0';
   wchar c = 0;
   int v = dv;
-  int n = std.c.stdio.swscanf(s, "%u", &v);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%u", &v);
   s.length = s.length - 1; 
   if( n == 1) 
     return v;
@@ -619,7 +639,7 @@
   wchar c1 = 0;
   wchar c2 = 0;
   float v = 0;
-  int n = std.c.stdio.swscanf(s, "%f%c%c", &v, &c1, &c2);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%f%c%c", &v, &c1, &c2);
   s.length = s.length - 1; 
   if( n == 3 && c1 == 'p' && c2 == 't')
     return -cast(int)(v*10);
@@ -677,7 +697,7 @@
   if(s[0] == '#')
   {
     int r,g,b;
-    int n = std.c.stdio.swscanf(s, "#%2x%2x%2x", &r, &g, &b);
+    int n = std.c.stdio.swscanf(utfConvert(s), "#%2x%2x%2x", &r, &g, &b);
     if( n == 3 )
       return rgb(r,g,b);
   }
@@ -693,7 +713,7 @@
 void parseWidths(length_t[4] w,wchar[] s)
 {
   wchar[20] s0,s1,s2,s3;
-  int n = std.c.stdio.swscanf(s, "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
   if( n == 1 )
   {
     w[0] = w[1] = w[2] = w[3] = parseLength(s0,false);
@@ -720,7 +740,7 @@
 void parseUrl(inout wchar[] url,wchar[] s)
 {
   wchar[512] t;
-  int n = std.c.stdio.swscanf(s, "url(%512s)", t.ptr);
+  int n = std.c.stdio.swscanf(utfConvert(s), "url(%512s)", t.ptr);
   if( n == 1 ) s = wz2w(t);
 }
 
@@ -769,7 +789,7 @@
 {
 
   wchar[20] s0,s1,s2,s3;
-  int n = std.c.stdio.swscanf(s, "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
   if( n == 1 )
   {
     w[0] = w[1] = w[2] = w[3] = parseBorderStyle(wcs2string(s0));
@@ -793,7 +813,7 @@
   wchar[] str(wchar* pc) { return pc[0..wcslen(pc)]; }
   
   wchar[20] s0,s1,s2,s3;
-  int n = std.c.stdio.swscanf(s, "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
+  int n = std.c.stdio.swscanf(utfConvert(s), "%20s%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr, s3.ptr);
   if( n == 1 )
   {
     c[0] = c[1] = c[2] = c[3] = parseColor(str(s0)) ;
@@ -815,7 +835,7 @@
 void parseBorder(int idx, length_t[4] w, border_t[4] s, color[4] c, wchar[] str)
 {
   wchar[20] s0,s1,s2,s3;
-  int n = std.c.stdio.swscanf(str, "%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr);
+  int n = std.c.stdio.swscanf(utfConvert(str), "%20s%20s%20s", s0.ptr, s1.ptr, s2.ptr);
 
   length_t bw;
   border_t bs; 
Index: harmonia/io/mmfile.d
===================================================================
--- harmonia/io/mmfile.d	(revision 31)
+++ harmonia/io/mmfile.d	(working copy)
@@ -196,7 +196,7 @@
      */
     static MMFile open(wchar[] filename, Mode mode, size_t size, void* address)
     {
-      wchar* namez = stringz(filename);
+      char* namez = std.string.toStringz(std.utf.toUTF8(filename));
       void* p;
       int fd;
       int prot;
@@ -257,7 +257,7 @@
           if (prot & PROT_WRITE && size > statbuf.st_size)
           {
               // Need to make the file size bytes big
-              std.c.linux.linux.lseek(fd, size - 1, SEEK_SET);
+              std.c.linux.linux.lseek(fd, size - 1, std.c.stdio.SEEK_SET);
               char c = 0;
               std.c.linux.linux.write(fd, &c, 1);
           }
@@ -282,7 +282,8 @@
 
         if (p == MAP_FAILED)    // in sys/mman.h
             return null;
-        data = p[0 .. size];
+        ubyte[] data;
+        data = cast(ubyte[])(p[0 .. size]);
 
         MMFile mmf = new MMFile();
           mmf.filename = filename;
Index: harmonia/string.d
===================================================================
--- harmonia/string.d	(revision 31)
+++ harmonia/string.d	(working copy)
@@ -22,7 +22,7 @@
 //| alias tstring(wchar) string
 //|
 
-module harmomia.utils.string;
+module harmomia.string;
 
 import std.string;
 import std.utf;
Index: harmonia/ui/exchange/clipboard.d
===================================================================
--- harmonia/ui/exchange/clipboard.d	(revision 31)
+++ harmonia/ui/exchange/clipboard.d	(working copy)
@@ -25,7 +25,12 @@
     private import harmonia.ui.native.win32exchange;
 }
 else
+version (SDL)
 {
+    private import harmonia.ui.native.sdlexchange;
+}
+else
+{
     static assert(0);    // Windows only for a while, needs somebody to take care
 }
 
@@ -75,4 +80,4 @@
     return null;
   }
 
-}
\ No newline at end of file
+}
Index: harmonia/ui/application.d
===================================================================
--- harmonia/ui/application.d	(revision 31)
+++ harmonia/ui/application.d	(working copy)
@@ -29,7 +29,12 @@
     private import harmonia.ui.native.win32application;
 }
 else
+version (SDL)
 {
+    private import harmonia.ui.native.sdlapplication;
+}
+else
+{
     static assert(0);    // Windows only for a while, need somebody to take care
 }
 
Index: harmonia/ui/native/sdlgraphics.d
===================================================================
--- harmonia/ui/native/sdlgraphics.d	(revision 0)
+++ harmonia/ui/native/sdlgraphics.d	(revision 0)
@@ -0,0 +1,185 @@
+module harmonia.ui.native.sdlgraphics;
+
+private import harmonia.gx.graphics;
+private import harmonia.gx.images;
+private import harmonia.ui.application;
+
+class NativeGraphics
+{
+    this()
+    {
+    }
+
+package:
+
+    void nativeCopyRect(Graphics src_g, rect src, point dst)
+    {
+    }
+
+    void nativeStretchRect(Graphics src_g, rect src, rect dst)
+    {
+    }
+
+    void nativeBlit(NativeGraphics dst_g, point dst, rect src)
+    {
+    }
+
+    void nativeStretch(NativeGraphics dst_g, rect dst, rect src)
+    {
+    }
+
+
+    void nativeDrawChars(wchar[] chars, point where)
+    {
+    }
+
+    void nativeDrawChars(wchar[] chars, rect where, uint flags)
+    {
+    }
+
+    size nativeMeasureChars(wchar[] chars)
+    {
+    }
+
+    void nativeDrawRect(rect rc)
+    {
+    }
+
+
+    void nativeFillRect(rect rc, color c)
+    {
+    }
+
+    void nativeFillRect(rect rc, color cTL, color cTR, color cBR, color cBL)
+    {
+    }
+
+    void nativeDrawLine(point p1, point p2)
+    {
+    }
+
+    void nativeDrawPolygon(point[] points)
+    {
+    }
+
+    //static RECT native(rect r)
+    static rect native(rect r)
+    {
+        assert (0);
+        return r;
+    }
+
+    // boolean isDirty(Rect r);
+    bool nativeIsDirty(rect rc)
+    {
+        return true;
+    }
+
+    void nativeSetPen(color c, int width, uint style)
+    {
+    }
+
+    void nativeSetColor(color c)
+    {
+    }
+
+    void nativeSetFont(Font f)
+    {
+    }
+
+    void nativeSetBrush(color c, uint style)
+    {
+    }
+
+    void nativeSetOrigin(point p)
+    {
+    }
+
+    bool nativePushClip(rect clip)
+    {
+        return true;
+    }
+
+    void nativePopClip()
+    {
+    }
+
+    // draws monochrome bitmap provided by its bits and size
+    void nativeDrawBits(color c, point dst, size src_size, ubyte[] src_bits)
+    {
+    }
+}
+
+uint nativePixelsPerInchOnScreen()
+{
+    return 0;
+}
+
+class NativeImage: ISurface
+{
+  this() {}
+    
+  this( size sz, bool alpha) 
+  { 
+  }
+  ~this( ) {  }
+
+//isurface funcs
+
+  void initialize(Graphics g) 
+  {
+  }
+
+  void finalize(Graphics g) 
+  { 
+  }
+
+  void swapData( NativeImage src ) 
+  {
+  }
+  
+  bool nativeDecode(ubyte[] bytes)
+  {
+      return true;
+  }
+
+  size nativeDimension( )
+  {
+  }
+
+  uint nativeRowByteLength(  )
+  {
+  }
+
+  ubyte[]  nativeRow( uint rowNo )
+  {
+  }
+  uint     nativeBytesPerPixel( ) {  }
+  //bool     hasAlpha()       { return nativeBytesPerPixel() == 4; }
+
+  void nativeBlit(NativeGraphics dst_g, point dst, rect src)
+  {
+  }
+
+  void nativeStretch(NativeGraphics dst_g, rect dst, rect src)
+  {
+  }
+}
+
+package class NativeFont 
+{
+  int     _ascent;
+  int     _height;
+
+  void nativeCreate( char[] name, int size, bool bold, bool italic )
+  {
+  }
+
+  ~this() 
+  {
+  }
+
+  void nativeInitMetrics(NativeGraphics g)
+  {
+  }
+}
Index: harmonia/ui/native/sdlexchange.d
===================================================================
--- harmonia/ui/native/sdlexchange.d	(revision 0)
+++ harmonia/ui/native/sdlexchange.d	(revision 0)
@@ -0,0 +1,17 @@
+module  harmonia.ui.native.win32exchange;
+
+import harmonia.types;
+
+uint nativeClipboardAvailableFormats() 
+{
+}
+
+wchar[] nativeClipboardGetPlaintText()
+{
+}
+
+void nativeClipboardSetPlaintText(wchar[] text)
+{
+}
+
+
Index: harmonia/ui/native/sdlapplication.d
===================================================================
--- harmonia/ui/native/sdlapplication.d	(revision 0)
+++ harmonia/ui/native/sdlapplication.d	(revision 0)
@@ -0,0 +1,185 @@
+module  harmonia.ui.native.sdlapplication;
+
+import harmonia.types;
+
+import harmonia.gx.geometry;
+import harmonia.ui.application;
+import harmonia.ui.widget;
+
+class NativeApplication
+{
+  static:
+  package 
+  {
+    bool        quit;
+    wchar[][]   argv;
+    wchar[]     path;
+    void function() onStartCallback;
+    void function() onStopCallback;
+  }
+
+  void initialize() 
+  {
+    if( ! (onStartCallback is null) )
+      onStartCallback();
+    
+  }
+  void finalize() 
+  {
+    if( ! (onStopCallback is null) )
+      onStopCallback();
+  }
+    
+  bool doEvents() 
+  { 
+    return true; 
+  }
+
+  void function() onStart() { return onStartCallback; }
+  void function() onStart(void function() cb) { return onStartCallback = cb; }
+
+  void function() onStop() { return onStopCallback; }
+  void function() onStop(void function() cb) { return onStopCallback = cb; }
+
+  size screenSize()
+  {
+  }
+
+  point cursorPosition()
+  {
+  }
+
+  size cursorSize()
+  {
+    pragma(msg, "TODO (cursorSize): make this through SystemMetrics");
+    return size( 32,32 );
+  }
+
+
+  void postIdle()
+  {
+  }
+
+  void alert(wchar[] text)
+  {
+  }
+
+  ubyte[] loadBinaryResource(wchar[] nameExt)
+  {
+  }
+
+  /+
+  enum OS
+  {
+    WIN_32S       = 0x100,
+    WIN_95        = 0x101,
+    WIN_95_OSR2   = 0x102,
+    WIN_98        = 0x103,
+    WIN_98_SE     = 0x104,
+    WIN_ME        = 0x105,
+
+    WIN_CE        = 0x110,
+    WIN_NT4       = 0x111,
+    WIN_2000      = 0x112,
+    WIN_XP        = 0x113
+  };
+
+  OS os() 
+  {
+    static OS osv = 0;
+    if(osv != 0)
+      return osv;
+
+    const int VER_PLATFORM_WIN32s  =      0;
+    const int VER_PLATFORM_WIN32_WINDOWS = 1;
+    const int VER_PLATFORM_WIN32_NT      = 2;
+
+
+    OSVERSIONINFOEXA osvi;
+    BOOL bOsVersionInfoEx;
+
+    // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
+    //
+    // If that fails, try using the OSVERSIONINFO structure.
+    
+    osvi.dwOSVersionInfoSize = OSVERSIONINFOEXA.sizeof;
+
+    bOsVersionInfoEx = GetVersionExA (cast(OSVERSIONINFOA*) &osvi);
+
+    if( bOsVersionInfoEx == 0 )
+    {
+       osvi.dwOSVersionInfoSize = OSVERSIONINFOA.sizeof;
+       if (! GetVersionExA( cast(OSVERSIONINFOA*) &osvi) ) 
+           return 0;
+    }
+
+    switch (osvi.dwPlatformId)
+    {
+      case VER_PLATFORM_WIN32_NT:
+
+         if ( osvi.dwMajorVersion <= 4 )
+           return osv = OS.WIN_NT4;
+         if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
+           return osv = OS.WIN_2000;
+         if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
+           return osv = OS.WIN_XP;
+         break;
+
+      case VER_PLATFORM_WIN32_WINDOWS:
+
+         if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
+         {
+             if ( osvi.szCSDVersion[1] == 'C' )
+               return osv = OS.WIN_95_OSR2;
+             else 
+               return osv = OS.WIN_95;
+         } 
+         if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
+         {
+             if ( osvi.szCSDVersion[1] == 'A' )
+               return osv = OS.WIN_98_SE;
+             else 
+               return osv = OS.WIN_98;
+         } 
+         if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
+         {
+             return osv = OS.WIN_ME;
+         } 
+         break;
+
+      case VER_PLATFORM_WIN32s:
+         return osv = OS.WIN_32S;
+      default:
+         break;
+   }
+  
+   return 0;  
+
+  }
+
+  static wchar[2048]  filePathNameBuffer;
+  +/
+
+  bool selectFileToOpen( Widget owner, FileDialog dlg, wchar[] path, uint flags )
+  {
+    return true;
+  }
+
+  bool selectFileToSave( Widget owner, FileDialog dlg, wchar[] path, uint flags )
+  {
+    return false;
+  }
+
+  bool selectFolder( Widget owner, FileDialog dlg, wchar[] path, uint flags )
+  {
+    return false;
+  }
+
+  private wchar[] assembleFilter( FileDialog dlg )
+  {
+  }
+
+  private uint translateFlags(uint flags)
+  {
+  }
+}
Index: harmonia/ui/native/sdlwindow.d
===================================================================
--- harmonia/ui/native/sdlwindow.d	(revision 0)
+++ harmonia/ui/native/sdlwindow.d	(revision 0)
@@ -0,0 +1,73 @@
+module  harmonia.ui.native.sdlwindow;
+
+private import harmonia.gx.graphics;
+private import harmonia.string;
+
+private import harmonia.ui.window;
+
+void nativeSetTimer(Window w, uint id, uint millis)
+{
+}
+
+void nativeSetCursor(Window w, uint cursorType)
+{
+}
+
+uint nativeTimeStamp()
+{
+//  return GetTickCount();
+    // TODO
+    return 0;
+}
+
+
+Window nativeWindowFromPoint(point screenPos)
+{
+}
+
+
+void nativeSetWindowState(Window w, uint state, uint animationTime)
+{
+}
+
+void nativeInitializeWindowGraphics(Window w, Graphics g)
+{
+}
+
+void nativeFinalizeWindowGraphics(Window w, Graphics g)
+{
+}
+
+void nativeShowCaret(Window w, rect r)
+{
+}
+
+void nativeHideCaret(Window w)
+{
+}
+
+void nativeRefresh(Window w, rect r)
+{
+}
+
+void nativeUpdate(Window w,)
+{
+}
+
+void nativeSetFocus(Window w)
+{
+}
+
+void nativeSetCapture(Window w, bool onOff)
+{
+}
+
+rect nativeAdjustWindowPlace(Window w, rect clientPlace /*screen relative of desired client place*/) 
+{
+}
+
+bool NativeModalLoop(Window w, bool delegate() windowKeeper)
+{
+}
+
+
Index: harmonia/ui/widgets.d
===================================================================
--- harmonia/ui/widgets.d	(revision 31)
+++ harmonia/ui/widgets.d	(working copy)
@@ -32,6 +32,7 @@
 //|
 
 alias array!(Widget) WidgetArray;
+array!(int) test;
 
 class Widgets: Widget
 {
Index: harmonia/ui/window.d
===================================================================
--- harmonia/ui/window.d	(revision 31)
+++ harmonia/ui/window.d	(working copy)
@@ -36,7 +36,12 @@
     private import harmonia.ui.native.win32window;
 }
 else
+version (SDL)
 {
+    private import harmonia.ui.native.sdlwindow;
+}
+else
+{
     static assert(0);    // Windows only for a while, needs somebody to take care
 }
 
Index: harmonia/ui/controls/buttons.d
===================================================================
--- harmonia/ui/controls/buttons.d	(revision 31)
+++ harmonia/ui/controls/buttons.d	(working copy)
@@ -304,7 +304,7 @@
     return _hint = ttt;
   }
 
-  box   value()
+  box value()
   {
     return box(groupCheckedState());
   }
Index: harmonia/ui/controls/editbox.d
===================================================================
--- harmonia/ui/controls/editbox.d	(revision 31)
+++ harmonia/ui/controls/editbox.d	(working copy)
@@ -141,4 +141,4 @@
   //|
 
 
-}
\ No newline at end of file
+}
Index: harmonia/gx/graphics.d
===================================================================
--- harmonia/gx/graphics.d	(revision 31)
+++ harmonia/gx/graphics.d	(working copy)
@@ -33,7 +33,12 @@
     private import harmonia.ui.native.win32graphics;
 }
 else
+version (SDL)
 {
+    private import harmonia.ui.native.sdlgraphics;
+}
+else
+{
     static assert(0);    // Windows only for a while, need somebody to take care
 }
 
Index: harmonia/gx/images.d
===================================================================
--- harmonia/gx/images.d	(revision 31)
+++ harmonia/gx/images.d	(working copy)
@@ -31,7 +31,12 @@
     private import harmonia.ui.native.win32graphics;
 }
 else
+version (SDL)
 {
+    private import harmonia.ui.native.sdlgraphics;
+}
+else
+{
     static assert(0);    // Windows only for a while, need somebody to take care
 }
 

