X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65536c9221c62262cca9b76431bc1fdaf4886a3b..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/iphone/utils.mm diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index f6b5b25d32..cd21d51fb9 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/cocoa/utils.mm +// Name: src/osx/iphone/utils.mm // Purpose: various cocoa utility functions // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: utils.mm 48805 2007-09-19 14:52:25Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -37,14 +37,7 @@ #include -#if wxUSE_BASE - -// Emit a beeeeeep -void wxBell() -{ - // would be kSystemSoundID_UserPreferredAlert but since the headers aren't correct, add it manually - AudioServicesPlayAlertSound(0x00001000 ); -} +#if 1 // wxUSE_BASE // ---------------------------------------------------------------------------- // Common Event Support @@ -61,6 +54,10 @@ void wxBell() wxTheApp->OnInit(); } +- (void)applicationWillTerminate:(UIApplication *)application { + wxCloseEvent event; + wxTheApp->OnEndSession(event); +} - (void)dealloc { [super dealloc]; @@ -74,14 +71,6 @@ bool wxApp::CallOnInit() return true; } -int wxApp::OnRun() -{ - wxMacAutoreleasePool pool; - const char* appname = "app"; - UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" ); - return 1; -} - bool wxApp::DoInitGui() { return true; @@ -91,14 +80,26 @@ void wxApp::DoCleanUp() { } -void wxMacWakeUp() +#endif // wxUSE_BASE + +#if wxUSE_GUI + +// Emit a beeeeeep +void wxBell() { - // TODO + // would be kSystemSoundID_UserPreferredAlert but since the headers aren't correct, add it manually + AudioServicesPlayAlertSound(0x00001000 ); } -#endif // wxUSE_BASE +// ---------------------------------------------------------------------------- +// Launch default browser +// ---------------------------------------------------------------------------- -#if wxUSE_GUI +bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +{ + return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:wxCFStringRef(url).AsNSString()]] + == YES; +} // TODO : reorganize @@ -117,6 +118,11 @@ extern UIFont* CreateUIFont( const wxFont& font ) return [UIFont fontWithName:wxCFStringRef(font.GetFaceName() ).AsNSString() size:font.GetPointSize()]; } +CFArrayRef CopyAvailableFontFamilyNames() +{ + return (CFArrayRef) [[UIFont familyNames] retain]; +} + extern void DrawTextInContext( CGContextRef context, CGPoint where, UIFont *font, NSString* text ) { bool contextChanged = ( UIGraphicsGetCurrentContext() != context ); @@ -176,9 +182,18 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) void wxGetMousePosition( int* x, int* y ) { -// wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]); + if ( x ) + *x = 0; + if ( y ) + *y = 0; }; +wxMouseState wxGetMouseState() +{ + wxMouseState ms; + return ms; +} + // Returns depth of screen int wxDisplayDepth() { @@ -191,7 +206,7 @@ void wxDisplaySize(int *width, int *height) CGRect r = [[UIScreen mainScreen] applicationFrame]; CGRect bounds = [[UIScreen mainScreen] bounds]; - if ( bounds.size.height > r.size.height ) + if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ) { // portrait if ( width ) @@ -326,4 +341,4 @@ wxString wxGetOsDescription() } -#endif // wxOSX_USE_IPHONE \ No newline at end of file +#endif // wxOSX_USE_IPHONE