]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/iphone/nonownedwnd.mm
Add missing WXK constants for the control keys
[wxWidgets.git] / src / osx / iphone / nonownedwnd.mm
index 87018de7b85e67da31d680b760cb438f5f9941be..d57dc018bd19651bda34631a5eeafa60c2d4fa89 100644 (file)
@@ -1,10 +1,10 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/cocoa/nonownedwnd.mm
+// Name:        src/osx/iphone/nonownedwnd.mm
 // Purpose:     non owned window for iphone
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     2008-06-20
-// RCS-ID:      $Id: nonownedwnd.mm 48805 2007-09-19 14:52:25Z SC $
+// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p )
 
 @end
 
-@interface wxUIContentView : wxUIView
+@interface wxUIContentView : UIView
 {
     wxUIContentViewController* _controller;
 }
@@ -273,6 +273,11 @@ void wxNonOwnedWindowIPhoneImpl::Iconize( bool iconize )
 
 void wxNonOwnedWindowIPhoneImpl::Maximize(bool maximize)
 {
+    if ( maximize )
+    {
+        CGRect r = [[UIScreen mainScreen] bounds];
+        [m_macWindow setFrame:r];
+    }
 }
 
 bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const
@@ -335,7 +340,11 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
     wxUIContentView* contentview = [[wxUIContentView alloc] initWithFrame:( fullscreen ? frame : appframe ) ];
     contentview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     wxUIContentViewController* controller = [[wxUIContentViewController alloc] initWithNibName:nil bundle:nil];
+
+#ifdef __IPHONE_3_0
     controller.wantsFullScreenLayout = fullscreen;
+#endif
+
     controller.view = contentview;
     [contentview release];
     [contentview setController:controller];
@@ -363,6 +372,16 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
     return _controller;
 }
 
++ (void)initialize
+{
+    static BOOL initialized = NO;
+    if (!initialized)
+    {
+        initialized = YES;
+        wxOSXIPhoneClassAddWXMethods( self );
+    }
+}
 @end
 
 @implementation wxUIContentViewController
@@ -403,15 +422,18 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
 -(void) viewWillDisappear:(BOOL)animated
 {
     wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( [self view] );
-    wxNonOwnedWindow* now = dynamic_cast<wxNonOwnedWindow*> (impl->GetWXPeer());
-    wxNonOwnedWindowIPhoneImpl* nowimpl = dynamic_cast<wxNonOwnedWindowIPhoneImpl*> (now->GetNonOwnedPeer());
-    
-    if ( nowimpl->InitialShowEventSent() )
+    if( impl )
     {
-        wxShowEvent eventShow(now->GetId(), false);
-        eventShow.SetEventObject(now);
-    
-        now->HandleWindowEvent(eventShow);
+        wxNonOwnedWindow* now = dynamic_cast<wxNonOwnedWindow*> (impl->GetWXPeer());
+        wxNonOwnedWindowIPhoneImpl* nowimpl = dynamic_cast<wxNonOwnedWindowIPhoneImpl*> (now->GetNonOwnedPeer());
+        
+        if ( nowimpl->InitialShowEventSent() )
+        {
+            wxShowEvent eventShow(now->GetId(), false);
+            eventShow.SetEventObject(now);
+        
+            now->HandleWindowEvent(eventShow);
+        }
     }
 }
 
@@ -432,6 +454,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
             footerView = frame->GetToolBar()->GetHandle();
         }
     }
+    return footerView;
 }
 
 @end