fixing screen coordinate transformation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-01-17 18:58:05 +00:00
parent 0dc8fac22b
commit 94929e7b60

View File

@@ -22,7 +22,7 @@ NSRect wxToNSRect( NSView* parent, const wxRect& r )
NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
int y = r.y; int y = r.y;
int x = r.x ; int x = r.x ;
if ( parent != NULL && ![ parent isFlipped ] ) if ( parent == NULL || ![ parent isFlipped ] )
y = frame.size.height - ( r.y + r.height ); y = frame.size.height - ( r.y + r.height );
return NSMakeRect(x, y, r.width , r.height); return NSMakeRect(x, y, r.width , r.height);
} }
@@ -32,7 +32,7 @@ wxRect wxFromNSRect( NSView* parent, const NSRect& rect )
NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
int y = rect.origin.y; int y = rect.origin.y;
int x = rect.origin.x; int x = rect.origin.x;
if ( parent != NULL && ![ parent isFlipped ] ) if ( parent == NULL || ![ parent isFlipped ] )
y = frame.size.height - (rect.origin.y + rect.size.height); y = frame.size.height - (rect.origin.y + rect.size.height);
return wxRect( x, y, rect.size.width, rect.size.height ); return wxRect( x, y, rect.size.width, rect.size.height );
} }
@@ -42,7 +42,7 @@ NSPoint wxToNSPoint( NSView* parent, const wxPoint& p )
NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
int x = p.x ; int x = p.x ;
int y = p.y; int y = p.y;
if ( parent != NULL && ![ parent isFlipped ] ) if ( parent == NULL || ![ parent isFlipped ] )
y = frame.size.height - ( p.y ); y = frame.size.height - ( p.y );
return NSMakePoint(x, y); return NSMakePoint(x, y);
} }
@@ -52,7 +52,7 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
int x = p.x; int x = p.x;
int y = p.y; int y = p.y;
if ( parent != NULL && ![ parent isFlipped ] ) if ( parent == NULL || ![ parent isFlipped ] )
y = frame.size.height - ( p.y ); y = frame.size.height - ( p.y );
return wxPoint( x, y); return wxPoint( x, y);
} }