Merged 47182 from svn trunk:
Make wxCocoa compile in 64-bit mode. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -15,7 +15,12 @@
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGRect NSRect;
|
||||
#else
|
||||
typedef struct _NSRect NSRect;
|
||||
#endif
|
||||
|
||||
class wxWindow;
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSView);
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
WX_NSColor GetNSColor();
|
||||
int GetCocoaLineDash(const float **pattern);
|
||||
int GetCocoaLineDash(const CGFloat **pattern);
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_PEN_H__
|
||||
|
@@ -14,7 +14,11 @@
|
||||
|
||||
#include "wx/generic/region.h"
|
||||
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGRect NSRect;
|
||||
#else
|
||||
typedef struct _NSRect NSRect;
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxRegion : public wxRegionGeneric
|
||||
{
|
||||
|
@@ -17,7 +17,12 @@
|
||||
// ========================================================================
|
||||
// wxToolBar
|
||||
// ========================================================================
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGPoint NSPoint;
|
||||
#else
|
||||
typedef struct _NSPoint NSPoint;
|
||||
#endif
|
||||
|
||||
class wxToolBarTool;
|
||||
|
||||
class wxToolBar : public wxToolBarBase
|
||||
|
@@ -2419,6 +2419,36 @@ typedef void* WXDisplay;
|
||||
|
||||
#ifdef __WXCOCOA__
|
||||
|
||||
/* Definitions of 32-bit/64-bit types
|
||||
* These are typedef'd exactly the same way in newer OS X headers so
|
||||
* redefinition when real headers are included should not be a problem. If
|
||||
* it is, the types are being defined wrongly here.
|
||||
* The purpose of these types is so they can be used from public wx headers.
|
||||
* and also because the older (pre-Leopard) headers don't define them.
|
||||
*/
|
||||
|
||||
/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros
|
||||
* since they are unlikely to be needed in a public header.
|
||||
*/
|
||||
#if defined(__LP64__) && __LP64__
|
||||
typedef double CGFloat;
|
||||
#else
|
||||
typedef float CGFloat;
|
||||
#endif
|
||||
|
||||
#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64)
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
#else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
|
||||
/* Objective-C type declarations.
|
||||
* These are to be used in public headers in lieu of NSSomething* because
|
||||
* Objective-C class names are not available in C/C++ code.
|
||||
*/
|
||||
|
||||
/* NOTE: This ought to work with other compilers too, but I'm being cautious */
|
||||
#if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__)
|
||||
/* It's desirable to have type safety for Objective-C(++) code as it does
|
||||
|
@@ -43,7 +43,7 @@ wxCocoaDCStack wxDC::sm_cocoaDCStack;
|
||||
inline void CocoaSetPenForNSBezierPath(wxPen &pen, NSBezierPath *bezpath)
|
||||
{
|
||||
[pen.GetNSColor() set];
|
||||
const float *pattern;
|
||||
const CGFloat *pattern;
|
||||
[bezpath setLineDash:pattern count:pen.GetCocoaLineDash(&pattern) phase:0.0];
|
||||
[bezpath setLineWidth:pen.GetWidth()];
|
||||
switch(pen.GetJoin())
|
||||
|
@@ -232,10 +232,10 @@ void wxMDIParentFrame::WindowDidBecomeMain(NSNotification *notification)
|
||||
}
|
||||
if(!hashmap.empty())
|
||||
{
|
||||
int windowCount = 0;
|
||||
NSInteger windowCount = 0;
|
||||
NSCountWindows(&windowCount);
|
||||
wxASSERT(windowCount>0);
|
||||
int *windowList = new int[windowCount];
|
||||
NSInteger *windowList = new NSInteger[windowCount];
|
||||
NSWindowList(windowCount, windowList);
|
||||
wxIntMDIChildFrameHashMap::iterator iter = hashmap.end();
|
||||
for(int i=0; i<windowCount && iter == hashmap.end(); i++)
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
m_style = wxSTIPPLE;
|
||||
}
|
||||
WX_NSColor GetNSColor();
|
||||
int GetCocoaLineDash(const float **pattern);
|
||||
int GetCocoaLineDash(const CGFloat **pattern);
|
||||
protected:
|
||||
void FreeCocoaNSColor();
|
||||
void FreeCocoaDash();
|
||||
@@ -68,36 +68,36 @@ protected:
|
||||
wxDash *m_dash;
|
||||
wxBitmap m_stipple;
|
||||
WX_NSColor m_cocoaNSColor;
|
||||
float *m_cocoaDash;
|
||||
CGFloat *m_cocoaDash;
|
||||
|
||||
// Predefined dash patterns
|
||||
static const int scm_countDot;
|
||||
static const float scm_patternDot[];
|
||||
static const CGFloat scm_patternDot[];
|
||||
static const int scm_countLongDash;
|
||||
static const float scm_patternLongDash[];
|
||||
static const CGFloat scm_patternLongDash[];
|
||||
static const int scm_countShortDash;
|
||||
static const float scm_patternShortDash[];
|
||||
static const CGFloat scm_patternShortDash[];
|
||||
static const int scm_countDotDash;
|
||||
static const float scm_patternDotDash[];
|
||||
static const CGFloat scm_patternDotDash[];
|
||||
private:
|
||||
// Don't allow assignment
|
||||
wxPenRefData& operator=(const wxPenRefData& data);
|
||||
};
|
||||
|
||||
const int wxPenRefData::scm_countDot = 1;
|
||||
const float wxPenRefData::scm_patternDot[] = {
|
||||
const CGFloat wxPenRefData::scm_patternDot[] = {
|
||||
1.0
|
||||
};
|
||||
const int wxPenRefData::scm_countLongDash = 1;
|
||||
const float wxPenRefData::scm_patternLongDash[] = {
|
||||
const CGFloat wxPenRefData::scm_patternLongDash[] = {
|
||||
10.0
|
||||
};
|
||||
const int wxPenRefData::scm_countShortDash = 1;
|
||||
const float wxPenRefData::scm_patternShortDash[] = {
|
||||
const CGFloat wxPenRefData::scm_patternShortDash[] = {
|
||||
5.0
|
||||
};
|
||||
const int wxPenRefData::scm_countDotDash = 4;
|
||||
const float wxPenRefData::scm_patternDotDash[] = {
|
||||
const CGFloat wxPenRefData::scm_patternDotDash[] = {
|
||||
1.0
|
||||
, 1.0
|
||||
, 5.0
|
||||
@@ -185,7 +185,7 @@ inline WX_NSColor wxPenRefData::GetNSColor()
|
||||
return m_cocoaNSColor;
|
||||
}
|
||||
|
||||
int wxPenRefData::GetCocoaLineDash(const float **pattern)
|
||||
int wxPenRefData::GetCocoaLineDash(const CGFloat **pattern)
|
||||
{
|
||||
int count;
|
||||
switch( m_style )
|
||||
@@ -216,7 +216,7 @@ int wxPenRefData::GetCocoaLineDash(const float **pattern)
|
||||
{
|
||||
if(!m_cocoaDash)
|
||||
{
|
||||
m_cocoaDash = new float[count];
|
||||
m_cocoaDash = new CGFloat[count];
|
||||
for(int i=0; i<count; i++)
|
||||
m_cocoaDash[i] = m_dash[i];
|
||||
}
|
||||
@@ -362,7 +362,7 @@ WX_NSColor wxPen::GetNSColor()
|
||||
return (M_PENDATA ? M_PENDATA->GetNSColor() : nil);
|
||||
}
|
||||
|
||||
int wxPen::GetCocoaLineDash(const float **pattern)
|
||||
int wxPen::GetCocoaLineDash(const CGFloat **pattern)
|
||||
{
|
||||
if(M_PENDATA)
|
||||
return M_PENDATA->GetCocoaLineDash(pattern);
|
||||
|
@@ -39,6 +39,18 @@
|
||||
#import <AppKit/NSBezierPath.h>
|
||||
#endif //def WXCOCOA_FILL_DUMMY_VIEW
|
||||
|
||||
/* NSComparisonResult is typedef'd as an enum pre-Leopard but typedef'd as
|
||||
* NSInteger post-Leopard. Pre-Leopard the Cocoa toolkit expects a function
|
||||
* returning int and not NSComparisonResult. Post-Leopard the Cocoa toolkit
|
||||
* expects a function returning the new non-enum NSComparsionResult.
|
||||
* Hence we create a typedef named CocoaWindowCompareFunctionResult.
|
||||
*/
|
||||
#if defined(NSINTEGER_DEFINED)
|
||||
typedef NSComparisonResult CocoaWindowCompareFunctionResult;
|
||||
#else
|
||||
typedef int CocoaWindowCompareFunctionResult;
|
||||
#endif
|
||||
|
||||
// A category for methods that are only present in Panther's SDK
|
||||
@interface NSView(wxNSViewPrePantherCompatibility)
|
||||
- (void)getRectsBeingDrawn:(const NSRect **)rects count:(int *)count;
|
||||
@@ -446,7 +458,7 @@ bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect)
|
||||
|
||||
// Set m_updateRegion
|
||||
const NSRect *rects = ▭ // The bounding box of the region
|
||||
int countRects = 1;
|
||||
NSInteger countRects = 1;
|
||||
// Try replacing the larger rectangle with a list of smaller ones:
|
||||
if ([GetNSView() respondsToSelector:@selector(getRectsBeingDrawn:count:)])
|
||||
[GetNSView() getRectsBeingDrawn:&rects count:&countRects];
|
||||
@@ -951,7 +963,7 @@ bool wxWindow::SetFont(const wxFont& font)
|
||||
return true;
|
||||
}
|
||||
|
||||
static int CocoaRaiseWindowCompareFunction(id first, id second, void *target)
|
||||
static CocoaWindowCompareFunctionResult CocoaRaiseWindowCompareFunction(id first, id second, void *target)
|
||||
{
|
||||
// first should be ordered higher
|
||||
if(first==target)
|
||||
@@ -972,7 +984,7 @@ void wxWindow::Raise()
|
||||
context: nsview];
|
||||
}
|
||||
|
||||
static int CocoaLowerWindowCompareFunction(id first, id second, void *target)
|
||||
static CocoaWindowCompareFunctionResult CocoaLowerWindowCompareFunction(id first, id second, void *target)
|
||||
{
|
||||
// first should be ordered lower
|
||||
if(first==target)
|
||||
|
Reference in New Issue
Block a user