]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/nonownedwnd.mm
Update OpenVMS compile support
[wxWidgets.git] / src / osx / cocoa / nonownedwnd.mm
index eba768adb8347a26bd02d5282d09dbea70664f4e..6e270ee8266b5ec19e1c84ccd44d4e7e13042c60 100644 (file)
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
-
-#if wxOSX_USE_COCOA
-#include <Cocoa/Cocoa.h>
-#else
-#include <UIKit/UIKit.h>
+#ifndef WX_PRECOMP
+    #include "wx/nonownedwnd.h"
+    #include "wx/frame.h"
 #endif
 
-#ifdef __WXMAC__
 #include "wx/osx/private.h"
-#endif
 
 NSRect wxToNSRect( NSView* parent, const wxRect& r )
 {
@@ -141,10 +137,26 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
     return NO;
 }
 
-- (NSSize)windowWillResize:(NSWindow *)window
+- (NSSize)windowWillResize:(NSWindow *)win
                     toSize:(NSSize)proposedFrameSize
 {
-    // todo
+    NSRect frame = [win frame];
+    wxRect wxframe = wxFromNSRect( NULL, frame );
+    wxframe.SetWidth( proposedFrameSize.width );
+    wxframe.SetHeight( proposedFrameSize.height );
+    wxNSWindow* window = (wxNSWindow*) win;
+    wxNonOwnedWindowCocoaImpl* windowimpl = [window implementation];
+    if ( windowimpl )
+    {
+        wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
+        if ( wxpeer )
+        {
+            wxpeer->HandleResizing( 0, &wxframe );
+            NSSize newSize = NSMakeSize(wxframe.GetWidth(), wxframe.GetHeight());
+            return newSize;
+        }
+    }
+
     return proposedFrameSize;
 }
 
@@ -239,7 +251,7 @@ long style, long extraStyle, const wxString& name )
     else
         m_macWindow = [wxNSWindow alloc];
     
-    CGWindowLevel level = kCGNormalWindowLevelKey;
+    CGWindowLevel level = kCGNormalWindowLevel;
     
     if ( style & wxFRAME_TOOL_WINDOW )
     {