changeset 731:6a589a1a42b0

Add dw_window_get_font() Add incomplete dw_scrollbox_get* functions Add initial QNX Photon support
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 Mar 2011 01:46:41 +0000
parents d3fb3613726a
children db3a173e487e
files dw.h mac/dw.m
diffstat 2 files changed, 541 insertions(+), 215 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Tue Mar 15 01:13:29 2011 +0000
+++ b/dw.h	Tue Mar 15 01:46:41 2011 +0000
@@ -8,6 +8,7 @@
 #define DW_MINOR_VERSION 1
 #define DW_SUB_VERSION 0
 
+#if !defined(__PHOTON__)
 /* These corespond to the entries in the color
  * arrays in the Win32 dw.c, they are also the
  * same as DOS ANSI colors.
@@ -29,6 +30,7 @@
 #define DW_CLR_CYAN              14
 #define DW_CLR_WHITE             15
 #define DW_CLR_DEFAULT           16
+#endif
 
 /* Signal handler defines */
 #define DW_SIGNAL_CONFIGURE      "configure_event"
@@ -114,6 +116,7 @@
 #define FCF_CLOSEBUTTON            0x04000000L
 #endif
 
+#define DW_FCF_CLOSEBUTTON       0
 #define DW_FCF_TITLEBAR          FCF_TITLEBAR
 #define DW_FCF_SYSMENU           (FCF_SYSMENU | FCF_CLOSEBUTTON)
 #define DW_FCF_MENU              FCF_MENU
@@ -160,6 +163,7 @@
 #define DW_POINTER_DEFAULT       0
 #define DW_POINTER_ARROW         SPTR_ARROW
 #define DW_POINTER_CLOCK         SPTR_WAIT
+#define DW_POINTER_QUESTION      SPTR_ICONQUESICON
 
 #define DW_OS2_NEW_WINDOW        1
 
@@ -251,13 +255,13 @@
 
 /* Unfortunately using Cocoa we can't include
  * Cocoa.h from C code, so we have to instead
- * use opaque types and use the values from 
+ * use opaque types and use the values from
  * Cocoa.h in the header here directly without
  * using the symbolic names.
  */
 
-#define TRUE	1
-#define FALSE	0
+#define TRUE 1
+#define FALSE 0
 
 typedef void *HWND;
 typedef void *HSHM;
@@ -314,7 +318,7 @@
 #define DW_DT_EXTERNALLEADING    0
 #define DW_DT_CENTER             2 /* NSCenterTextAlignment */
 #define DW_DT_RIGHT              1 /* NSCenterTextAlignment */
-#define DW_DT_TOP                0 
+#define DW_DT_TOP                0
 #define DW_DT_VCENTER            0
 #define DW_DT_BOTTOM             0
 #define DW_DT_HALFTONE           0
@@ -322,6 +326,7 @@
 #define DW_DT_WORDBREAK          0
 #define DW_DT_ERASERECT          0
 
+#define DW_FCF_CLOSEBUTTON       0
 #define DW_FCF_TITLEBAR          (1 << 0) /* NSTitledWindowMask */
 #define DW_FCF_SYSMENU           (1 << 1) /* NSClosableWindowMask */
 #define DW_FCF_MENU              0
@@ -505,6 +510,7 @@
 #define DW_DT_WORDBREAK          0
 #define DW_DT_ERASERECT          0
 
+#define DW_FCF_CLOSEBUTTON       0
 #define DW_FCF_TITLEBAR          WS_CAPTION
 #define DW_FCF_SYSMENU           WS_SYSMENU
 #define DW_FCF_MENU              0
@@ -551,6 +557,7 @@
 #define DW_POINTER_DEFAULT       0
 #define DW_POINTER_ARROW         32512
 #define DW_POINTER_CLOCK         32514
+#define DW_POINTER_QUESTION      32651
 
 /* flag values for dw_messagebox() */
 #define DW_MB_OK                 MB_OK
@@ -689,6 +696,264 @@
    char bubbletext[BUBBLE_HELP_MAX];
 } BubbleButton;
 
