/////////////////////////////////////////////////////////////////////////////
-// 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
/////////////////////////////////////////////////////////////////////////////
#include <AudioToolbox/AudioServices.h>
-#if wxUSE_BASE
+#if 1 // wxUSE_BASE
// Emit a beeeeeep
void wxBell()
wxTheApp->OnInit();
}
+- (void)applicationWillTerminate:(UIApplication *)application {
+ wxCloseEvent event;
+ wxTheApp->OnEndSession(event);
+}
- (void)dealloc {
[super dealloc];
return true;
}
-int wxApp::OnRun()
-{
- wxMacAutoreleasePool pool;
- const char* appname = "app";
- UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" );
- return 1;
-}
-
bool wxApp::DoInitGui()
{
return true;
{
}
-void wxMacWakeUp()
-{
- // TODO
-}
-
#endif // wxUSE_BASE
#if wxUSE_GUI
+// ----------------------------------------------------------------------------
+// Launch default browser
+// ----------------------------------------------------------------------------
+
+bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
+{
+ return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:wxCFStringRef(url).AsNSString()]]
+ == YES;
+}
+
// TODO : reorganize
extern wxFont* CreateNormalFont()
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
+#if 0
CGRect r = [[UIScreen mainScreen] applicationFrame];
CGRect bounds = [[UIScreen mainScreen] bounds];
if ( bounds.size.height > r.size.height )
if ( height )
*height = r.size.width;
}
+#else
+ // it's easier to treat the status bar as an element of the toplevel window
+ // instead of the desktop in order to support easy rotation
+ if ( x )
+ *x = 0;
+ if ( y )
+ *y = 0;
+ wxDisplaySize(width, height);
+#endif
}
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()
{
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 )
}
-#endif // wxOSX_USE_IPHONE
\ No newline at end of file
+#endif // wxOSX_USE_IPHONE