From c7109e1ac35a9fb31656eb3dfc50e862228b8380 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 24 Jan 2010 19:09:20 +0000 Subject: [PATCH] supporting auto-rotate for translucent statusbar git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63253 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/iphone/nonownedwnd.mm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/osx/iphone/nonownedwnd.mm b/src/osx/iphone/nonownedwnd.mm index d50c0cfc31..ebf89f10b5 100644 --- a/src/osx/iphone/nonownedwnd.mm +++ b/src/osx/iphone/nonownedwnd.mm @@ -306,7 +306,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) CGRect frame = [toplevelwindow bounds]; CGRect appframe = [[UIScreen mainScreen] applicationFrame]; - if ( now->GetWindowStyle() == wxDEFAULT_FRAME_STYLE ) + if ( now->GetWindowStyle() == wxDEFAULT_FRAME_STYLE && [[UIApplication sharedApplication] statusBarStyle] != UIStatusBarStyleBlackTranslucent) { double offset = appframe.origin.y; frame.origin.y += offset; @@ -357,9 +357,31 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - CGRect fr = [self.view frame]; + CGRect frame = [self.view frame]; wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( [self view] ); wxNonOwnedWindow* now = dynamic_cast (impl->GetWXPeer()); + + if ( now->GetWindowStyle() == wxDEFAULT_FRAME_STYLE && [[UIApplication sharedApplication] statusBarStyle] == UIStatusBarStyleBlackTranslucent) + { + CGRect appframe = [[UIScreen mainScreen] applicationFrame]; + if ( CGRectEqualToRect(appframe, frame) ) + { + if ( appframe.origin.y != 0 ) + { + double offset = appframe.origin.y; + frame.origin.y -= offset; + frame.size.height += offset; + } + else + { + double offset = appframe.origin.x; + frame.origin.x -= offset; + frame.size.width += offset; + } + + [self.view setFrame:frame]; + } + } now->HandleResized(0); } -- 2.50.0