+#elif defined(__PHOTON__)
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/utsname.h>
+/* Photon specific section */
+#include <Pt.h>
+#include <Ph.h>
+/* which image formats supported */
+#define PX_IMAGE_MODULES
+#define PX_GIF_SUPPORT
+#define PX_JPG_SUPPORT
+#define PX_BMP_SUPPORT
+#define PX_PND_SUPPORT
+#include <photon/PxImage.h>
+
+#define TRUE  1
+#define FALSE 0
+
+typedef PtWidget_t *pPtWidget_t;
+typedef pPtWidget_t HWND;
+
+typedef unsigned long ULONG;
+typedef long LONG;
+typedef unsigned short USHORT;
+typedef short SHORT;
+typedef unsigned short UWORD;
+typedef short WORD ;
+typedef unsigned char UCHAR;
+typedef char CHAR;
+typedef unsigned UINT;
+typedef int INT;
+typedef void *HMTX;
+typedef void *HEV;
+typedef void *HSHM;
+typedef void *HMOD;
+typedef PtTreeItem_t *HTREEITEM;
+typedef HWND HMENUI;
+typedef int DWTID;
+typedef unsigned long HICN;
+
+typedef struct _user_data
+{
+   struct _user_data *next;
+   void              *data;
+   char              *varname;
+} UserData;
+
+typedef struct _window_data {
+   UserData *root;
+   HWND clickdefault;
+   ULONG flags;
+   void *data;
+} WindowData;
+
+typedef struct _hpixmap {
+   unsigned long width, height;
+   /* ?? *pixmap; */
+   HWND handle;
+} *HPIXMAP;
+
+/* colors matching Photon Graphics colors */
+#define DW_CLR_BLACK             Pg_BLACK
+#define DW_CLR_DARKRED           Pg_DRED
+#define DW_CLR_DARKGREEN         Pg_DGREEN
+#define DW_CLR_BROWN             Pg_BROWN
+#define DW_CLR_DARKBLUE          Pg_DBLUE
+#define DW_CLR_DARKPINK          Pg_PURPLE
+#define DW_CLR_DARKCYAN          Pg_DCYAN
+#define DW_CLR_PALEGRAY          Pg_GRAY
+#define DW_CLR_DARKGRAY          Pg_MGRAY
+#define DW_CLR_RED               Pg_RED
+#define DW_CLR_GREEN             Pg_GREEN
+#define DW_CLR_YELLOW            Pg_YELLOW
+#define DW_CLR_BLUE              Pg_BLUE
+#define DW_CLR_PINK              Pg_MAGENTA
+#define DW_CLR_CYAN              Pg_CYAN
+#define DW_CLR_WHITE             Pg_WHITE
+#define DW_CLR_DEFAULT           Pg_GRAY
+/* color manipulation macros */
+#define DW_RGB_COLOR (0xF0000000)
+#define DW_RGB_TRANSPARENT (0x0F000000)
+#define DW_RGB_MASK (0x00FFFFFF)
+#define DW_RED_MASK (0x00FF0000)
+#define DW_GREEN_MASK (0x0000FF00)
+#define DW_BLUE_MASK (0x000000FF)
+#define DW_RED_VALUE(a) PgRedValue(a)
+#define DW_GREEN_VALUE(a) PgGreenValue(a)
+#define DW_BLUE_VALUE(a) PgBluValue(a)
+#define DW_RGB(a, b, c) PgRGB( a, b, c )
+
+#define DW_DT_LEFT               0
+#define DW_DT_QUERYEXTENT        0
+#define DW_DT_UNDERSCORE         0
+#define DW_DT_STRIKEOUT          0
+#define DW_DT_TEXTATTRS          0
+#define DW_DT_EXTERNALLEADING    0
+#define DW_DT_CENTER             0
+#define DW_DT_RIGHT              0
+#define DW_DT_TOP                0
+#define DW_DT_VCENTER            0
+#define DW_DT_BOTTOM             0
+#define DW_DT_HALFTONE           0
+#define DW_DT_MNEMONIC           0
+#define DW_DT_WORDBREAK          0
+#define DW_DT_ERASERECT          0
+
+#define DW_FCF_CLOSEBUTTON       Ph_WM_RENDER_CLOSE
+#define DW_FCF_TITLEBAR          Ph_WM_RENDER_TITLE
+#define DW_FCF_SYSMENU           0
+#define DW_FCF_MENU              Ph_WM_RENDER_MENU
+#define DW_FCF_SIZEBORDER        Ph_WM_RENDER_RESIZE
+#define DW_FCF_MINBUTTON         Ph_WM_RENDER_MIN
+#define DW_FCF_MAXBUTTON         Ph_WM_RENDER_MAX
+#define DW_FCF_MINMAX            (Ph_WM_RENDER_MIN|Ph_WM_RENDER_MAX)
+#define DW_FCF_VERTSCROLL        0
+#define DW_FCF_HORZSCROLL        0
+#define DW_FCF_DLGBORDER         0
+#define DW_FCF_BORDER            Ph_WM_RENDER_BORDER
+#define DW_FCF_SHELLPOSITION     0
+#define DW_FCF_TASKLIST          0
+#define DW_FCF_NOBYTEALIGN       0
+#define DW_FCF_NOMOVEWITHOWNER   0
+#define DW_FCF_SYSMODAL          0
+#define DW_FCF_HIDEBUTTON        0
+#define DW_FCF_HIDEMAX           0
+#define DW_FCF_AUTOICON          (Ph_WM_RENDER_ASICON | ~Ph_WM_RENDER_ASAPP)
+#define DW_FCF_MAXIMIZE          0
+#define DW_FCF_MINIMIZE          0
+
+#define DW_CFA_BITMAPORICON      1
+#define DW_CFA_STRING            (1 << 1)
+#define DW_CFA_ULONG             (1 << 2)
+#define DW_CFA_TIME              (1 << 3)
+#define DW_CFA_DATE              (1 << 4)
+#define DW_CFA_CENTER            (1 << 5)
+#define DW_CFA_LEFT              (1 << 6)
+#define DW_CFA_RIGHT             (1 << 7)
+#define DW_CFA_STRINGANDICON     (1 << 8)
+#define DW_CFA_HORZSEPARATOR     0
+#define DW_CFA_SEPARATOR         0
+
+#define DW_CRA_SELECTED          1
+#define DW_CRA_CURSORED          (1 << 1)
+
+#define DW_LS_MULTIPLESEL        1
+
+#define DW_LIT_NONE              -1
+
+#ifdef MLFSEARCH_CASESENSITIVE
+# define DW_MLE_CASESENSITIVE    MLFSEARCH_CASESENSITIVE
+#else
+# define DW_MLE_CASESENSITIVE    0
+#endif
+
+#define DW_POINTER_DEFAULT       0
+#define DW_POINTER_ARROW         0
+#define DW_POINTER_CLOCK         0
+#define DW_POINTER_QUESTION      0
+
+#define HWND_DESKTOP     ((HWND)0)
+
+/* flag values for dw_messagebox() */
+#define DW_MB_OK                 (1 << 1)
+#define DW_MB_OKCANCEL           (1 << 2)
+#define DW_MB_YESNO              (1 << 3)
+#define DW_MB_YESNOCANCEL        (1 << 4)
+
+#define DW_MB_WARNING            (1 << 10)
+#define DW_MB_ERROR              (1 << 11)
+#define DW_MB_INFORMATION        (1 << 12)
+#define DW_MB_QUESTION           (1 << 13)
+
+/* Virtual Key Codes */
+#define VK_LBUTTON               0
+#define VK_RBUTTON               0
+#define VK_CANCEL                0
+#define VK_MBUTTON               0
+#define VK_BACK                  0
+#define VK_TAB                   0
+#define VK_CLEAR                 0
+#define VK_RETURN                0
+#define VK_MENU                  0
+#define VK_PAUSE                 0
+#define VK_CAPITAL               0
+#define VK_ESCAPE                0
+#define VK_SPACE                 0
+#define VK_PRIOR                 0
+#define VK_NEXT                  0
+#define VK_END                   0
+#define VK_HOME                  0
+#define VK_LEFT                  0
+#define VK_UP                    0
+#define VK_RIGHT                 0
+#define VK_DOWN                  0
+#define VK_SELECT                0
+#define VK_PRINT                 0
+#define VK_EXECUTE               0
+#define VK_SNAPSHOT              0
+#define VK_INSERT                0
+#define VK_DELETE                0
+#define VK_HELP                  0
+#define VK_LWIN                  0
+#define VK_RWIN                  0
+#define VK_NUMPAD0               0
+#define VK_NUMPAD1               0
+#define VK_NUMPAD2               0
+#define VK_NUMPAD3               0
+#define VK_NUMPAD4               0
+#define VK_NUMPAD5               0
+#define VK_NUMPAD6               0
+#define VK_NUMPAD7               0
+#define VK_NUMPAD8               0
+#define VK_NUMPAD9               0
+#define VK_MULTIPLY              0
+#define VK_ADD                   0
+#define VK_SEPARATOR             0
+#define VK_SUBTRACT              0
+#define VK_DECIMAL               0
+#define VK_DIVIDE                0
+#define VK_F1                    0
+#define VK_F2                    0
+#define VK_F3                    0
+#define VK_F4                    0
+#define VK_F5                    0
+#define VK_F6                    0
+#define VK_F7                    0
+#define VK_F8                    0
+#define VK_F9                    0
+#define VK_F10                   0
+#define VK_F11                   0
+#define VK_F12                   0
+#define VK_F13                   0
+#define VK_F14                   0
+#define VK_F15                   0
+#define VK_F16                   0
+#define VK_F17                   0
+#define VK_F18                   0
+#define VK_F19                   0
+#define VK_F20                   0
+#define VK_F21                   0
+#define VK_F22                   0
+#define VK_F23                   0
+#define VK_F24                   0
+#define VK_NUMLOCK               0
+#define VK_SCROLL                0
+#define VK_LSHIFT                0
+#define VK_RSHIFT                0
+#define VK_LCONTROL              0
+#define VK_RCONTROL              0
+#define VK_LMENU                 0
+#define VK_RMENU                 0
+
+/* Key Modifiers */
+#define KC_CTRL                  (1)
+#define KC_SHIFT                 (1 << 1)
+#define KC_ALT                   (1 << 2)
+
 #else
 /* GTK Specific section */
 #include <gtk/gtk.h>
@@ -743,6 +1008,7 @@
 #define DW_FCF_AUTOICON          (1 << 18)
 #define DW_FCF_MAXIMIZE          (1 << 19)
 #define DW_FCF_MINIMIZE          (1 << 20)
+#define DW_FCF_CLOSEBUTTON       (1 << 21)
 
 #define DW_CFA_BITMAPORICON      1
 #define DW_CFA_STRING            (1 << 1)
@@ -768,6 +1034,7 @@
 #define DW_POINTER_DEFAULT       0
 #define DW_POINTER_ARROW         GDK_TOP_LEFT_ARROW
 #define DW_POINTER_CLOCK         GDK_WATCH
+#define DW_POINTER_QUESTION      GDK_QUESTION_ARROW
 
 #define HWND_DESKTOP             ((HWND)0)
 
