00001
00033 #include <AppKit/AppKit.h>
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "llwindowmacosx-objc.h"
00043
00044 void setupCocoa()
00045 {
00046 static bool inited = false;
00047
00048 if(!inited)
00049 {
00050 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00051
00052
00053
00054
00055
00056 NSApplicationLoad();
00057
00058
00059 [[[NSWindow alloc] init] release];
00060
00061 [pool release];
00062 }
00063 }
00064
00065 CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY)
00066 {
00067 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00068
00069
00070 NSCursor *cursor =
00071 [[[NSCursor alloc]
00072 initWithImage:
00073 [[[NSImage alloc] initWithContentsOfFile:
00074 [NSString stringWithFormat:@"%s", fullpath]
00075 ]autorelease]
00076 hotSpot:NSMakePoint(hotspotX, hotspotY)
00077 ]retain];
00078
00079 [pool release];
00080
00081 return (CursorRef)cursor;
00082 }
00083
00084
00085 OSErr releaseImageCursor(CursorRef ref)
00086 {
00087 if( ref != NULL )
00088 {
00089 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00090 NSCursor *cursor = (NSCursor*)ref;
00091 [cursor release];
00092 [pool release];
00093 }
00094 else
00095 {
00096 return paramErr;
00097 }
00098
00099 return noErr;
00100 }
00101
00102 OSErr setImageCursor(CursorRef ref)
00103 {
00104 if( ref != NULL )
00105 {
00106 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00107 NSCursor *cursor = (NSCursor*)ref;
00108 [cursor set];
00109 [pool release];
00110 }
00111 else
00112 {
00113 return paramErr;
00114 }
00115
00116 return noErr;
00117 }
00118