changeset 684:014b02436c1f

Added MDI simulation code... the MDI "window" will just be a box for coloring and placeholder purposes. The windows attached to it won't be constrained to the MDI area but will be floating and hide on deactivate.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 03 Mar 2011 13:17:50 +0000
parents 7385011c3327
children 314a12dccd20
files mac/dw.m
diffstat 1 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Wed Mar 02 18:03:34 2011 +0000
+++ b/mac/dw.m	Thu Mar 03 13:17:50 2011 +0000
@@ -1043,6 +1043,16 @@
 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
 @end
 
+/* 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.
+ */
+@interface DWMDI : DWBox {}
+@end
+
+@implementation DWMDI
+@end
+
 /* Subclass for a test object type */
 @interface DWObject : NSObject {}
 -(void)uselessThread:(id)sender;
@@ -4157,8 +4167,13 @@
  */
 HWND API dw_mdi_new(unsigned long id)
 {
-	NSLog(@"dw_mdi_new() unimplemented\n");
-	return HWND_DESKTOP;
+    /* 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. 
+     */
+    DWMDI *mdi = [[DWMDI alloc] init];
+    return mdi;
 }
 
 /*
@@ -4964,6 +4979,20 @@
     [window setDelegate:view];
     [window makeKeyAndOrderFront:nil];
 	[window setAllowsConcurrentViewDrawing:NO];
+    
+    /* 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]])
+        {
+            /* Set the window level to be floating */
+            [window setLevel:NSFloatingWindowLevel];
+            [window setHidesOnDeactivate:YES];
+        }
+    }
 	
 	return (HWND)window;
 }