Implement transformation between the wxDisplay coordinate system and the Cocoa screen coordinate system.

Use this to fix TLW initial positioning/sizing (including wxTopLevelWindow, wxFrame, and wxDialog)
Use this to implement wxWindow::DoScreenToClient and DoClientToScreen
Copyright 2007 Software 2000 Ltd.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-08-10 04:40:33 +00:00
parent e82b00a76d
commit 15f3714795
5 changed files with 239 additions and 39 deletions

View File

@@ -18,6 +18,22 @@
#import <Foundation/NSGeometry.h>
#endif //def __OBJC__
// We can only import Foundation/NSGeometry.h from Objective-C code but it's
// nice to be able to use NSPoint and NSRect in the declarations of helper
// methods so we must define them as opaque structs identically to the way
// they are defined by the real header.
// NOTE: We specifically use these regardless of C++ or Objective-C++ mode so
// the compiler will complain if we got the definitions wrong. In regular
// C++ mode there is no way to know if we got the definitons right so
// we depend on at least one Objective-C++ file including this header.
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef struct CGPoint NSPoint;
typedef struct CGRect NSRect;
#else
typedef struct _NSPoint NSPoint;
typedef struct _NSRect NSRect;
#endif
DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform);
class wxWindowCocoaHider;
@@ -129,6 +145,8 @@ protected:
NSPoint CocoaTransformWxToBounds(NSPoint pointWx);
NSRect CocoaTransformWxToBounds(NSRect rectWx);
#endif //def __OBJC__
static wxPoint OriginInWxDisplayCoordinatesForRectInCocoaScreenCoordinates(NSRect windowFrame);
static NSPoint OriginInCocoaScreenCoordinatesForRectInWxDisplayCoordinates(wxCoord x, wxCoord y, wxCoord width, wxCoord height, bool keepOriginVisible);
// ------------------------------------------------------------------------
// Implementation
// ------------------------------------------------------------------------