@@ -1004,6 +1271,7 @@
 #define DW_PIXMAP_WIDTH(x) (x ? x->width : 0)
 #define DW_PIXMAP_HEIGHT(x) (x ? x->height : 0)
 
+#if !defined(__PHOTON__)
 #define DW_RGB_COLOR (0xF0000000)
 #define DW_RGB_TRANSPARENT (0x0F000000)
 #define DW_RGB_MASK (0x00FFFFFF)
@@ -1014,6 +1282,7 @@
 #define DW_GREEN_VALUE(a) ((a & DW_GREEN_MASK) >> 8)
 #define DW_BLUE_VALUE(a) ((a & DW_BLUE_MASK) >> 16)
 #define DW_RGB(a, b, c) (0xF0000000 | a | b << 8 | c << 16)
+#endif
 
 #define DW_MENU_SEPARATOR ""
 #define DW_NOMENU 0
@@ -1076,11 +1345,14 @@
 int API dw_window_destroy(HWND handle);
 void API dw_window_redraw(HWND handle);
 int API dw_window_set_font(HWND handle, char *fontname);
+char * API dw_window_get_font(HWND handle);
 int API dw_window_set_color(HWND handle, unsigned long fore, unsigned long back);
 HWND API dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle);
 HWND API dw_box_new(int type, int pad);
-#ifdef INCOMPLETE
+#ifndef INCOMPLETE
 HWND API dw_scrollbox_new(int type, int pad);
+int API dw_scrollbox_get_pos( HWND handle, int orient );
+int API dw_scrollbox_get_range( HWND handle, int orient );
 #endif
 HWND API dw_groupbox_new(int type, int pad, char *title);
 HWND API dw_mdi_new(unsigned long id);
--- a/mac/dw.m	Tue Mar 15 01:13:29 2011 +0000
+++ b/mac/dw.m	Tue Mar 15 01:46:41 2011 +0000
@@ -9,7 +9,7 @@
  * clang -std=c99 -g -o dwtest -D__MAC__ -I. dwtest.c mac/dw.m -framework Cocoa -framework WebKit -fobjc-gc-only
  */
 #import <Cocoa/Cocoa.h>
-#import <WebKit/WebKit.h> 
+#import <WebKit/WebKit.h>
 #include "dw.h"
 #include <sys/utsname.h>
 #include <sys/socket.h>
@@ -185,7 +185,7 @@
                 int special = (int)[event modifierFlags];
                 unichar vk = [nchar characterAtIndex:0];
                 char ch;
-                
+
                 /* Handle a valid key */
                 if([nchar length] == 1)
                 {
@@ -195,7 +195,7 @@
                         ch = tmp[0];
                     }
                 }
-                    
+
                 return keypressfunc(handler->window, ch, (int)vk, special, handler->data);
             }
             /* Button press and release event */
@@ -207,7 +207,7 @@
 				LONG x,y;
 				
 				dw_pointer_query_pos(&x, &y);
-                
+
 				return buttonfunc(object, (int)x, (int)y, button, handler->data);
 			}
             /* Window close event */
@@ -242,7 +242,7 @@
             case 9:
             {
                 int (*containerselectfunc)(HWND, char *, void *) = handler->signalfunction;
-                
+
                 return containerselectfunc(handler->window, (char *)event, handler->data);
             }
             /* Container context menu event */
@@ -263,7 +263,7 @@
             {
                 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction;
                 int selected = (int)event;
-                
+
                 return valuechangedfunc(handler->window, selected, handler->data);;
             }
             /* Tree class selection event */
@@ -273,12 +273,12 @@
                 char *text = (char *)event;
                 void *user = NULL;
                 id item = nil;
-                
+
                 if([object isKindOfClass:[NSOutlineView class]])
                 {
                     item = (id)event;
                     NSString *nstr = [item pointerAtIndex:1];
-                    
+
                     if(nstr)
                     {
                         text = strdup([nstr UTF8String]);
@@ -302,7 +302,7 @@
             case 13:
             {
                 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction;
-                
+
                 return setfocusfunc(handler->window, handler->data);
             }
             /* Notebook page change event */
@@ -310,13 +310,13 @@
             {
                 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction;
                 int pageid = (int)event;
-                
+
                 return switchpagefunc(handler->window, pageid, handler->data);
             }
             case 16:
             {
                 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))handler->signalfunction;
-                
+
                 return treeexpandfunc(handler->window, (HTREEITEM)event, handler->data);
             }
 		}
@@ -368,7 +368,7 @@
 @end
 
 @implementation DWObject
