OSX iOS update app window layout methods (#25849) * remove interface oriented corrections, current iOSes don’t need this anymore, they always deliver interface oriented rectangles * iOS support clientAreaOrigin
... | ... | @@ -140,8 +140,6 @@ long style, long extraStyle, const wxString& name ) |
140 | 140 | if ( ( style & wxSTAY_ON_TOP ) )
|
141 | 141 | level = UIWindowLevelAlert;
|
142 | 142 | CGRect r = CGRectMake( 0, 0, size.x, size.y) ;
|
143 | - if ( UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) )
|
|
144 | - std::swap(r.size.width,r.size.height);
|
|
145 | 143 | |
146 | 144 | [m_macWindow initWithFrame:r ];
|
147 | 145 | [m_macWindow setHidden:YES];
|
... | ... | @@ -228,8 +226,6 @@ bool wxNonOwnedWindowIPhoneImpl::CanSetTransparent() |
228 | 226 | void wxNonOwnedWindowIPhoneImpl::MoveWindow(int x, int y, int width, int height)
|
229 | 227 | {
|
230 | 228 | CGRect r = CGRectMake( x,y,width,height) ;
|
231 | - if ( UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) )
|
|
232 | - std::swap(r.size.width,r.size.height);
|
|
233 | 229 | |
234 | 230 | [m_macWindow setFrame:r];
|
235 | 231 | }
|
... | ... | @@ -244,8 +240,7 @@ void wxNonOwnedWindowIPhoneImpl::GetPosition( int &x, int &y ) const |
244 | 240 | void wxNonOwnedWindowIPhoneImpl::GetSize( int &width, int &height ) const
|
245 | 241 | {
|
246 | 242 | CGRect r = [m_macWindow frame];
|
247 | - if ( UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) )
|
|
248 | - std::swap(r.size.width,r.size.height);
|
|
243 | + |
|
249 | 244 | width = r.size.width;
|
250 | 245 | height = r.size.height;
|
251 | 246 | }
|
... | ... | @@ -253,8 +248,13 @@ void wxNonOwnedWindowIPhoneImpl::GetSize( int &width, int &height ) const |
253 | 248 | void wxNonOwnedWindowIPhoneImpl::GetContentArea( int& left, int &top, int &width, int &height ) const
|
254 | 249 | {
|
255 | 250 | CGRect r = [m_macWindow bounds];
|
256 | - if ( UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) )
|
|
257 | - std::swap(r.size.width,r.size.height);
|
|
251 | + UIEdgeInsets safe = [m_macWindow safeAreaInsets];
|
|
252 | + |
|
253 | + r.origin.x += safe.left;
|
|
254 | + r.origin.y += safe.top;
|
|
255 | + r.size.width -= (safe.left + safe.right);
|
|
256 | + r.size.height -= (safe.top + safe.bottom);
|
|
257 | + |
|
258 | 258 | width = r.size.width;
|
259 | 259 | height = r.size.height;
|
260 | 260 | left = r.origin.x;
|
... | ... | @@ -360,9 +360,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) |
360 | 360 | contentview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
361 | 361 | wxUIContentViewController* controller = [[wxUIContentViewController alloc] initWithNibName:nil bundle:nil];
|
362 | 362 | |
363 | -#ifdef __IPHONE_3_0
|
|
364 | 363 | controller.wantsFullScreenLayout = fullscreen;
|
365 | -#endif
|
|
366 | 364 | |
367 | 365 | controller.view = contentview;
|
368 | 366 | [contentview release];
|
... | ... | @@ -233,7 +233,6 @@ bool wxToolBar::Create( |
233 | 233 | |
234 | 234 | switch ( [[UIApplication sharedApplication] statusBarStyle] )
|
235 | 235 | {
|
236 | -#ifdef __IPHONE_3_0
|
|
237 | 236 | case UIStatusBarStyleBlackOpaque:
|
238 | 237 | toolbar.barStyle = UIBarStyleBlack;
|
239 | 238 | break;
|
... | ... | @@ -241,7 +240,6 @@ bool wxToolBar::Create( |
241 | 240 | toolbar.barStyle = UIBarStyleBlack;
|
242 | 241 | toolbar.translucent = YES;
|
243 | 242 | break;
|
244 | -#endif
|
|
245 | 243 | default:
|
246 | 244 | toolbar.barStyle = UIBarStyleDefault;
|
247 | 245 | break;
|
... | ... | @@ -144,18 +144,9 @@ public: |
144 | 144 | CGRect bounds = [[UIScreen mainScreen] bounds];
|
145 | 145 | |
146 | 146 | int width, height;
|
147 | - if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) )
|
|
148 | - {
|
|
149 | - // portrait
|
|
150 | - width = (int)bounds.size.width ;
|
|
151 | - height = (int)bounds.size.height;
|
|
152 | - }
|
|
153 | - else
|
|
154 | - {
|
|
155 | - // landscape
|
|
156 | - width = (int)bounds.size.height ;
|
|
157 | - height = (int)bounds.size.width;
|
|
158 | - }
|
|
147 | + |
|
148 | + width = (int)bounds.size.width ;
|
|
149 | + height = (int)bounds.size.height;
|
|
159 | 150 | |
160 | 151 | return wxRect(0, 0, width, height);
|
161 | 152 | }
|
... | ... | @@ -465,14 +465,7 @@ void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const |
465 | 465 | return;
|
466 | 466 | |
467 | 467 | int left, top, w, h;
|
468 | - // under iphone with a translucent status bar the m_nowpeer returns the
|
|
469 | - // inner area, while the content area extends under the translucent
|
|
470 | - // status bar, therefore we use the content view's area
|
|
471 | -#ifdef __WXOSX_IPHONE__
|
|
472 | - GetPeer()->GetContentArea(left, top, w, h);
|
|
473 | -#else
|
|
474 | 468 | m_nowpeer->GetContentArea(left, top, w, h);
|
475 | -#endif
|
|
476 | 469 | |
477 | 470 | if (width)
|
478 | 471 | *width = w ;
|
... | ... | @@ -151,7 +151,15 @@ void wxTopLevelWindowMac::Restore() |
151 | 151 | |
152 | 152 | wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
|
153 | 153 | {
|
154 | + // under Cocoa we keep for backwards compatibility the client origin at 0,0
|
|
155 | + // (representing the contentview), while under iOS the entire app has a contentview
|
|
156 | + // which extends under the statusbar, so we need to determine the correct client
|
|
157 | + // area
|
|
158 | +#if wxOSX_USE_IPHONE
|
|
159 | + return wxNonOwnedWindow::GetClientAreaOrigin();
|
|
160 | +#else
|
|
154 | 161 | return wxPoint(0, 0) ;
|
162 | +#endif
|
|
155 | 163 | }
|
156 | 164 | |
157 | 165 | void wxTopLevelWindowMac::SetTitle(const wxString& title)
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help