int wxApp::OnRun()
{
wxMacAutoreleasePool pool;
- char* appname = "test";
- UIApplicationMain( 1, &appname, nil, @"wxAppDelegate" );
+ const char* appname = "app";
+ UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" );
return 1;
}
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
CGRect r = [[UIScreen mainScreen] applicationFrame];
- if ( x )
- *x = r.origin.x;
- if ( y )
- *y = r.origin.y;
- if ( width )
- *width = r.size.width;
- if ( height )
- *height = r.size.height;
-
+ CGRect bounds = [[UIScreen mainScreen] bounds];
+ if ( bounds.size.height > r.size.height )
+ {
+ // portrait
+ if ( x )
+ *x = r.origin.x;
+ if ( y )
+ *y = r.origin.y;
+ if ( width )
+ *width = r.size.width;
+ if ( height )
+ *height = r.size.height;
+ }
+ else
+ {
+ // landscape
+ if ( x )
+ *x = r.origin.y;
+ if ( y )
+ *y = r.origin.x;
+ if ( width )
+ *width = r.size.height;
+ if ( height )
+ *height = r.size.width;
+ }
}
void wxGetMousePosition( int* x, int* y )
// Get size of display
void wxDisplaySize(int *width, int *height)
{
+ CGRect r = [[UIScreen mainScreen] applicationFrame];
CGRect bounds = [[UIScreen mainScreen] bounds];
-
- if ( width )
- *width = (int)bounds.size.width ;
- if ( height )
- *height = (int)bounds.size.height;
+
+ if ( bounds.size.height > r.size.height )
+ {
+ // portrait
+ if ( width )
+ *width = (int)bounds.size.width ;
+ if ( height )
+ *height = (int)bounds.size.height;
+ }
+ else
+ {
+ // landscape
+ if ( width )
+ *width = (int)bounds.size.height ;
+ if ( height )
+ *height = (int)bounds.size.width;
+ }
}
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
// call this method when a Blit is performed with it as a source.
if (!m_window)
return wxNullBitmap;
-
+
wxSize sz = m_window->GetSize();
-
+
int left = subrect != NULL ? subrect->x : 0 ;
int top = subrect != NULL ? subrect->y : 0 ;
int width = subrect != NULL ? subrect->width : sz.x;
int height = subrect != NULL ? subrect->height : sz.y ;
-
+
wxBitmap bmp = wxBitmap(width, height, 32);
-
+
CGContextRef context = (CGContextRef)bmp.GetHBITMAP();
-
+
CGContextSaveGState(context);
-
-
+
+
CGContextTranslateCTM( context, 0, height );
CGContextScaleCTM( context, 1, -1 );