--(void)uselessThread:(id)sender { /* Thread only to initialize threading */ } 
+-(void)uselessThread:(id)sender { /* Thread only to initialize threading */ }
 -(void)synchronizeThread:(id)param
 {
     pthread_mutex_unlock(DWRunMutex);
@@ -382,7 +382,7 @@
     DWBitBlt *bltinfo = (DWBitBlt *)[bi pointerValue];
     id bltdest = bltinfo->dest;
     id bltsrc = bltinfo->src;
-    
+
     if([bltdest isMemberOfClass:[NSImage class]])
     {
         [bltdest lockFocus];
@@ -395,7 +395,7 @@
     if([bltsrc isMemberOfClass:[NSImage class]])
     {
         NSImage *image = bltsrc;
-        [image drawAtPoint:NSMakePoint(bltinfo->xdest, bltinfo->ydest) fromRect:NSMakeRect(bltinfo->xsrc, bltinfo->ysrc, bltinfo->width, bltinfo->height) 
+        [image drawAtPoint:NSMakePoint(bltinfo->xdest, bltinfo->ydest) fromRect:NSMakeRect(bltinfo->xsrc, bltinfo->ysrc, bltinfo->width, bltinfo->height)
                         operation:NSCompositeCopy fraction:1.0];
         [bltsrc release];
     }
@@ -418,13 +418,13 @@
 /* So basically to implement our event handlers...
  * it looks like we are going to have to subclass
  * basically everything.  Was hoping to add methods
- * to the superclasses but it looks like you can 
- * only add methods and no variables, which isn't 
+ * to the superclasses but it looks like you can
+ * only add methods and no variables, which isn't
  * going to work. -Brian
  */
 
 /* Subclass for a box type */
-@interface DWBox : NSView 
+@interface DWBox : NSView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSWindowDelegate>
 #endif
@@ -434,7 +434,7 @@
 	NSColor *bgcolor;
 }
 -(id)init;
--(void)dealloc; 
+-(void)dealloc;
 -(Box *)box;
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -451,17 +451,17 @@
 @end
 
 @implementation DWBox
--(id)init 
+-(id)init
 {
     self = [super init];
-    
-    if (self) 
+
+    if (self)
     {
         box = calloc(1, sizeof(Box));
     }
     return self;
 }
--(void)dealloc 
+-(void)dealloc
 {
     UserData *root = userdata;
     free(box);
@@ -471,7 +471,7 @@
 -(Box *)box { return box; }
 -(void *)userdata { return userdata; }
 -(void)setUserdata:(void *)input { userdata = input; }
--(void)drawRect:(NSRect)rect 
+-(void)drawRect:(NSRect)rect
 {
 	if(bgcolor)
 	{
@@ -501,7 +501,7 @@
 @end
 
 /* Subclass for a top-level window */
-@interface DWView : DWBox  
+@interface DWView : DWBox
 {
 	NSMenu *windowmenu;
 }
@@ -513,7 +513,7 @@
 @end
 
 @implementation DWView
--(BOOL)windowShouldClose:(id)sender 
+-(BOOL)windowShouldClose:(id)sender
 {
     if(_event_handler(self, nil, 6) == FALSE)
 		return NO;
@@ -541,7 +541,7 @@
 	{
 		[DWApp setMainMenu:windowmenu];
 	}
-	else 
+	else
 	{
 		[DWApp setMainMenu:DWMainMenu];
 	}
@@ -555,7 +555,7 @@
 /* Subclass for a button type */
 @interface DWButton : NSButton
 {
-	void *userdata; 
+	void *userdata;
 }
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -572,7 +572,7 @@
 /* Subclass for a progress type */
 @interface DWPercent : NSProgressIndicator
 {
-	void *userdata; 
+	void *userdata;
 }
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -587,7 +587,7 @@
 /* Subclass for a entryfield type */
 @interface DWEntryField : NSTextField
 {
-	void *userdata; 
+	void *userdata;
 }
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -602,7 +602,7 @@
 /* Subclass for a entryfield password type */
 @interface DWEntryFieldPassword : NSSecureTextField
 {
-	void *userdata; 
+	void *userdata;
 }
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -615,7 +615,7 @@
 @end
 
 /* Subclass for a Notebook control type */
-@interface DWNotebook : NSTabView 
+@interface DWNotebook : NSTabView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSTabViewDelegate>
 #endif
@@ -673,7 +673,7 @@
 @end
 
 /* Subclass for a color chooser type */
-@interface DWColorChoose : NSColorPanel 
+@interface DWColorChoose : NSColorPanel
 {
 	DWDialog *dialog;
 }
@@ -690,12 +690,12 @@
 @end
 
 /* Subclass for a splitbar type */
-@interface DWSplitBar : NSSplitView 
+@interface DWSplitBar : NSSplitView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
-<NSSplitViewDelegate> 
+<NSSplitViewDelegate>
 #endif
-{ 
-	void *userdata; 
+{
+	void *userdata;
     float percent;
 }
 -(void)splitViewDidResizeSubviews:(NSNotification *)aNotification;
@@ -732,7 +732,7 @@
 /* Subclass for a slider type */
 @interface DWSlider : NSSlider
 {
-	void *userdata; 
+	void *userdata;
 }
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
@@ -767,31 +767,31 @@
 -(float)range { return range; }
 -(float)visible { return visible; }
 -(void)setRange:(float)input1 andVisible:(float)input2 { range = input1; visible = input2; }
--(void)scrollerChanged:(id)sender 
-{ 
+-(void)scrollerChanged:(id)sender
+{
     double proportion = [self knobProportion];
     int page = (int)(proportion * range);
-    int max = (int)(range - page); 
+    int max = (int)(range - page);
     int result = (int)([self doubleValue] * max);
     int newpos = result;
-    
-    switch ([sender hitPart]) 
+
+    switch ([sender hitPart])
     {
-            
+
         case NSScrollerDecrementLine:
             if(newpos > 0)
             {
                 newpos--;
             }
             break;
-            
+
         case NSScrollerIncrementLine:
             if(newpos < max)
             {
                 newpos++;
             }
             break;
-            
+
         case NSScrollerDecrementPage:
             newpos -= page;
             if(newpos < 0)
@@ -799,7 +799,7 @@
                 newpos = 0;
             }
             break;
-            
+
         case NSScrollerIncrementPage:
             newpos += page;
             if(newpos > max)
@@ -807,7 +807,7 @@
                 newpos = max;
             }
             break;
-            
+
         default:
             ; // do nothing
     }
@@ -816,13 +816,13 @@
         double newposd = (double)newpos/max;
         [self setDoubleValue:newposd];
     }
-    _event_handler(self, (void *)newpos, 14); 
+    _event_handler(self, (void *)newpos, 14);
 }
 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
 @end
 
 /* Subclass for a render area type */
-@interface DWRender : NSView 
+@interface DWRender : NSView
 {
 	void *userdata;
 }
@@ -855,7 +855,7 @@
 @end
 
 /* Subclass for a MLE type */
-@interface DWMLE : NSTextView 
+@interface DWMLE : NSTextView
 {
 	void *userdata;
 }
@@ -870,7 +870,7 @@
 @end
 
 /* Subclass for a Container/List type */
-@interface DWContainer : NSTableView 
+@interface DWContainer : NSTableView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSTableViewDataSource>
 #endif
@@ -954,33 +954,33 @@
 -(void)setScrollview:(id)input { scrollview = input; }
 -(void)addColumn:(NSTableColumn *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } }
 -(NSTableColumn *)getColumn:(int)col { if(tvcols) { return [tvcols objectAtIndex:col]; } return nil; }
--(int)insertRow:(NSArray *)input at:(int)index 
-{ 
-    if(data) 
-    { 
+-(int)insertRow:(NSArray *)input at:(int)index
+{
+    if(data)
+    {
         unsigned long start = [tvcols count] * index;
-        NSIndexSet *set = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(start, start + [tvcols count])];  
+        NSIndexSet *set = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(start, start + [tvcols count])];
         if(index < lastAddPoint)
         {
             lastAddPoint++;
         }
-        [data insertObjects:input atIndexes:set]; 
-        [titles insertPointer:NULL atIndex:index]; 
+        [data insertObjects:input atIndexes:set];
+        [titles insertPointer:NULL atIndex:index];
         [set release];
-        return (int)[titles count]; 
-    } 
-    return 0; 
-}
--(int)addRow:(NSArray *)input 
-{ 
-    if(data) 
-    { 
-        lastAddPoint = (int)[titles count]; 
-        [data addObjectsFromArray:input]; 
-        [titles addPointer:NULL]; 
-        return (int)[titles count]; 
-    } 
-    return 0; 
+        return (int)[titles count];
+    }
+    return 0;
+}
+-(int)addRow:(NSArray *)input
+{
+    if(data)
+    {
+        lastAddPoint = (int)[titles count];
+        [data addObjectsFromArray:input];
+        [titles addPointer:NULL];
+        return (int)[titles count];
+    }
+    return 0;
 }
 -(int)addRows:(int)number
 {
@@ -1040,11 +1040,11 @@
 -(int)lastQueryPoint { return lastQueryPoint; }
 -(void)setLastQueryPoint:(int)input { lastQueryPoint = input; }
 -(void)clear { if(data) { [data removeAllObjects]; while([titles count]) { [titles removePointerAtIndex:0]; } } lastAddPoint = 0; }
--(void)setup 
-{ 
-	tvcols = [[[NSMutableArray alloc] init] retain]; 
-	data = [[[NSMutableArray alloc] init] retain]; 
-	types = [[[NSMutableArray alloc] init] retain]; 
+-(void)setup
+{
+	tvcols = [[[NSMutableArray alloc] init] retain];
+	data = [[[NSMutableArray alloc] init] retain];
+	types = [[[NSMutableArray alloc] init] retain];
 	titles = [[NSPointerArray pointerArrayWithWeakObjects] retain];
 	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:[self window]];
 }
@@ -1060,7 +1060,7 @@
     /* Handler for listbox class */
 	_event_handler(self, (NSEvent *)(int)[self selectedRow], 11);
 }
--(NSMenu *)menuForEvent:(NSEvent *)event 
+-(NSMenu *)menuForEvent:(NSEvent *)event
 {
     int row;
     NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];
@@ -1078,12 +1078,12 @@
     {
         int count = (int)[node count];
         int z;
-        
+
         for(z=0;z<count;z++)
         {
             NSPointerArray *pnt = [node objectAtIndex:z];
             NSMutableArray *children = (NSMutableArray *)[pnt pointerAtIndex:3];
-            
+
             if(children)
             {
                 if(item == pnt)
@@ -1104,7 +1104,7 @@
 }
 
 /* Subclass for a Tree type */
-@interface DWTree : NSOutlineView 
+@interface DWTree : NSOutlineView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSOutlineViewDataSource>
 #endif
@@ -1113,7 +1113,7 @@
 	NSTableColumn *imagecol;
     NSTableColumn *textcol;
 	NSMutableArray *data;
-    /* Each data item consists of a linked lists of tree item data. 
+    /* Each data item consists of a linked lists of tree item data.
      * NSImage *, NSString *, Item Data *, NSMutableArray * of Children
      */
     id scrollview;
@@ -1135,11 +1135,11 @@
 @end
 
 @implementation DWTree
--(id)init 
+-(id)init
 {
     self = [super init];
-    
-    if (self) 
+
+    if (self)
     {
         imagecol = [[NSTableColumn alloc] init];
         NSImageCell *imagecell = [[[NSImageCell alloc] init] autorelease];
@@ -1157,7 +1157,7 @@
 }
 -(id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
 {
-	if(item) 
+	if(item)
     {
         NSMutableArray *array = [item pointerAtIndex:3];
 		return array ? [array objectAtIndex:index] : nil;
@@ -1186,16 +1186,16 @@
         }
     }
     else
-    {   
+    {
         return data ? (int)[data count] : 0;
     }
 }
 -(id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
 {
-	if(item) 
+	if(item)
     {
 		if([item isKindOfClass:[NSPointerArray class]])
-        {  
+        {
 			NSPointerArray *this = (NSPointerArray *)item;
             if(tableColumn == imagecol)
             {
@@ -1204,7 +1204,7 @@
             return [this pointerAtIndex:1];
         }
 		else
-        {   
+        {
 			return nil;
         }
 	}
@@ -1244,16 +1244,16 @@
         _event_handler(self, (void *)item, 12);
     }
 }
--(void)treeItemExpanded:(NSNotification *)notification 
-{ 
+-(void)treeItemExpanded:(NSNotification *)notification
+{
     id item = [[notification userInfo ] objectForKey: @"NSObject"];
-    
+
     if(item)
     {
         _event_handler(self, (void *)item, 16);
     }
 }
--(NSMenu *)menuForEvent:(NSEvent *)event 
+-(NSMenu *)menuForEvent:(NSEvent *)event
 {
     int row;
     NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];
@@ -1267,19 +1267,19 @@
 -(void)setScrollview:(NSScrollView *)input { scrollview = input; }
 -(void)deleteNode:(NSPointerArray *)item { _free_tree_recurse(data, item); }
 -(void)clear { NSMutableArray *toclear = data; data = nil; _free_tree_recurse(toclear, NULL); [self reloadData]; }
--(void)dealloc 
-{ 
-    UserData *root = userdata; 
-    _remove_userdata(&root, NULL, TRUE); 
-    _free_tree_recurse(data, NULL); 
+-(void)dealloc
+{
+    UserData *root = userdata;
+    _remove_userdata(&root, NULL, TRUE);
+    _free_tree_recurse(data, NULL);
     [imagecol release];
     [textcol release];
-    [super dealloc]; 
+    [super dealloc];
 }
 @end
 
 /* Subclass for a Calendar type */
-@interface DWCalendar : NSDatePicker 
+@interface DWCalendar : NSDatePicker
 {
 	void *userdata;
 }
@@ -1294,7 +1294,7 @@
 @end
 
 /* Subclass for a Combobox type */
-@interface DWComboBox : NSComboBox 
+@interface DWComboBox : NSComboBox
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSComboBoxDelegate>
 #endif
@@ -1315,8 +1315,8 @@
 
 /* Subclass for a stepper component of the spinbutton type */
 /* This is a bad way of doing this... but I can't get the other methods to work */
-@interface DWStepper : NSStepper 
-{ 
+@interface DWStepper : NSStepper
+{
     id textfield;
     id parent;
 }
@@ -1336,7 +1336,7 @@
 -(void)mouseDown:(NSEvent *)event
 {
     [super mouseDown:event];
-    if([[NSApp currentEvent] type] == NSLeftMouseUp) 
+    if([[NSApp currentEvent] type] == NSLeftMouseUp)
     {
         [textfield takeIntValueFrom:self];
         _event_handler(parent, (void *)[self integerValue], 14);
@@ -1344,13 +1344,13 @@
 }
 -(void)mouseUp:(NSEvent *)event
 {
-    [textfield takeIntValueFrom:self]; 
+    [textfield takeIntValueFrom:self];
     _event_handler(parent, (void *)[self integerValue], 14);
 }
 @end
 
 /* Subclass for a Spinbutton type */
-@interface DWSpinButton : NSView 
+@interface DWSpinButton : NSView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
 <NSTextFieldDelegate>
 #endif
@@ -1368,11 +1368,11 @@
 @end
 
 @implementation DWSpinButton
--(id)init 
+-(id)init
 {
     self = [super init];
-    
-    if(self) 
+
+    if(self)
     {
         textfield = [[NSTextField alloc] init];
         [self addSubview:textfield];
@@ -1398,7 +1398,7 @@
 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
 @end
 
-/* Subclass for a MDI type 
+/* Subclass for a MDI type
  * This is just a box for display purposes... but it is a
  * unique class so it can be identified when creating windows.
  */
@@ -1777,7 +1777,7 @@
 				DWNotebook *notebook = (DWNotebook *)handle;
 				DWNotebookPage *notepage = (DWNotebookPage *)[notebook selectedTabViewItem];
 				DWBox *view = [notepage view];
-					 
+					
 				if(view != nil)
 				{
 					Box *box = [view box];
@@ -1804,14 +1804,14 @@
 			{
                 DWSplitBar *split = (DWSplitBar *)handle;
 				float percent = [split percent];
-                
+
                 if(percent > 0)
                 {
                     dw_splitbar_set(handle, percent);
                     [split setPercent:0];
                 }
 			}
-			 
+			
 			if(thisbox->type == DW_HORZ)
                currentx += width + vectorx + (pad * 2);
             if(thisbox->type == DW_VERT)
@@ -1931,12 +1931,12 @@
 void API dw_main_sleep(int milliseconds)
 {
     DWTID curr = pthread_self();
-    
+
     if(DWThread == (DWTID)-1 || DWThread == curr)
     {
         DWTID orig = DWThread;
         NSDate *until = [NSDate dateWithTimeIntervalSinceNow:(milliseconds/1000.0)];
-        
+
         if(orig == (DWTID)-1)
         {
             dw_mutex_lock(DWRunMutex);
@@ -1966,7 +1966,7 @@
                                         untilDate:date
                                            inMode:NSDefaultRunLoopMode
                                           dequeue:YES];
-    if(event) 
+    if(event)
     {
         [DWApp sendEvent:event];
         [DWApp updateWindows];
@@ -1981,7 +1981,7 @@
 void API dw_main_iteration(void)
 {
     DWTID curr = pthread_self();
-    
+
     if(DWThread == (DWTID)-1)
     {
         dw_mutex_lock(DWRunMutex);
@@ -2078,18 +2078,18 @@
 	if(flags & DW_MB_ERROR)
 	{
 		iResponse = (int)
-		NSRunCriticalAlertPanel([ NSString stringWithUTF8String:title ], 
+		NSRunCriticalAlertPanel([ NSString stringWithUTF8String:title ],
 								[ NSString stringWithUTF8String:outbuf ],
 								button1, button2, button3);	}
-	else 
+	else
 	{
 		iResponse = (int)
-		NSRunAlertPanel([ NSString stringWithUTF8String:title ], 
+		NSRunAlertPanel([ NSString stringWithUTF8String:title ],
 						[ NSString stringWithUTF8String:outbuf ],
 						button1, button2, button3);
 	}
 	
-	switch(iResponse) 
+	switch(iResponse)
 	{
 		case NSAlertDefaultReturn:    /* user pressed OK */
 			if(flags & DW_MB_YESNO || flags & DW_MB_YESNOCANCEL)
@@ -2275,7 +2275,7 @@
 {
     int _locked_by_me = FALSE;
     DW_MUTEX_LOCK;
-    DWBox *view = [[DWBox alloc] init];  
+    DWBox *view = [[DWBox alloc] init];
 	Box *newbox = [view box];
 	memset(newbox, 0, sizeof(Box));
    	newbox->pad = pad;
@@ -2298,6 +2298,49 @@
 	return box;
 }
 
+#ifndef INCOMPLETE
+/*
+ * Create a new scrollable Box to be packed.
+ * Parameters:
+ *       type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
+ *       pad: Number of pixels to pad around the box.
+ * This works fine under GTK+, but is incomplete on other platforms
+ */
+HWND dw_scrollbox_new( int type, int pad )
+{
+   DWBox *box = dw_box_new(type, pad);
+   [box setFocusRingType:NSFocusRingTypeExterior];
+   NSLog(@"dw_scrollbox_new() unimplemented\n");
+   return box;
+}
+
+/*
+ * Returns the position of the scrollbar in the scrollbox
+ * Parameters:
+ *          handle: Handle to the scrollbox to be queried.
+ *          orient: The vertical or horizontal scrollbar.
+ */
+int dw_scrollbox_get_pos(HWND handle, int orient)
+{
+   int val = -1;
+   NSLog(@"dw_scrollbox_get_pos() unimplemented\n");
+   return val;
+}
+
+/*
+ * Gets the range for the scrollbar in the scrollbox.
+ * Parameters:
+ *          handle: Handle to the scrollbox to be queried.
+ *          orient: The vertical or horizontal scrollbar.
+ */
+int API dw_scrollbox_get_range(HWND handle, int orient)
+{
+   int val = -1;
+   NSLog(@"dw_scrollbox_get_range() unimplemented\n");
+   return val;
+}
+#endif
+
 /*
  * Pack windows (widgets) into a box from the end (or bottom).
  * Parameters:
@@ -2342,7 +2385,7 @@
 		DWTree *tree = item;
 		this = item = [tree scrollview];
 	}
-    
+
 	/* Duplicate the existing data */
     tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
 
@@ -2566,7 +2609,7 @@
     /* TODO: Implement tooltips */
     NSBundle *bundle = [NSBundle mainBundle];
     NSString *respath = [bundle resourcePath];
-    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 
+    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
 	NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
 	DWButton *button = _button_new("", resid);
 	[button setImage:image];
@@ -2752,7 +2795,7 @@
         scrollbar = [[DWScrollbar alloc] initWithFrame:NSMakeRect(0,0,100,5)];
     }
     [scrollbar setArrowsPosition:NSScrollerArrowsDefaultSetting];
-    [scrollbar setTarget:scrollbar]; 
+    [scrollbar setTarget:scrollbar];
     [scrollbar setAction:@selector(changed:)];
     [scrollbar setRange:0.0 andVisible:0.0];
     [scrollbar setKnobProportion:1.0];
@@ -2877,7 +2920,7 @@
 	{
 		[button setState:NSOnState];
 	}
-	else 
+	else
 	{
 		[button setState:NSOffState];
 	}
@@ -2887,14 +2930,14 @@
 /* Common code for containers and listboxes */
 HWND _cont_new(ULONG cid, int multi)
 {
-    NSScrollView *scrollview  = [[NSScrollView alloc] init];    
+    NSScrollView *scrollview  = [[NSScrollView alloc] init];
 	DWContainer *cont = [[DWContainer alloc] init];
-    
+
     [cont setScrollview:scrollview];
     [scrollview setBorderType:NSBezelBorder];
     [scrollview setHasVerticalScroller:YES];
     [scrollview setAutohidesScrollers:YES];
-    
+
 	if(multi)
 	{
 		[cont setAllowsMultipleSelection:YES];
@@ -2955,7 +2998,7 @@
         DWContainer *cont = handle;
         NSString *nstr = [ NSString stringWithUTF8String:text ];
         NSArray *newrow = [NSArray arrayWithObject:nstr];
-        
+
         [cont addRow:newrow];
         /*[cont performSelectorOnMainThread:@selector(addRow:)
                                withObject:newrow
@@ -2989,7 +3032,7 @@
         DWContainer *cont = handle;
         NSString *nstr = [ NSString stringWithUTF8String:text ];
         NSArray *newrow = [NSArray arrayWithObject:nstr];
-        
+
         [cont insertRow:newrow at:pos];
         [cont reloadData];
     }
@@ -3028,7 +3071,7 @@
 		{		
             NSString *nstr = [ NSString stringWithUTF8String:text[z] ];
             NSArray *newrow = [[NSArray alloc] arrayWithObject:nstr];
-        
+
             [cont addRow:newrow];
         }
         [cont reloadData];
@@ -3056,7 +3099,7 @@
     else if([object isMemberOfClass:[DWContainer class]])
     {
         DWContainer *cont = handle;
-        
+
         [cont clear];
         [cont reloadData];
     }
@@ -3111,7 +3154,7 @@
     else if([object isMemberOfClass:[DWContainer class]])
     {
         DWContainer *cont = handle;
-        
+
         [cont scrollRowToVisible:top];
     }
     DW_MUTEX_UNLOCK;
@@ -3135,7 +3178,7 @@
 	{
 		DWComboBox *combo = handle;
         int count = (int)[combo numberOfItems];
-        
+
         if(index > count)
         {
             *buffer = '\0';
@@ -3150,7 +3193,7 @@
     {
         DWContainer *cont = handle;
         int count = (int)[cont numberOfRowsInTableView:cont];
-        
+
         if(index > count)
         {
             *buffer = '\0';
@@ -3158,7 +3201,7 @@
         else
         {
             NSString *nstr = [cont getRow:index and:0];
-        
+
             strncpy(buffer, [ nstr UTF8String ], length - 1);
         }
     }
@@ -3193,16 +3236,16 @@
     {
         DWContainer *cont = handle;
         int count = (int)[cont numberOfRowsInTableView:cont];
-        
+
         if(index <= count)
         {
             NSString *nstr = [ NSString stringWithUTF8String:buffer ];
-        
+
             [cont editCell:nstr at:index and:0];
             [cont reloadData];
         }
     }
-    DW_MUTEX_UNLOCK;    
+    DW_MUTEX_UNLOCK;
 }
 
 /*
@@ -3243,18 +3286,18 @@
     DW_MUTEX_LOCK;
 	id object = handle;
     int retval = -1;
-    
+
     if([object isMemberOfClass:[DWContainer class]])
     {
         DWContainer *cont = handle;
         NSIndexSet *selected = [cont selectedRowIndexes];
         NSUInteger result = [selected indexGreaterThanIndex:where];
-        
+
         if(result != NSNotFound)
         {
             retval = (int)result;
         }
-    }     
+    }
     DW_MUTEX_UNLOCK;
 	return retval;
 }
@@ -3284,10 +3327,10 @@
     {
         DWContainer *cont = handle;
         NSIndexSet *selected = [[NSIndexSet alloc] initWithIndex:(NSUInteger)index];
-        
+
         [cont selectRowIndexes:selected byExtendingSelection:YES];
         [selected release];
-    }    
+    }
     DW_MUTEX_UNLOCK;
 }
 
@@ -3312,7 +3355,7 @@
     else if([object isMemberOfClass:[DWContainer class]])
     {
         DWContainer *cont = handle;
-        
+
         [cont removeRow:index];
         [cont reloadData];
     }
@@ -3341,8 +3384,8 @@
 HWND API dw_mle_new(ULONG cid)
 {
 	DWMLE *mle = [[DWMLE alloc] init];
-    NSScrollView *scrollview  = [[NSScrollView alloc] init];    
-    
+    NSScrollView *scrollview  = [[NSScrollView alloc] init];
+
     //[mle setScrollview:scrollview];
     [scrollview setBorderType:NSBezelBorder];
     [scrollview setHasVerticalScroller:YES];
@@ -3403,7 +3446,7 @@
 	DWMLE *mle = [sv documentView];
     NSTextStorage *ts = [mle textStorage];
     NSMutableString *ms = [ts mutableString];
-    
+
     *bytes = [ms length];
     *lines = 0; /* TODO: Line count */
 }
@@ -3467,7 +3510,7 @@
 	{
 		[mle setEditable:YES];
 	}
-	else 
+	else
 	{
 		[mle setEditable:NO];
 	}
@@ -3629,9 +3672,9 @@
     /* Set defaults for the dialog. */
     [colorDlg setColor:color];
     [colorDlg setDialog:dialog];
-    [colorDlg setContinuous:YES]; 
-    [colorDlg setTarget:colorDlg]; 
-    [colorDlg setAction:@selector(changeColor:)]; 
+    [colorDlg setContinuous:YES];
+    [colorDlg setTarget:colorDlg];
+    [colorDlg setAction:@selector(changeColor:)];
     [colorDlg makeKeyAndOrderFront:nil];
 	
     color = (NSColor *)dw_dialog_wait(dialog);
@@ -3888,14 +3931,14 @@
 {
     int _locked_by_me = FALSE;
     DW_MUTEX_LOCK;
-    NSScrollView *scrollview  = [[NSScrollView alloc] init];    
+    NSScrollView *scrollview  = [[NSScrollView alloc] init];
 	DWTree *tree = [[DWTree alloc] init];
-    
+
     [tree setScrollview:scrollview];
     [scrollview setBorderType:NSBezelBorder];
     [scrollview setHasVerticalScroller:YES];
     [scrollview setAutohidesScrollers:YES];
-    
+
     [tree setAllowsMultipleSelection:NO];
 	[tree setDataSource:tree];
     [scrollview setDocumentView:tree];
@@ -4239,7 +4282,7 @@
 	id object = nil;
 	int type = [cont cellType:column];
 	int lastadd = [cont lastAddPoint];
-    
+
     if(!data)
     {
         DW_MUTEX_UNLOCK;
@@ -4254,7 +4297,7 @@
         char *str = *((char **)data);
 		object = [ NSString stringWithUTF8String:str ];
 	}
-	else 
+	else
 	{
 		char textbuffer[100];
 		
@@ -4288,7 +4331,7 @@
 			
 			strftime(textbuffer, 100, "%X", &curtm);
 		}
-		else 
+		else
 		{
             DW_MUTEX_UNLOCK;
 			return;
@@ -4423,7 +4466,7 @@
     DW_MUTEX_LOCK;
     DWContainer *cont = handle;
     NSTableColumn *col = [cont getColumn:column];
-    
+
     [col setWidth:width];
     DW_MUTEX_UNLOCK;
 }
@@ -4491,7 +4534,7 @@
     DW_MUTEX_LOCK;
     DWContainer *cont = handle;
     int x;
-    
+
     for(x=0;x<rowcount;x++)
     {
         [cont removeRow:0];
@@ -4528,7 +4571,7 @@
     NSIndexSet *selected = [cont selectedRowIndexes];
     NSUInteger result = [selected indexGreaterThanOrEqualToIndex:0];
     char *retval = NULL;
-    
+
     if(result != NSNotFound)
     {
         retval = [cont getRowTitle:(int)result];
@@ -4555,7 +4598,7 @@
     NSIndexSet *selected = [cont selectedRowIndexes];
     NSUInteger result = [selected indexGreaterThanIndex:lastQueryPoint];
     char *retval = NULL;
-    
+
     if(result != NSNotFound)
     {
         retval = [cont getRowTitle:(int)result];
@@ -4578,15 +4621,15 @@
     DWContainer *cont = handle;
     char *thistext;
     int x, count = (int)[cont numberOfRowsInTableView:cont];
-    
+
     for(x=0;x<count;x++)
     {
         thistext = [cont getRowTitle:x];
-        
+
         if(thistext == text)
         {
             NSIndexSet *selected = [[NSIndexSet alloc] initWithIndex:(NSUInteger)x];
-            
+
             [cont selectRowIndexes:selected byExtendingSelection:YES];
             [selected release];
         }
@@ -4607,11 +4650,11 @@
     DWContainer *cont = handle;
     char *thistext;
     int x, count = (int)[cont numberOfRowsInTableView:cont];
-    
+
     for(x=0;x<count;x++)
     {
         thistext = [cont getRowTitle:x];
-        
+
         if(thistext == text)
         {
             [cont removeRow:x];
@@ -4671,7 +4714,7 @@
 {
     NSBundle *bundle = [NSBundle mainBundle];
     NSString *respath = [bundle resourcePath];
-    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 
+    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
 	NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
 	return image;
 }
@@ -4730,7 +4773,7 @@
     /* There isn't anything like quite like MDI on MacOS...
      * However we will make floating windows that hide
      * when the application is deactivated to simulate
-     * similar behavior. 
+     * similar behavior.
      */
     DWMDI *mdi = [[DWMDI alloc] init];
     /* [mdi setTag:cid]; Why doesn't this work? */
@@ -4748,14 +4791,14 @@
  */
 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long cid)
 {
-    HWND tmpbox = dw_box_new(DW_VERT, 0); 
+    HWND tmpbox = dw_box_new(DW_VERT, 0);
     int _locked_by_me = FALSE;
     DW_MUTEX_LOCK;
 	DWSplitBar *split = [[DWSplitBar alloc] init];
     [split setDelegate:split];
     dw_box_pack_start(tmpbox, topleft, 0, 0, TRUE, TRUE, 0);
 	[split addSubview:tmpbox];
-    tmpbox = dw_box_new(DW_VERT, 0);    
+    tmpbox = dw_box_new(DW_VERT, 0);
     dw_box_pack_start(tmpbox, bottomright, 0, 0, TRUE, TRUE, 0);
 	[split addSubview:tmpbox];
 	if(type == DW_VERT)
@@ -4799,7 +4842,7 @@
     else
     {
         /* If we have no size.. wait until the resize
-         * event when we get an actual size to try 
+         * event when we get an actual size to try
          * to set the splitbar again.
          */
         [split setPercent:percent];
@@ -4955,10 +4998,10 @@
 	
 	if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
 		return NULL;
-    
+
     NSBundle *bundle = [NSBundle mainBundle];
     NSString *respath = [bundle resourcePath];
-    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 
+    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
 	NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
 	NSSize size = [image size];
 	pixmap->width = size.width;
@@ -4999,17 +5042,17 @@
 {
     DWBitBlt *bltinfo = calloc(1, sizeof(DWBitBlt));
     NSValue* bi = [NSValue valueWithPointer:bltinfo];
-    
+
     /* Fill in the information */
     bltinfo->dest = dest;
     bltinfo->src = src;
     bltinfo->xdest = xdest;
     bltinfo->ydest = ydest;
     bltinfo->width = width;
-    bltinfo->height = height;   
+    bltinfo->height = height;
     bltinfo->xsrc = xsrc;
     bltinfo->ysrc = ysrc;
-    
+
     if(destp)
     {
         bltinfo->dest = (id)destp->handle;
@@ -5018,7 +5061,7 @@
     {
         id object = bltinfo->src = (id)srcp->handle;
         [object retain];
-    }   
+    }
     [DWObj performSelectorOnMainThread:@selector(doBitBlt:) withObject:bi waitUntilDone:YES];
 }
 
@@ -5171,7 +5214,7 @@
  */
 void API dw_pointer_query_pos(long *x, long *y)
 {
-    NSPoint mouseLoc; 
+    NSPoint mouseLoc;
     mouseLoc = [NSEvent mouseLocation];
 	if(x)
 	{
@@ -5247,15 +5290,15 @@
     NSView *view = [object isKindOfClass:[NSWindow class]] ? [object contentView] : parent;
     NSWindow *window = [view window];
     NSEvent *event = [DWApp currentEvent];
-    NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown 
+    NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown
                                        location:[window convertScreenToBase:NSMakePoint(x, y)]
-                                  modifierFlags:0 
+                                  modifierFlags:0
                                       timestamp:[event timestamp]
                                    windowNumber:[window windowNumber]
-                                        context:[NSGraphicsContext currentContext] 
-                                    eventNumber:1 
-                                     clickCount:1 
-                                       pressure:0.0];     
+                                        context:[NSGraphicsContext currentContext]
+                                    eventNumber:1
+                                     clickCount:1
+                                       pressure:0.0];
     [NSMenu popUpContextMenu:thismenu withEvent:fake forView:view];
 }
 
@@ -5301,7 +5344,7 @@
 	{
 		[menu addItem:[NSMenuItem separatorItem]];
 	}
-	else 
+	else
 	{
 		char accel[2];
 		char *newtitle = malloc(strlen(title)+1);
@@ -5400,7 +5443,7 @@
 DWNotebookPage *_notepage_from_id(DWNotebook *notebook, unsigned long pageid)
 {
 	NSArray *pages = [notebook tabViewItems];
-	for(DWNotebookPage *notepage in pages) 
+	for(DWNotebookPage *notepage in pages)
 	{
 		if([notepage pageid] == pageid)
 		{
@@ -5543,7 +5586,7 @@
 	{
         HWND tmpbox = dw_box_new(DW_VERT, 0);
         DWBox *box = tmpbox;
-        
+
         dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
 		[notepage setView:box];
 	}
@@ -5578,12 +5621,12 @@
 	[window setAllowsConcurrentViewDrawing:NO];
 #endif
     [view release];
-    
+
     /* If it isn't a toplevel window... */
     if(hwndOwner)
     {
         id object = hwndOwner;
-        
+
         /* Check to see if the parent is an MDI window */
         if([object isMemberOfClass:[DWMDI class]])
         {
@@ -5623,11 +5666,11 @@
 void API dw_window_set_pointer(HWND handle, int pointertype)
 {
     id object = handle;
-    
+
 	if([ object isKindOfClass:[ NSView class ] ])
 	{
 		NSView *view = handle;
-        
+
         if(pointertype == DW_POINTER_DEFAULT)
         {
             [view discardCursorRects];
@@ -5636,7 +5679,7 @@
         {
             NSRect rect = [view frame];
             NSCursor *cursor = [NSCursor arrowCursor];
-        
+
             [view addCursorRect:rect cursor:cursor];
         }
         /* No cursor for DW_POINTER_CLOCK? */
@@ -5673,7 +5716,7 @@
 int API dw_window_hide(HWND handle)
 {
     /* TODO: Figure out proper dw_window_hide behavior...
-     * individual windows don't appear to be hidable, 
+     * individual windows don't appear to be hidable,
      * but all application windows can be hidden/deactivated
      * via the NS/DWApplication class.
      */
@@ -5782,7 +5825,7 @@
 void API dw_window_capture(HWND handle)
 {
     id object = handle;
-    
+
     if(![object isMemberOfClass:[NSWindow class]])
     {
         object = [object window];
@@ -5825,7 +5868,7 @@
 void API dw_window_reparent(HWND handle, HWND newparent)
 {
     id object = handle;
-    
+
     if([object isMemberOfClass:[NSWindow class]])
     {
         /* We can't actually reparent on MacOS but if the
@@ -5833,12 +5876,12 @@
          * floating window... otherwise set it to normal.
          */
         NSWindow *window = handle;
-    
+
         /* If it isn't a toplevel window... */
         if(newparent)
         {
             object = newparent;
-        
+
             /* Check to see if the parent is an MDI window */
             if([object isMemberOfClass:[DWMDI class]])
             {
@@ -5866,7 +5909,7 @@
 	char *name = strchr(fontcopy, '.');
 	if(name)
 	{
-		int size = atoi(fontcopy); 
+		int size = atoi(fontcopy);
 		*name = 0;
 		name++;
 		NSFont *font = [NSFont fontWithName:[ NSString stringWithUTF8String:name ] size:(float)size];
@@ -5890,6 +5933,17 @@
 }
 
 /*
+ * Returns the current font for the specified window
+ * Parameters:
+ *           handle: The window handle from which to obtain the font.
+ */
+char * API dw_window_get_font(HWND handle)
+{
+   NSLog(@"dw_window_get_font() unimplemented\n");
+   return "8.Monaco";
+}
+
+/*
  * Destroys a window and all of it's children.
  * Parameters:
  *           handle: The window handle to destroy.
@@ -6036,7 +6090,7 @@
 	{
 		NSImageView *iv = handle;
         NSImage *bitmap = NULL;
-        
+
         if(filename)
         {
              bitmap = [[NSImage alloc] initWithContentsOfFile:[ NSString stringWithUTF8String:filename ]];
@@ -6142,7 +6196,7 @@
 	NSObject *object = handle;
 	NSSize size;
 	size.width = width;
-	size.height = height; 
+	size.height = height;
 	
 	if([ object isKindOfClass:[ NSWindow class ] ])
 	{
@@ -6166,7 +6220,7 @@
 	NSObject *object = handle;
 	NSPoint point;
 	point.x = x;
-	point.y = y; 
+	point.y = y;
 	
 	if([ object isKindOfClass:[ NSWindow class ] ])
 	{
@@ -6216,7 +6270,7 @@
 			*width = rect.size.width;
 		if(height)
 			*height = rect.size.height;
-		return; 
+		return;
 	}
 }
 
@@ -6225,7 +6279,7 @@
  */
 int API dw_screen_width(void)
 {
-	NSRect screenRect = [[NSScreen mainScreen] frame]; 
+	NSRect screenRect = [[NSScreen mainScreen] frame];
 	return screenRect.size.width;
 }
 
@@ -6234,7 +6288,7 @@
  */
 int API dw_screen_height(void)
 {
-	NSRect screenRect = [[NSScreen mainScreen] frame]; 
+	NSRect screenRect = [[NSScreen mainScreen] frame];
 	return screenRect.size.height;
 }
 
@@ -6571,7 +6625,7 @@
 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
 {
 	ULONG message = 0, msgid = 0;
-    
+
 	if(window && signame && sigfunc)
 	{
 		if((message = _findsigmessage(signame)) != 0)
@@ -6804,7 +6858,7 @@
 void dw_mutex_lock(HMTX mutex)
 {
     /* We need to handle locks from the main thread differently...
-     * since we can't stop message processing... otherwise we 
+     * since we can't stop message processing... otherwise we
      * will deadlock... so try to acquire the lock and continue
      * processing messages in between tries.
      */
@@ -7317,7 +7371,7 @@
     [pool drain];
     pool = [[NSAutoreleasePool alloc] init];
     pthread_setspecific(_dw_pool_key, pool);
-#endif    
+#endif
 }
 
 /*