/////////////////////////////////////////////////////////////////////////////
-// 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
/////////////////////////////////////////////////////////////////////////////
@end
-@interface wxUIContentView : wxUIView
+@interface wxUIContentView : UIView
{
wxUIContentViewController* _controller;
}
void wxNonOwnedWindowIPhoneImpl::Maximize(bool maximize)
{
+ if ( maximize )
+ {
+ CGRect r = [[UIScreen mainScreen] bounds];
+ [m_macWindow setFrame:r];
+ }
}
bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl( now, contentview, true );
impl->InstallEventHandler();
- [toplevelwindow addSubview:contentview];
+
+ if ([toplevelwindow respondsToSelector:@selector(setRootViewController:)])
+ {
+ toplevelwindow.rootViewController = controller;
+ }
+ else
+ {
+ [toplevelwindow addSubview:contentview];
+ }
return impl;
}
return _controller;
}
++ (void)initialize
+{
+ static BOOL initialized = NO;
+ if (!initialized)
+ {
+ initialized = YES;
+ wxOSXIPhoneClassAddWXMethods( self );
+ }
+}
+
@end
@implementation wxUIContentViewController
return YES;
}
+// iOS 6 support, right now unconditionally supporting all orientations, TODO use a orientation mask
+
+-(BOOL)shouldAutorotate
+{
+ return YES;
+}
+
+ - (NSUInteger)supportedInterfaceOrientations
+{
+ return UIInterfaceOrientationMaskAll;
+}
+
+
+
+
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( [self view] );
-(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);
+ }
}
}
footerView = frame->GetToolBar()->GetHandle();
}
}
+ return footerView;
}
@end