projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
non-pch build fix
[wxWidgets.git]
/
src
/
mac
/
carbon
/
cursor.cpp
diff --git
a/src/mac/carbon/cursor.cpp
b/src/mac/carbon/cursor.cpp
index eec2374c9af294cb20ceab9fa657f393e5541cd3..34d1284ea5a63335443303369061f31d0d2ebd5a 100644
(file)
--- a/
src/mac/carbon/cursor.cpp
+++ b/
src/mac/carbon/cursor.cpp
@@
-6,15
+6,19
@@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence:
wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
-#include "wx/app.h"
#include "wx/cursor.h"
#include "wx/cursor.h"
-#include "wx/icon.h"
-#include "wx/image.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/icon.h"
+ #include "wx/image.h"
+#endif // WX_PRECOMP
+
#include "wx/xpmdecod.h"
#include "wx/mac/private.h"
#include "wx/xpmdecod.h"
#include "wx/mac/private.h"
@@
-32,7
+36,7
@@
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
public:
wxCursorRefData();
public:
wxCursorRefData();
- ~wxCursorRefData();
+
virtual
~wxCursorRefData();
protected:
WXHCURSOR m_hCursor;
protected:
WXHCURSOR m_hCursor;
@@
-42,8
+46,7
@@
protected:
long m_themeCursor;
};
long m_themeCursor;
};
-#define M_CURSORDATA ((wxCursorRefData *)m_refData)
-#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
+#define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData)
const short kwxCursorBullseye = 0;
const short kwxCursorBlank = 1;
const short kwxCursorBullseye = 0;
const short kwxCursorBlank = 1;
@@
-195,6
+198,13
@@
CursHandle wxGetStockCursor( int number )
CursHandle c = (CursHandle) NewHandle( sizeof(Cursor) ) ;
memcpy( *c, &gMacCursors[number], sizeof(Cursor) ) ;
CursHandle c = (CursHandle) NewHandle( sizeof(Cursor) ) ;
memcpy( *c, &gMacCursors[number], sizeof(Cursor) ) ;
+#ifndef WORDS_BIGENDIAN
+ short *sptr = (short*) *c ;
+ for ( int i = 0 ; i < 2 * 16 /* image and mask */ ; ++i, ++sptr )
+ {
+ *sptr = CFSwapInt16( *sptr ) ;
+ }
+#endif
return c ;
}
return c ;
}
@@
-213,7
+223,9
@@
wxCursorRefData::~wxCursorRefData()
{
if ( m_isColorCursor )
{
{
if ( m_isColorCursor )
{
- ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
+#ifndef __LP64__
+ ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
+#endif
}
else if ( m_disposeHandle )
{
}
else if ( m_disposeHandle )
{
@@
-255,10
+267,10
@@
wxCursor::wxCursor(char **bits)
bool wxCursor::CreateFromXpm(const char **bits)
{
#if wxUSE_IMAGE
bool wxCursor::CreateFromXpm(const char **bits)
{
#if wxUSE_IMAGE
- wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") )
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") )
;
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), false, wxT("invalid cursor data") )
+ wxCHECK_MSG( img.Ok(), false, wxT("invalid cursor data") )
;
CreateFromImage( img ) ;
return true;
#else
CreateFromImage( img ) ;
return true;
#else
@@
-271,7
+283,7
@@
WXHCURSOR wxCursor::GetHCURSOR() const
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
}
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
}
-bool wxCursor::Ok() const
+bool wxCursor::
Is
Ok() const
{
return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ;
}
{
return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ;
}
@@
-303,6
+315,7
@@
void wxCursor::CreateFromImage(const wxImage & image)
{
m_refData = new wxCursorRefData;
{
m_refData = new wxCursorRefData;
+#ifndef __LP64__
int w = 16;
int h = 16;
int w = 16;
int h = 16;
@@
-418,9
+431,13
@@
void wxCursor::CreateFromImage(const wxImage & image)
*((*(**ch).crsrData) + y * bytesPerRow + x) =
GetCTabIndex( newColors , &col) ;
}
*((*(**ch).crsrData) + y * bytesPerRow + x) =
GetCTabIndex( newColors , &col) ;
}
-
+#ifdef WORDS_BIGENDIAN
(**ch).crsr1Data[y] = rowbits ;
(**ch).crsrMask[y] = maskbits ;
(**ch).crsr1Data[y] = rowbits ;
(**ch).crsrMask[y] = maskbits ;
+#else
+ (**ch).crsr1Data[y] = CFSwapInt16(rowbits) ;
+ (**ch).crsrMask[y] = CFSwapInt16(maskbits) ;
+#endif
}
if ( !bHasMask )
}
if ( !bHasMask )
@@
-429,6
+446,8
@@
void wxCursor::CreateFromImage(const wxImage & image)
HUnlock( (Handle)ch ) ;
M_CURSORDATA->m_hCursor = ch ;
M_CURSORDATA->m_isColorCursor = true ;
HUnlock( (Handle)ch ) ;
M_CURSORDATA->m_hCursor = ch ;
M_CURSORDATA->m_isColorCursor = true ;
+#endif
+
}
#endif //wxUSE_IMAGE
}
#endif //wxUSE_IMAGE
@@
-438,6
+457,7
@@
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
m_refData = new wxCursorRefData;
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
{
m_refData = new wxCursorRefData;
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
{
+#ifndef __LP64__
Str255 theName ;
wxMacStringToPascal( cursor_file , theName ) ;
Str255 theName ;
wxMacStringToPascal( cursor_file , theName ) ;
@@
-470,6
+490,7
@@
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
M_CURSORDATA->m_releaseHandle = true ;
}
}
M_CURSORDATA->m_releaseHandle = true ;
}
}
+#endif
}
else
{
}
else
{
@@
-605,10
+626,12
@@
void wxCursor::MacInstall() const
}
else if ( m_refData && M_CURSORDATA->m_hCursor )
{
}
else if ( m_refData && M_CURSORDATA->m_hCursor )
{
- if ( M_CURSORDATA->m_isColorCursor )
+#ifndef __LP64__
+ if ( M_CURSORDATA->m_isColorCursor )
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
else
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
else
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
+#endif
}
else
{
}
else
{