cursor functionality expanded
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8165e9b648
commit
c6a071d2d2
@ -29,7 +29,11 @@ public:
|
||||
~wxCursorRefData();
|
||||
|
||||
protected:
|
||||
WXHCURSOR m_hCursor;
|
||||
WXHCURSOR m_hCursor;
|
||||
bool m_disposeHandle;
|
||||
bool m_releaseHandle;
|
||||
bool m_isColorCursor ;
|
||||
long m_themeCursor ;
|
||||
};
|
||||
|
||||
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
||||
@ -51,13 +55,15 @@ public:
|
||||
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
||||
const char maskBits[] = NULL);
|
||||
|
||||
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
||||
wxCursor(const wxImage & image) ;
|
||||
|
||||
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
||||
int hotSpotX = 0, int hotSpotY = 0);
|
||||
|
||||
wxCursor(int cursor_type);
|
||||
~wxCursor();
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL && M_CURSORDATA->m_hCursor != NULL ) ; }
|
||||
virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; }
|
||||
|
||||
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
|
||||
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
|
||||
@ -67,6 +73,8 @@ public:
|
||||
|
||||
void SetHCURSOR(WXHCURSOR cursor);
|
||||
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
|
||||
private :
|
||||
void Create(const wxImage & image) ;
|
||||
};
|
||||
|
||||
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
|
||||
|
@ -22,27 +22,125 @@ resource 'ldes' ( 128 )
|
||||
}
|
||||
} ;
|
||||
|
||||
resource 'CURS' (9, "Hand") {
|
||||
$"0380 04C0 04C0 04C0 04C0 04C0 74F8 9CAE"
|
||||
$"4CAB 240B 2403 1003 0803 0806 0406 0406",
|
||||
$"0380 07C0 07C0 07C0 07C0 07C0 77F8 FFFE"
|
||||
$"7FFF 3FFF 3FFF 1FFF 0FFF 0FFE 07FE 07FE",
|
||||
{0, 7}
|
||||
data 'CURS' (10) {
|
||||
$"0000 03E0 0630 0808 1004 31C6 2362 2222"
|
||||
$"2362 31C6 1004 0808 0630 03E0 0000 0000"
|
||||
$"0000 03E0 0630 0808 1004 31C6 2362 2222"
|
||||
$"2362 31C6 1004 0808 0630 03E0 0000 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
resource 'CURS' (10, "SizeWE") {
|
||||
$"0000 0180 0180 0180 0180 1188 318C 7FFE"
|
||||
$"318C 1188 0180 0180 0180 0180",
|
||||
$"03C0 03C0 03C0 03C0 1BD8 3BDC 7BFE FFFF"
|
||||
$"7FFE 3BDC 1BD8 03C0 03C0 03C0 03C0",
|
||||
{7, 7}
|
||||
data 'CURS' (11) {
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000"
|
||||
};
|
||||
|
||||
resource 'CURS' (11, "Size NS") {
|
||||
$"0000 0080 01C0 03E0 0080 0080 0080 3FFE"
|
||||
$"3FFE 0080 0080 0080 03E0 01C0 0080",
|
||||
$"0080 01C0 03E0 07F0 07F0 0180 7FFF 7FFF"
|
||||
$"7FFF 7FFF 01C0 07F0 07F0 03E0 01C0 0080",
|
||||
{7, 7}
|
||||
data 'CURS' (12) {
|
||||
$"00F0 0088 0108 0190 0270 0220 0440 0440"
|
||||
$"0880 0880 1100 1E00 1C00 1800 1000 0000"
|
||||
$"00F0 00F8 01F8 01F0 03F0 03E0 07C0 07C0"
|
||||
$"0F80 0F80 1F00 1E00 1C00 1800 1000 0000"
|
||||
$"000E 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (13) {
|
||||
$"0000 3C00 4200 8100 8100 8100 8100 4300"
|
||||
$"3F80 01C0 00E0 0070 0038 001C 000E 0006"
|
||||
$"0000 3C00 4200 8100 8100 8100 8100 4300"
|
||||
$"3F80 01C0 00E0 0070 0038 001C 000E 0006"
|
||||
$"0004 0003"
|
||||
};
|
||||
|
||||
data 'CURS' (14) {
|
||||
$"0000 07E0 1FF0 3838 3C0C 6E0E 6706 6386"
|
||||
$"61C6 60E6 7076 303C 1C1C 0FF8 07E0 0000"
|
||||
$"0540 0FF0 3FF8 383C 7C0E EE0F 6706 E387"
|
||||
$"61C6 E0E7 7076 703E 3C1C 1FFC 0FF0 0540"
|
||||
$"0007 0007"
|
||||
};
|
||||
|
||||
data 'CURS' (15) {
|
||||
$"0100 0100 0100 0100 0100 0100 0180 07E0"
|
||||
$"1FF8 1FF8 0000 1FF8 1FF8 1550 1550 1550"
|
||||
$"0100 0100 0100 0100 0100 0100 0180 07E0"
|
||||
$"1FF8 1FF8 0000 1FF8 1FF8 1550 1550 1550"
|
||||
$"0000 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (16) {
|
||||
$"00C0 0140 0640 08C0 3180 47FE 8001 8001"
|
||||
$"81FE 8040 01C0 0040 03C0 C080 3F80 0000"
|
||||
$"00C0 01C0 07C0 0FC0 3F80 7FFE FFFF FFFF"
|
||||
$"FFFE FFC0 FFC0 FFC0 FFC0 FF80 3F80 0000"
|
||||
$"0006 000F"
|
||||
};
|
||||
|
||||
data 'CURS' (17) {
|
||||
$"0100 0280 0260 0310 018C 7FE3 8000 8000"
|
||||
$"7F80 0200 0380 0200 03C0 0107 01F8 0000"
|
||||
$"0100 0380 03E0 03F0 01FC 7FFF FFFF FFFF"
|
||||
$"FFFF 03FF 03FF 03FF 03FF 01FF 01F8 0000"
|
||||
$"0007 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (18) {
|
||||
$"0000 4078 60FC 71CE 7986 7C06 7E0E 7F1C"
|
||||
$"7FB8 7C30 6C30 4600 0630 0330 0300 0000"
|
||||
$"C078 E0FC F1FE FBFF FFCF FF8F FF1F FFBE"
|
||||
$"FFFC FE78 FF78 EFF8 CFF8 87F8 07F8 0300"
|
||||
$"0001 0001"
|
||||
};
|
||||
|
||||
|
||||
data 'CURS' (19) {
|
||||
$"0000 0002 0006 000E 001E 003E 007E 00FE"
|
||||
$"01FE 003E 0036 0062 0060 00C0 00C0 0000"
|
||||
$"0003 0007 000F 001F 003F 007F 00FF 01FF"
|
||||
$"03FF 07FF 007F 00F7 00F3 01E1 01E0 01C0"
|
||||
$"0001 000E"
|
||||
};
|
||||
|
||||
data 'CURS' (20) {
|
||||
$"0000 0080 01C0 03E0 0080 0080 0080 1FFC"
|
||||
$"1FFC 0080 0080 0080 03E0 01C0 0080 0000"
|
||||
$"0080 01C0 03E0 07F0 0FF0 0180 3FFE 3FFE"
|
||||
$"3FFE 3FFE 01C0 0FF0 07F0 03E0 01C0 0080"
|
||||
$"0007 0007"
|
||||
};
|
||||
|
||||
data 'CURS' (21) {
|
||||
$"0000 0080 01C0 03E0 0080 0888 188C 3FFE"
|
||||
$"188C 0888 0080 03E0 01C0 0080 0000 0000"
|
||||
$"0080 01C0 03E0 07F0 0BE8 1DDC 3FFE 7FFF"
|
||||
$"3FFE 1DDC 0BE8 07F0 03E0 01C0 0080 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
data 'CURS' (22) {
|
||||
$"0000 001E 000E 060E 0712 03A0 01C0 00E0"
|
||||
$"0170 1238 1C1C 1C0C 1E00 0000 0000 0000"
|
||||
$"007F 003F 0E1F 0F0F 0F97 07E1 03E0 01F0"
|
||||
$"31F8 3A7C 3C3E 3E1E 3F0E 3F00 0000 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
data 'CURS' (23) {
|
||||
$"0000 7800 7000 7060 48E0 05C0 0380 0700"
|
||||
$"0E80 1C48 1838 0038 0078 0000 0000 0000"
|
||||
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
|
||||
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
|
||||
$"0006 0006"
|
||||
};
|
||||
|
||||
data 'CURS' (24) {
|
||||
$"0006 000E 001C 0018 0020 0040 00F8 0004"
|
||||
$"1FF4 200C 2AA8 1FF0 1F80 3800 6000 8000"
|
||||
$"000F 001F 003E 007C 0070 00E0 01FC 3FF6"
|
||||
$"7FF6 7FFE 7FFC 7FF8 3FF0 7FC0 F800 E000"
|
||||
$"000A 0006"
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,44 +18,55 @@
|
||||
#include "wx/app.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/mac/private.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
|
||||
#endif
|
||||
|
||||
const short kwxCursorHandId = 9 ;
|
||||
const short kwxCursorSizeWEId = 10 ;
|
||||
const short kwxCursorSizeNSId = 11 ;
|
||||
#if !TARGET_CARBON
|
||||
Cursor* MacArrowCursorPtr = &qd.arrow ;
|
||||
CursHandle MacArrowCursor = &MacArrowCursorPtr ;
|
||||
#else
|
||||
bool MacArrowInstalled = false ;
|
||||
Cursor MacArrow ;
|
||||
Cursor* MacArrowCursorPtr = &MacArrow ;
|
||||
CursHandle MacArrowCursor = &MacArrowCursorPtr ;
|
||||
#endif
|
||||
CursHandle gMacCurrentCursor = NULL ;
|
||||
const short kwxCursorBullseye = 10 ;
|
||||
const short kwxCursorBlank = 11 ;
|
||||
const short kwxCursorPencil = 12 ;
|
||||
const short kwxCursorMagnifier = 13 ;
|
||||
const short kwxCursorNoEntry = 14 ;
|
||||
const short kwxCursorPaintBrush = 15 ;
|
||||
const short kwxCursorPointRight = 16 ;
|
||||
const short kwxCursorPointLeft = 17 ;
|
||||
const short kwxCursorQuestionArrow = 18 ;
|
||||
const short kwxCursorRightArrow = 19 ;
|
||||
const short kwxCursorSizeNS = 20 ;
|
||||
const short kwxCursorSize = 21 ;
|
||||
const short kwxCursorSizeNESW = 22 ;
|
||||
const short kwxCursorSizeNWSE = 23 ;
|
||||
const short kwxCursorRoller = 24 ;
|
||||
|
||||
wxCursor gMacCurrentCursor ;
|
||||
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
if ( !MacArrowInstalled )
|
||||
{
|
||||
MacArrowCursorPtr = GetQDGlobalsArrow( &MacArrow ) ;
|
||||
MacArrowInstalled = true ;
|
||||
}
|
||||
#endif
|
||||
m_width = 32;
|
||||
m_height = 32;
|
||||
m_width = 16;
|
||||
m_height = 16;
|
||||
m_hCursor = NULL ;
|
||||
m_disposeHandle = false ;
|
||||
m_releaseHandle = false ;
|
||||
m_isColorCursor = false ;
|
||||
m_themeCursor = -1 ;
|
||||
}
|
||||
|
||||
wxCursorRefData::~wxCursorRefData()
|
||||
{
|
||||
// if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
|
||||
// ::ReleaseResource( (Handle) m_hCursor ) ;
|
||||
if ( m_isColorCursor )
|
||||
{
|
||||
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
|
||||
}
|
||||
else if ( m_disposeHandle )
|
||||
{
|
||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||
} else if ( m_releaseHandle )
|
||||
{
|
||||
::ReleaseResource( (Handle ) m_hCursor ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Cursors
|
||||
@ -68,163 +79,270 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSE
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
|
||||
wxCursor::wxCursor( const wxImage &image )
|
||||
{
|
||||
Create( image ) ;
|
||||
}
|
||||
|
||||
void wxCursor::Create(const wxImage & image)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
|
||||
// TODO: create cursor from a file
|
||||
wxImage image16 = image.Scale(16,16) ;
|
||||
unsigned char * rgbBits = image16.GetData();
|
||||
|
||||
|
||||
int w = image16.GetWidth() ;
|
||||
int h = image16.GetHeight() ;
|
||||
bool bHasMask = image16.HasMask() ;
|
||||
|
||||
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
|
||||
int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
|
||||
if (hotSpotX < 0 || hotSpotX >= w)
|
||||
hotSpotX = 0;
|
||||
if (hotSpotY < 0 || hotSpotY >= h)
|
||||
hotSpotY = 0;
|
||||
|
||||
M_CURSORDATA->m_hCursor = NewHandle( sizeof( Cursor ) ) ;
|
||||
M_CURSORDATA->m_disposeHandle = true ;
|
||||
HLock( (Handle) M_CURSORDATA->m_hCursor ) ;
|
||||
CursPtr cp = *(CursHandle)M_CURSORDATA->m_hCursor ;
|
||||
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
|
||||
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
|
||||
|
||||
unsigned char mr = image16.GetMaskRed() ;
|
||||
unsigned char mg = image16.GetMaskGreen() ;
|
||||
unsigned char mb = image16.GetMaskBlue() ;
|
||||
for ( int y = 0 ; y < h ; ++y )
|
||||
{
|
||||
short rowbits = 0 ;
|
||||
short maskbits = 0 ;
|
||||
|
||||
for ( int x = 0 ; x < w ; ++x )
|
||||
{
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
unsigned char r = rgbBits[pos] ;
|
||||
unsigned char g = rgbBits[pos+1] ;
|
||||
unsigned char b = rgbBits[pos+2] ;
|
||||
if ( bHasMask && r==mr && g==mg && b==mb )
|
||||
{
|
||||
// masked area, does not appear anywhere
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (int)r + (int)g + (int)b < 0x60 )
|
||||
{
|
||||
rowbits |= ( 1 << (15-x) ) ;
|
||||
}
|
||||
maskbits |= ( 1 << (15-x) ) ;
|
||||
}
|
||||
}
|
||||
cp->data[y] = rowbits ;
|
||||
cp->mask[y] = maskbits ;
|
||||
}
|
||||
if ( !bHasMask )
|
||||
{
|
||||
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
|
||||
}
|
||||
|
||||
cp->hotSpot.h = hotSpotX ;
|
||||
cp->hotSpot.v = hotSpotY ;
|
||||
HUnlock( (Handle) M_CURSORDATA->m_hCursor ) ;
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
|
||||
{
|
||||
Str255 theName ;
|
||||
|
||||
#if TARGET_CARBON
|
||||
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
|
||||
#else
|
||||
strcpy( (char *) theName , cursor_file ) ;
|
||||
c2pstr( (char *) theName ) ;
|
||||
#endif
|
||||
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'crsr' , theName ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
{
|
||||
M_CURSORDATA->m_isColorCursor = true ;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'CURS' , theName ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
M_CURSORDATA->m_releaseHandle = true ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxImage image ;
|
||||
image.LoadFile( cursor_file , flags ) ;
|
||||
if( image.Ok() )
|
||||
{
|
||||
image.SetOption(wxCUR_HOTSPOT_X,hotSpotX ) ;
|
||||
image.SetOption(wxCUR_HOTSPOT_Y,hotSpotY ) ;
|
||||
delete m_refData ;
|
||||
Create(image) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cursors by stock number
|
||||
wxCursor::wxCursor(int cursor_type)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
|
||||
|
||||
|
||||
switch (cursor_type)
|
||||
{
|
||||
case wxCURSOR_WAIT:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
|
||||
break;
|
||||
case wxCURSOR_IBEAM:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(iBeamCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
|
||||
break;
|
||||
case wxCURSOR_CROSS:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(crossCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
|
||||
break;
|
||||
case wxCURSOR_SIZENWSE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZENESW:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZEWE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZENS:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNSId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZING:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_CHAR:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_HAND:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
}
|
||||
break;
|
||||
{
|
||||
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_BULLSEYE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_PENCIL:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_MAGNIFIER:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_NO_ENTRY:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SIZING:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_WATCH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_PAINT_BRUSH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_LEFT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_RIGHT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_QUESTION_ARROW:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_BLANK:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case wxCURSOR_RIGHT_ARROW:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_CHAR:
|
||||
case wxCURSOR_ARROW:
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
default:
|
||||
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
|
||||
break;
|
||||
}
|
||||
if ( M_CURSORDATA->m_themeCursor == -1 )
|
||||
M_CURSORDATA->m_releaseHandle = true ;
|
||||
}
|
||||
|
||||
void wxCursor::MacInstall() const
|
||||
{
|
||||
if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||
gMacCurrentCursor = *this ;
|
||||
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
||||
{
|
||||
CursHandle ch = ((CursHandle)M_CURSORDATA->m_hCursor) ;
|
||||
::SetCursor( *ch ) ;
|
||||
gMacCurrentCursor = ch ;
|
||||
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
||||
}
|
||||
else if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||
{
|
||||
if ( M_CURSORDATA->m_isColorCursor )
|
||||
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
else
|
||||
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetCursor( *MacArrowCursor ) ;
|
||||
gMacCurrentCursor = NULL ;
|
||||
SetThemeCursor( kThemeArrowCursor ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,27 +22,125 @@ resource 'ldes' ( 128 )
|
||||
}
|
||||
} ;
|
||||
|
||||
resource 'CURS' (9, "Hand") {
|
||||
$"0380 04C0 04C0 04C0 04C0 04C0 74F8 9CAE"
|
||||
$"4CAB 240B 2403 1003 0803 0806 0406 0406",
|
||||
$"0380 07C0 07C0 07C0 07C0 07C0 77F8 FFFE"
|
||||
$"7FFF 3FFF 3FFF 1FFF 0FFF 0FFE 07FE 07FE",
|
||||
{0, 7}
|
||||
data 'CURS' (10) {
|
||||
$"0000 03E0 0630 0808 1004 31C6 2362 2222"
|
||||
$"2362 31C6 1004 0808 0630 03E0 0000 0000"
|
||||
$"0000 03E0 0630 0808 1004 31C6 2362 2222"
|
||||
$"2362 31C6 1004 0808 0630 03E0 0000 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
resource 'CURS' (10, "SizeWE") {
|
||||
$"0000 0180 0180 0180 0180 1188 318C 7FFE"
|
||||
$"318C 1188 0180 0180 0180 0180",
|
||||
$"03C0 03C0 03C0 03C0 1BD8 3BDC 7BFE FFFF"
|
||||
$"7FFE 3BDC 1BD8 03C0 03C0 03C0 03C0",
|
||||
{7, 7}
|
||||
data 'CURS' (11) {
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||
$"0000 0000"
|
||||
};
|
||||
|
||||
resource 'CURS' (11, "Size NS") {
|
||||
$"0000 0080 01C0 03E0 0080 0080 0080 3FFE"
|
||||
$"3FFE 0080 0080 0080 03E0 01C0 0080",
|
||||
$"0080 01C0 03E0 07F0 07F0 0180 7FFF 7FFF"
|
||||
$"7FFF 7FFF 01C0 07F0 07F0 03E0 01C0 0080",
|
||||
{7, 7}
|
||||
data 'CURS' (12) {
|
||||
$"00F0 0088 0108 0190 0270 0220 0440 0440"
|
||||
$"0880 0880 1100 1E00 1C00 1800 1000 0000"
|
||||
$"00F0 00F8 01F8 01F0 03F0 03E0 07C0 07C0"
|
||||
$"0F80 0F80 1F00 1E00 1C00 1800 1000 0000"
|
||||
$"000E 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (13) {
|
||||
$"0000 3C00 4200 8100 8100 8100 8100 4300"
|
||||
$"3F80 01C0 00E0 0070 0038 001C 000E 0006"
|
||||
$"0000 3C00 4200 8100 8100 8100 8100 4300"
|
||||
$"3F80 01C0 00E0 0070 0038 001C 000E 0006"
|
||||
$"0004 0003"
|
||||
};
|
||||
|
||||
data 'CURS' (14) {
|
||||
$"0000 07E0 1FF0 3838 3C0C 6E0E 6706 6386"
|
||||
$"61C6 60E6 7076 303C 1C1C 0FF8 07E0 0000"
|
||||
$"0540 0FF0 3FF8 383C 7C0E EE0F 6706 E387"
|
||||
$"61C6 E0E7 7076 703E 3C1C 1FFC 0FF0 0540"
|
||||
$"0007 0007"
|
||||
};
|
||||
|
||||
data 'CURS' (15) {
|
||||
$"0100 0100 0100 0100 0100 0100 0180 07E0"
|
||||
$"1FF8 1FF8 0000 1FF8 1FF8 1550 1550 1550"
|
||||
$"0100 0100 0100 0100 0100 0100 0180 07E0"
|
||||
$"1FF8 1FF8 0000 1FF8 1FF8 1550 1550 1550"
|
||||
$"0000 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (16) {
|
||||
$"00C0 0140 0640 08C0 3180 47FE 8001 8001"
|
||||
$"81FE 8040 01C0 0040 03C0 C080 3F80 0000"
|
||||
$"00C0 01C0 07C0 0FC0 3F80 7FFE FFFF FFFF"
|
||||
$"FFFE FFC0 FFC0 FFC0 FFC0 FF80 3F80 0000"
|
||||
$"0006 000F"
|
||||
};
|
||||
|
||||
data 'CURS' (17) {
|
||||
$"0100 0280 0260 0310 018C 7FE3 8000 8000"
|
||||
$"7F80 0200 0380 0200 03C0 0107 01F8 0000"
|
||||
$"0100 0380 03E0 03F0 01FC 7FFF FFFF FFFF"
|
||||
$"FFFF 03FF 03FF 03FF 03FF 01FF 01F8 0000"
|
||||
$"0007 0000"
|
||||
};
|
||||
|
||||
data 'CURS' (18) {
|
||||
$"0000 4078 60FC 71CE 7986 7C06 7E0E 7F1C"
|
||||
$"7FB8 7C30 6C30 4600 0630 0330 0300 0000"
|
||||
$"C078 E0FC F1FE FBFF FFCF FF8F FF1F FFBE"
|
||||
$"FFFC FE78 FF78 EFF8 CFF8 87F8 07F8 0300"
|
||||
$"0001 0001"
|
||||
};
|
||||
|
||||
|
||||
data 'CURS' (19) {
|
||||
$"0000 0002 0006 000E 001E 003E 007E 00FE"
|
||||
$"01FE 003E 0036 0062 0060 00C0 00C0 0000"
|
||||
$"0003 0007 000F 001F 003F 007F 00FF 01FF"
|
||||
$"03FF 07FF 007F 00F7 00F3 01E1 01E0 01C0"
|
||||
$"0001 000E"
|
||||
};
|
||||
|
||||
data 'CURS' (20) {
|
||||
$"0000 0080 01C0 03E0 0080 0080 0080 1FFC"
|
||||
$"1FFC 0080 0080 0080 03E0 01C0 0080 0000"
|
||||
$"0080 01C0 03E0 07F0 0FF0 0180 3FFE 3FFE"
|
||||
$"3FFE 3FFE 01C0 0FF0 07F0 03E0 01C0 0080"
|
||||
$"0007 0007"
|
||||
};
|
||||
|
||||
data 'CURS' (21) {
|
||||
$"0000 0080 01C0 03E0 0080 0888 188C 3FFE"
|
||||
$"188C 0888 0080 03E0 01C0 0080 0000 0000"
|
||||
$"0080 01C0 03E0 07F0 0BE8 1DDC 3FFE 7FFF"
|
||||
$"3FFE 1DDC 0BE8 07F0 03E0 01C0 0080 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
data 'CURS' (22) {
|
||||
$"0000 001E 000E 060E 0712 03A0 01C0 00E0"
|
||||
$"0170 1238 1C1C 1C0C 1E00 0000 0000 0000"
|
||||
$"007F 003F 0E1F 0F0F 0F97 07E1 03E0 01F0"
|
||||
$"31F8 3A7C 3C3E 3E1E 3F0E 3F00 0000 0000"
|
||||
$"0007 0008"
|
||||
};
|
||||
|
||||
data 'CURS' (23) {
|
||||
$"0000 7800 7000 7060 48E0 05C0 0380 0700"
|
||||
$"0E80 1C48 1838 0038 0078 0000 0000 0000"
|
||||
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
|
||||
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
|
||||
$"0006 0006"
|
||||
};
|
||||
|
||||
data 'CURS' (24) {
|
||||
$"0006 000E 001C 0018 0020 0040 00F8 0004"
|
||||
$"1FF4 200C 2AA8 1FF0 1F80 3800 6000 8000"
|
||||
$"000F 001F 003E 007C 0070 00E0 01FC 3FF6"
|
||||
$"7FF6 7FFE 7FFC 7FF8 3FF0 7FC0 F800 E000"
|
||||
$"000A 0006"
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,44 +18,55 @@
|
||||
#include "wx/app.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/mac/private.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
|
||||
#endif
|
||||
|
||||
const short kwxCursorHandId = 9 ;
|
||||
const short kwxCursorSizeWEId = 10 ;
|
||||
const short kwxCursorSizeNSId = 11 ;
|
||||
#if !TARGET_CARBON
|
||||
Cursor* MacArrowCursorPtr = &qd.arrow ;
|
||||
CursHandle MacArrowCursor = &MacArrowCursorPtr ;
|
||||
#else
|
||||
bool MacArrowInstalled = false ;
|
||||
Cursor MacArrow ;
|
||||
Cursor* MacArrowCursorPtr = &MacArrow ;
|
||||
CursHandle MacArrowCursor = &MacArrowCursorPtr ;
|
||||
#endif
|
||||
CursHandle gMacCurrentCursor = NULL ;
|
||||
const short kwxCursorBullseye = 10 ;
|
||||
const short kwxCursorBlank = 11 ;
|
||||
const short kwxCursorPencil = 12 ;
|
||||
const short kwxCursorMagnifier = 13 ;
|
||||
const short kwxCursorNoEntry = 14 ;
|
||||
const short kwxCursorPaintBrush = 15 ;
|
||||
const short kwxCursorPointRight = 16 ;
|
||||
const short kwxCursorPointLeft = 17 ;
|
||||
const short kwxCursorQuestionArrow = 18 ;
|
||||
const short kwxCursorRightArrow = 19 ;
|
||||
const short kwxCursorSizeNS = 20 ;
|
||||
const short kwxCursorSize = 21 ;
|
||||
const short kwxCursorSizeNESW = 22 ;
|
||||
const short kwxCursorSizeNWSE = 23 ;
|
||||
const short kwxCursorRoller = 24 ;
|
||||
|
||||
wxCursor gMacCurrentCursor ;
|
||||
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
if ( !MacArrowInstalled )
|
||||
{
|
||||
MacArrowCursorPtr = GetQDGlobalsArrow( &MacArrow ) ;
|
||||
MacArrowInstalled = true ;
|
||||
}
|
||||
#endif
|
||||
m_width = 32;
|
||||
m_height = 32;
|
||||
m_width = 16;
|
||||
m_height = 16;
|
||||
m_hCursor = NULL ;
|
||||
m_disposeHandle = false ;
|
||||
m_releaseHandle = false ;
|
||||
m_isColorCursor = false ;
|
||||
m_themeCursor = -1 ;
|
||||
}
|
||||
|
||||
wxCursorRefData::~wxCursorRefData()
|
||||
{
|
||||
// if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
|
||||
// ::ReleaseResource( (Handle) m_hCursor ) ;
|
||||
if ( m_isColorCursor )
|
||||
{
|
||||
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
|
||||
}
|
||||
else if ( m_disposeHandle )
|
||||
{
|
||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||
} else if ( m_releaseHandle )
|
||||
{
|
||||
::ReleaseResource( (Handle ) m_hCursor ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Cursors
|
||||
@ -68,163 +79,270 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSE
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
|
||||
wxCursor::wxCursor( const wxImage &image )
|
||||
{
|
||||
Create( image ) ;
|
||||
}
|
||||
|
||||
void wxCursor::Create(const wxImage & image)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
|
||||
// TODO: create cursor from a file
|
||||
wxImage image16 = image.Scale(16,16) ;
|
||||
unsigned char * rgbBits = image16.GetData();
|
||||
|
||||
|
||||
int w = image16.GetWidth() ;
|
||||
int h = image16.GetHeight() ;
|
||||
bool bHasMask = image16.HasMask() ;
|
||||
|
||||
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
|
||||
int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
|
||||
if (hotSpotX < 0 || hotSpotX >= w)
|
||||
hotSpotX = 0;
|
||||
if (hotSpotY < 0 || hotSpotY >= h)
|
||||
hotSpotY = 0;
|
||||
|
||||
M_CURSORDATA->m_hCursor = NewHandle( sizeof( Cursor ) ) ;
|
||||
M_CURSORDATA->m_disposeHandle = true ;
|
||||
HLock( (Handle) M_CURSORDATA->m_hCursor ) ;
|
||||
CursPtr cp = *(CursHandle)M_CURSORDATA->m_hCursor ;
|
||||
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
|
||||
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
|
||||
|
||||
unsigned char mr = image16.GetMaskRed() ;
|
||||
unsigned char mg = image16.GetMaskGreen() ;
|
||||
unsigned char mb = image16.GetMaskBlue() ;
|
||||
for ( int y = 0 ; y < h ; ++y )
|
||||
{
|
||||
short rowbits = 0 ;
|
||||
short maskbits = 0 ;
|
||||
|
||||
for ( int x = 0 ; x < w ; ++x )
|
||||
{
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
unsigned char r = rgbBits[pos] ;
|
||||
unsigned char g = rgbBits[pos+1] ;
|
||||
unsigned char b = rgbBits[pos+2] ;
|
||||
if ( bHasMask && r==mr && g==mg && b==mb )
|
||||
{
|
||||
// masked area, does not appear anywhere
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (int)r + (int)g + (int)b < 0x60 )
|
||||
{
|
||||
rowbits |= ( 1 << (15-x) ) ;
|
||||
}
|
||||
maskbits |= ( 1 << (15-x) ) ;
|
||||
}
|
||||
}
|
||||
cp->data[y] = rowbits ;
|
||||
cp->mask[y] = maskbits ;
|
||||
}
|
||||
if ( !bHasMask )
|
||||
{
|
||||
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
|
||||
}
|
||||
|
||||
cp->hotSpot.h = hotSpotX ;
|
||||
cp->hotSpot.v = hotSpotY ;
|
||||
HUnlock( (Handle) M_CURSORDATA->m_hCursor ) ;
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
|
||||
{
|
||||
Str255 theName ;
|
||||
|
||||
#if TARGET_CARBON
|
||||
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
|
||||
#else
|
||||
strcpy( (char *) theName , cursor_file ) ;
|
||||
c2pstr( (char *) theName ) ;
|
||||
#endif
|
||||
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'crsr' , theName ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
{
|
||||
M_CURSORDATA->m_isColorCursor = true ;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'CURS' , theName ) ;
|
||||
if ( M_CURSORDATA->m_hCursor )
|
||||
M_CURSORDATA->m_releaseHandle = true ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxImage image ;
|
||||
image.LoadFile( cursor_file , flags ) ;
|
||||
if( image.Ok() )
|
||||
{
|
||||
image.SetOption(wxCUR_HOTSPOT_X,hotSpotX ) ;
|
||||
image.SetOption(wxCUR_HOTSPOT_Y,hotSpotY ) ;
|
||||
delete m_refData ;
|
||||
Create(image) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cursors by stock number
|
||||
wxCursor::wxCursor(int cursor_type)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
|
||||
|
||||
|
||||
switch (cursor_type)
|
||||
{
|
||||
case wxCURSOR_WAIT:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
|
||||
break;
|
||||
case wxCURSOR_IBEAM:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(iBeamCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
|
||||
break;
|
||||
case wxCURSOR_CROSS:
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(crossCursor);
|
||||
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
|
||||
break;
|
||||
case wxCURSOR_SIZENWSE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZENESW:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZEWE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
|
||||
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZENS:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNSId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_SIZING:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_CHAR:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_HAND:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
}
|
||||
break;
|
||||
{
|
||||
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_BULLSEYE:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_PENCIL:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_MAGNIFIER:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_NO_ENTRY:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
|
||||
}
|
||||
break;
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SIZING:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_WATCH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_PAINT_BRUSH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_LEFT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_RIGHT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_QUESTION_ARROW:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_BLANK:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case wxCURSOR_RIGHT_ARROW:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_CHAR:
|
||||
case wxCURSOR_ARROW:
|
||||
M_CURSORDATA->m_hCursor = MacArrowCursor;
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
default:
|
||||
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
|
||||
break;
|
||||
}
|
||||
if ( M_CURSORDATA->m_themeCursor == -1 )
|
||||
M_CURSORDATA->m_releaseHandle = true ;
|
||||
}
|
||||
|
||||
void wxCursor::MacInstall() const
|
||||
{
|
||||
if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||
gMacCurrentCursor = *this ;
|
||||
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
||||
{
|
||||
CursHandle ch = ((CursHandle)M_CURSORDATA->m_hCursor) ;
|
||||
::SetCursor( *ch ) ;
|
||||
gMacCurrentCursor = ch ;
|
||||
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
||||
}
|
||||
else if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||
{
|
||||
if ( M_CURSORDATA->m_isColorCursor )
|
||||
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
else
|
||||
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetCursor( *MacArrowCursor ) ;
|
||||
gMacCurrentCursor = NULL ;
|
||||
SetThemeCursor( kThemeArrowCursor ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user