mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Make Mac OS X cursor code 64-bit ready. Remove all Carbon API dependencies. b=464315 r=mstange sr=roc
This commit is contained in:
parent
beca38650c
commit
0e438679d4
@ -145,8 +145,6 @@ $(NIB_DEST):
|
||||
$(NIB_DEST)/%: $(srcdir)/resources/MainMenu.nib/% $(NIB_DEST)
|
||||
$(INSTALL) $< $(NIB_DEST)
|
||||
|
||||
RESOURCE = libwidget.rsrc
|
||||
|
||||
# for objdir builds, symlink the cursors dir
|
||||
ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
|
||||
ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
|
||||
@ -157,14 +155,6 @@ endif
|
||||
export::
|
||||
$(INSTALL) $(srcdir)/cursors $(DIST)/bin/res
|
||||
|
||||
$(RESOURCE): nsMacWidget.r
|
||||
/Developer/Tools/Rez -i /Developer/Headers/FlatCarbon -useDF $< -o $@
|
||||
|
||||
GARBAGE += $(RESOURCE)
|
||||
|
||||
libs:: $(RESOURCE)
|
||||
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
$(TK_CFLAGS) \
|
||||
-I$(srcdir)/../xpwidgets \
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <math.h>
|
||||
|
||||
static nsCursorManager *gInstance;
|
||||
static NSArray* sSpinCursorFrames = nil;
|
||||
|
||||
/*! @category nsCursorManager(PrivateMethods)
|
||||
Private methods for the cursor manager class.
|
||||
@ -74,6 +75,14 @@ static nsCursorManager *gInstance;
|
||||
if (!gInstance) {
|
||||
gInstance = [[nsCursorManager alloc] init];
|
||||
}
|
||||
|
||||
if (!sSpinCursorFrames) {
|
||||
NSCursor* cursor1 = [nsMacCursor cocoaCursorWithImageNamed:@"spin1" hotSpot:NSMakePoint(1.0, 1.0)];
|
||||
NSCursor* cursor2 = [nsMacCursor cocoaCursorWithImageNamed:@"spin2" hotSpot:NSMakePoint(1.0, 1.0)];
|
||||
NSCursor* cursor3 = [nsMacCursor cocoaCursorWithImageNamed:@"spin3" hotSpot:NSMakePoint(1.0, 1.0)];
|
||||
NSCursor* cursor4 = [nsMacCursor cocoaCursorWithImageNamed:@"spin4" hotSpot:NSMakePoint(1.0, 1.0)];
|
||||
sSpinCursorFrames = [[NSArray alloc] initWithObjects:cursor1, cursor2, cursor3, cursor4, nil];
|
||||
}
|
||||
return gInstance;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
@ -86,6 +95,9 @@ static nsCursorManager *gInstance;
|
||||
[gInstance release];
|
||||
gInstance = nil;
|
||||
|
||||
[sSpinCursorFrames release];
|
||||
sSpinCursorFrames = nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
@ -98,7 +110,8 @@ static nsCursorManager *gInstance;
|
||||
case eCursor_standard:
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]];
|
||||
case eCursor_wait:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeWatchCursor];
|
||||
case eCursor_spinning:
|
||||
return [nsMacCursor cursorWithFrames: sSpinCursorFrames];
|
||||
case eCursor_select:
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor IBeamCursor]];
|
||||
case eCursor_hyperlink:
|
||||
@ -110,20 +123,18 @@ static nsCursorManager *gInstance;
|
||||
case eCursor_help:
|
||||
return [nsMacCursor cursorWithImageNamed: @"help" hotSpot: NSMakePoint(1,1)];
|
||||
case eCursor_copy:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeCopyArrowCursor];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]]; //XXX needs real implementation
|
||||
case eCursor_alias:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeAliasArrowCursor];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]]; //XXX needs real implementation
|
||||
case eCursor_context_menu:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeContextualMenuArrowCursor];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]]; //XXX needs real implementation
|
||||
|
||||
case eCursor_cell:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemePlusCursor];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor crosshairCursor]];
|
||||
case eCursor_grab:
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor openHandCursor]];
|
||||
case eCursor_grabbing:
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor closedHandCursor]];
|
||||
case eCursor_spinning:
|
||||
return [nsMacCursor cursorWithResources: 200 lastFrame: 203]; // better than kThemeSpinningCursor
|
||||
case eCursor_zoom_in:
|
||||
return [nsMacCursor cursorWithImageNamed: @"zoomIn" hotSpot: NSMakePoint(6,6)];
|
||||
case eCursor_zoom_out:
|
||||
@ -134,7 +145,7 @@ static nsCursorManager *gInstance;
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor openHandCursor]];;
|
||||
case eCursor_not_allowed:
|
||||
case eCursor_no_drop:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeNotAllowedCursor];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]]; //XXX needs real implementation
|
||||
|
||||
// Resize Cursors:
|
||||
//North
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define nsMacCursor_h_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
/*! @class nsMacCursor
|
||||
@abstract Represents a native Mac cursor.
|
||||
@ -53,14 +52,6 @@
|
||||
int mFrameCounter;
|
||||
}
|
||||
|
||||
/*! @method cursorWithThemeCursor:
|
||||
@abstract Create a cursor by specifying a Carbon Apperance Manager <code>ThemeCursor</code> constant.
|
||||
@discussion Creates a cursor representing the given Appearance Manager built in cursor.
|
||||
@param aCursor the <code>ThemeCursor</code> to use
|
||||
@result an autoreleased instance of <code>nsMacCursor</code> representing the given <code>ThemeCursor</code>
|
||||
*/
|
||||
+ (nsMacCursor *) cursorWithThemeCursor: (ThemeCursor) aCursor;
|
||||
|
||||
/*! @method cursorWithCursor:
|
||||
@abstract Create a cursor by specifying a Cocoa <code>NSCursor</code>.
|
||||
@discussion Creates a cursor representing the given Cocoa built-in cursor.
|
||||
@ -91,18 +82,14 @@
|
||||
*/
|
||||
+ (nsMacCursor *) cursorWithFrames: (NSArray *) aCursorFrames;
|
||||
|
||||
/*! @method cursorWithResources:lastFrame:
|
||||
@abstract Create an animated cursor by specifying a range of <code>CURS</code> resources to load and animate.
|
||||
@discussion Creates a cursor that will animate by cycling through the given range of cursor resource ids. Each
|
||||
resource in the range must be the next frame in the animation.
|
||||
<p>To create a static cursor, simply pass the same resource id for both parameters.</p>
|
||||
<p>The frames are loaded from the compiled version of the resource file nsMacWidget.r.</p>
|
||||
@param aFirstFrame the resource id for the first frame of the animation. Must be 128 or greated
|
||||
@param aLastFrame the resource id for the last frame of the animation. Must be 128 or greater, and greater than
|
||||
or equal to <code>aFirstFrame</code>
|
||||
@result an autoreleased instance of <code>nsMacCursor</code> that will animate the given cursor resources
|
||||
/*! @method cocoaCursorWithImageNamed:hotSpot:
|
||||
@abstract Create a Cocoa NSCursor object with a Gecko image resource name and a hotspot point.
|
||||
@discussion Create a Cocoa NSCursor object with a Gecko image resource name and a hotspot point.
|
||||
@param imageName the name of the gecko image resource, "tiff" extension is assumed, do not append.
|
||||
@param aPoint the point within the cursor to use as the hotspot
|
||||
@result an autoreleased instance of <code>nsMacCursor</code> that will animate the given cursor frames
|
||||
*/
|
||||
+ (nsMacCursor *) cursorWithResources: (int) aFirstFrame lastFrame: (int) aLastFrame;
|
||||
+ (NSCursor *) cocoaCursorWithImageNamed: (NSString *) imageName hotSpot: (NSPoint) aPoint;
|
||||
|
||||
/*! @method set
|
||||
@abstract Set the cursor.
|
||||
|
@ -80,13 +80,13 @@
|
||||
@discussion Invalidates and releases any <code>NSTimer</code> instance associated with this cursor.
|
||||
*/
|
||||
|
||||
/*! @method spinCursor:
|
||||
/*! @method advanceAnimatedCursor:
|
||||
@abstract Method called by animation timer to perform animation.
|
||||
@discussion Called by an animated cursor's associated timer to advance the animation to the next frame.
|
||||
Determines which frame should occur next and sets the cursor to that frame.
|
||||
@param aTimer the timer causing the animation
|
||||
*/
|
||||
- (void) spinCursor: (NSTimer *) aTimer;
|
||||
- (void) advanceAnimatedCursor: (NSTimer *) aTimer;
|
||||
|
||||
/*! @method setFrame:
|
||||
@abstract Sets the current cursor, using an index to determine which frame in the animation to display.
|
||||
@ -99,27 +99,6 @@
|
||||
|
||||
@end
|
||||
|
||||
/*! @class nsThemeCursor
|
||||
@abstract Implementation of <code>nsMacCursor</code> that uses Carbon Appearance Manager cursors.
|
||||
@discussion Displays a static or animated <code>ThemeCursor</code> using Carbon Appearance Manager functions.
|
||||
Understands how many frames exist in each of the built-in <code>ThemeCursor</code>s.
|
||||
*/
|
||||
@interface nsThemeCursor : nsMacCursor
|
||||
{
|
||||
@private
|
||||
ThemeCursor mCursor;
|
||||
}
|
||||
|
||||
/*! @method initWithThemeCursor:
|
||||
@abstract Create a cursor by specifying a Carbon Apperance Manager <code>ThemeCursor</code> constant.
|
||||
@discussion Creates a cursor representing the given Appearance Manager built in cursor.
|
||||
@param aCursor the <code>ThemeCursor</code> to use
|
||||
@result an instance of <code>nsThemeCursor</code> representing the given <code>ThemeCursor</code>
|
||||
*/
|
||||
- (id) initWithThemeCursor: (ThemeCursor) aCursor;
|
||||
|
||||
@end
|
||||
|
||||
/*! @class nsCocoaCursor
|
||||
@abstract Implementation of <code>nsMacCursor</code> that uses Cocoa <code>NSCursor</code> instances.
|
||||
@discussion Displays a static or animated cursor, using Cocoa <code>NSCursor</code> instances. These can be either
|
||||
@ -164,54 +143,8 @@
|
||||
|
||||
@end
|
||||
|
||||
/*! @class nsResourceCursor
|
||||
@abstract Implementation of <code>nsMacCursor</code> that uses Carbon <code>CURS</code> resources.
|
||||
@discussion Displays a static or animated cursor, using Carbon <code>CURS</code> resources.
|
||||
<p>Animated cursors are produced by cycling through a range of cursor resource ids.</p>
|
||||
<p>The frames are loaded from the compiled version of the resource file nsMacWidget.r.</p>
|
||||
*/
|
||||
@interface nsResourceCursor : nsMacCursor
|
||||
{
|
||||
@private
|
||||
int mFirstFrame;
|
||||
int mLastFrame;
|
||||
}
|
||||
|
||||
/*! @method initWithResources:lastFrame:
|
||||
@abstract Create an animated cursor by specifying a range of <code>CURS</code> resources to load and animate.
|
||||
@discussion Creates a cursor that will animate by cycling through the given range of cursor resource ids. Each
|
||||
resource in the range must be the next frame in the animation.
|
||||
<p>To create a static cursor, simply pass the same resource id for both parameters.</p>
|
||||
<p>The frames are loaded from the compiled version of the resource file nsMacWidget.r.</p>
|
||||
@param aFirstFrame the resource id for the first frame of the animation. Must be 128 or greated
|
||||
@param aLastFrame the resource id for the last frame of the animation. Must be 128 or greater, and greater than
|
||||
or equal to <code>aFirstFrame</code>
|
||||
@result an instance of <code>nsResourceCursor</code> that will animate the given cursor resources
|
||||
*/
|
||||
- (id) initWithFirstFrame: (int) aFirstFrame lastFrame: (int) aLastFrame;
|
||||
|
||||
@end
|
||||
|
||||
@implementation nsMacCursor
|
||||
|
||||
+ (nsMacCursor *) cursorWithThemeCursor: (ThemeCursor) aCursor
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
return [[[nsThemeCursor alloc] initWithThemeCursor: aCursor] autorelease];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
+ (nsMacCursor *) cursorWithResources: (int) aFirstFrame lastFrame: (int) aLastFrame
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
return [[[nsResourceCursor alloc] initWithFirstFrame: aFirstFrame lastFrame: aLastFrame] autorelease];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
+ (nsMacCursor *) cursorWithCursor: (NSCursor *) aCursor
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
@ -239,6 +172,44 @@
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
+ (NSCursor *) cocoaCursorWithImageNamed: (NSString *) imageName hotSpot: (NSPoint) aPoint
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
nsCOMPtr<nsIFile> resDir;
|
||||
nsCAutoString resPath;
|
||||
NSString* pathToImage;
|
||||
NSImage* cursorImage;
|
||||
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(resDir));
|
||||
if (NS_FAILED(rv))
|
||||
goto INIT_FAILURE;
|
||||
resDir->AppendNative(NS_LITERAL_CSTRING("res"));
|
||||
resDir->AppendNative(NS_LITERAL_CSTRING("cursors"));
|
||||
|
||||
rv = resDir->GetNativePath(resPath);
|
||||
if (NS_FAILED(rv))
|
||||
goto INIT_FAILURE;
|
||||
|
||||
pathToImage = [NSString stringWithUTF8String:(const char*)resPath.get()];
|
||||
if (!pathToImage)
|
||||
goto INIT_FAILURE;
|
||||
pathToImage = [pathToImage stringByAppendingPathComponent:imageName];
|
||||
pathToImage = [pathToImage stringByAppendingPathExtension:@"tiff"];
|
||||
|
||||
cursorImage = [[[NSImage alloc] initWithContentsOfFile:pathToImage] autorelease];
|
||||
if (!cursorImage)
|
||||
goto INIT_FAILURE;
|
||||
return [[[NSCursor alloc] initWithImage: cursorImage hotSpot: aPoint] autorelease];
|
||||
|
||||
INIT_FAILURE:
|
||||
NS_WARNING("Problem getting path to cursor image file!");
|
||||
[self release];
|
||||
return nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (void) set
|
||||
{
|
||||
if ([self isAnimated]) {
|
||||
@ -276,10 +247,10 @@
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mTimer == nil) {
|
||||
if (!mTimer) {
|
||||
mTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.25
|
||||
target: self
|
||||
selector: @selector(spinCursor:)
|
||||
selector: @selector(advanceAnimatedCursor:)
|
||||
userInfo: nil
|
||||
repeats: YES] retain];
|
||||
}
|
||||
@ -300,7 +271,7 @@
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (void) spinCursor: (NSTimer *) aTimer
|
||||
- (void) advanceAnimatedCursor: (NSTimer *) aTimer
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@ -328,55 +299,6 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation nsThemeCursor
|
||||
|
||||
- (id) initWithThemeCursor: (ThemeCursor) aCursor
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
self = [super init];
|
||||
//Appearance Manager cursors all fall into the range 0..127. Custom application CURS resources begin at id 128.
|
||||
NS_ASSERTION(mCursor >= 0 && mCursor < 128, "Theme cursors must be in the range 0 <= num < 128");
|
||||
mCursor = aCursor;
|
||||
return self;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (void) setFrame: (int) aFrameIndex
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if ([self isAnimated]) {
|
||||
//if the cursor is animated try to draw the appropriate frame
|
||||
OSStatus err = ::SetAnimatedThemeCursor(mCursor, aFrameIndex);
|
||||
if (err != noErr) {
|
||||
//in the event of any kind of problem, just try to show the first frame
|
||||
::SetThemeCursor(mCursor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
::SetThemeCursor(mCursor);
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (int) numFrames
|
||||
{
|
||||
//These don't appear to be documented. Trial and Error...
|
||||
switch (mCursor)
|
||||
{
|
||||
case kThemeWatchCursor:
|
||||
case kThemeSpinningCursor:
|
||||
return 8;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation nsCocoaCursor
|
||||
|
||||
- (id) initWithFrames: (NSArray *) aCursorFrames
|
||||
@ -410,32 +332,7 @@
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
nsCOMPtr<nsIFile> resDir;
|
||||
nsCAutoString resPath;
|
||||
NSString* pathToImage;
|
||||
NSImage* cursorImage;
|
||||
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(resDir));
|
||||
if (NS_FAILED(rv)) goto INIT_FAILURE;
|
||||
resDir->AppendNative(NS_LITERAL_CSTRING("res"));
|
||||
resDir->AppendNative(NS_LITERAL_CSTRING("cursors"));
|
||||
|
||||
rv = resDir->GetNativePath(resPath);
|
||||
if (NS_FAILED(rv)) goto INIT_FAILURE;
|
||||
|
||||
pathToImage = [NSString stringWithUTF8String:(const char*)resPath.get()];
|
||||
if (!pathToImage) goto INIT_FAILURE;
|
||||
pathToImage = [pathToImage stringByAppendingPathComponent:aCursorImage];
|
||||
pathToImage = [pathToImage stringByAppendingPathExtension:@"tiff"];
|
||||
|
||||
cursorImage = [[[NSImage alloc] initWithContentsOfFile:pathToImage] autorelease];
|
||||
if (!cursorImage) goto INIT_FAILURE;
|
||||
return [self initWithCursor: [[NSCursor alloc] initWithImage: cursorImage hotSpot: aPoint]];
|
||||
|
||||
INIT_FAILURE:
|
||||
NS_WARNING("Problem getting path to cursor image file!");
|
||||
[self release];
|
||||
return nil;
|
||||
return [self initWithCursor: [nsMacCursor cocoaCursorWithImageNamed: aCursorImage hotSpot: aPoint]];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
@ -478,93 +375,3 @@ INIT_FAILURE:
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation nsResourceCursor
|
||||
|
||||
static short sRefNum = kResFileNotOpened;
|
||||
static short sSaveResFile = 0;
|
||||
|
||||
// this could be simplified if it was rewritten using Cocoa
|
||||
+(void)openLocalResourceFile
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (sRefNum == kResFileNotOpened) {
|
||||
CFBundleRef appBundle = ::CFBundleGetMainBundle();
|
||||
if (appBundle) {
|
||||
CFURLRef executable = ::CFBundleCopyExecutableURL(appBundle);
|
||||
if (executable) {
|
||||
CFURLRef binDir = ::CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, executable);
|
||||
if (binDir) {
|
||||
CFURLRef resourceFile = ::CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, binDir,
|
||||
CFSTR("libwidget.rsrc"), PR_FALSE);
|
||||
if (resourceFile) {
|
||||
FSRef resourceRef;
|
||||
if (::CFURLGetFSRef(resourceFile, &resourceRef))
|
||||
::FSOpenResourceFile(&resourceRef, 0, NULL, fsRdPerm, &sRefNum);
|
||||
::CFRelease(resourceFile);
|
||||
}
|
||||
::CFRelease(binDir);
|
||||
}
|
||||
::CFRelease(executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sRefNum == kResFileNotOpened)
|
||||
return;
|
||||
|
||||
sSaveResFile = ::CurResFile();
|
||||
::UseResFile(sRefNum);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
+(void)closeLocalResourceFile
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (sRefNum == kResFileNotOpened)
|
||||
return;
|
||||
|
||||
::UseResFile(sSaveResFile);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
-(id) initWithFirstFrame: (int) aFirstFrame lastFrame: (int) aLastFrame
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
if ((self = [super init])) {
|
||||
//Appearance Manager cursors all fall into the range 0..127. Custom application CURS resources begin at id 128.
|
||||
NS_ASSERTION(aFirstFrame >= 128 && aLastFrame >= 128 && aLastFrame >= aFirstFrame, "Nonsensical frame indicies");
|
||||
mFirstFrame = aFirstFrame;
|
||||
mLastFrame = aLastFrame;
|
||||
}
|
||||
return self;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (void) setFrame: (int) aFrameIndex
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
[nsResourceCursor openLocalResourceFile];
|
||||
CursHandle cursHandle = ::GetCursor(mFirstFrame + aFrameIndex);
|
||||
NS_ASSERTION(cursHandle, "Can't load cursor, is the resource file installed correctly?");
|
||||
if (cursHandle) {
|
||||
::SetCursor(*cursHandle);
|
||||
}
|
||||
[nsResourceCursor closeLocalResourceFile];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (int) numFrames
|
||||
{
|
||||
return (mLastFrame - mFirstFrame) + 1;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -1,222 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <Types.r>
|
||||
|
||||
resource 'CURS' (128, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7F8E 7C1B 6C03 4606 060C 0300 030C",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FF80"
|
||||
$"FFCE FFDB FE03 EF06 CF0C 8780 078C 0380",
|
||||
{1, 1}
|
||||
};
|
||||
|
||||
resource 'CURS' (129, locked, preload) {
|
||||
$"0F00 30C0 4020 4620 8610 9F90 9F90 8610"
|
||||
$"4620 4020 30F0 0F38 001C 000E 0007 0002",
|
||||
$"0F00 3FC0 7FE0 7FE0 FFF0 FFF0 FFF0 FFF0"
|
||||
$"7FE0 7FE0 3FF0 0F38 001C 000E 0007 0002",
|
||||
{6, 6}
|
||||
};
|
||||
|
||||
resource 'CURS' (130, locked, preload) {
|
||||
$"0F00 30C0 4020 4020 8010 9F90 9F90 8010"
|
||||
$"4020 4020 30F0 0F38 001C 000E 0007 0002",
|
||||
$"0F00 3FC0 7FE0 7FE0 FFF0 FFF0 FFF0 FFF0"
|
||||
$"7FE0 7FE0 3FF0 0F38 001C 000E 0007 0002",
|
||||
{6, 6}
|
||||
};
|
||||
|
||||
resource 'CURS' (131, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7F80 7000 6600 4900 1480 1280 0900 06",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FF80"
|
||||
$"FFC0 FF80 FF00 FF80 FFC0 3FC0 1F80 0F",
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
resource 'CURS' (132, locked, preload) {
|
||||
$"0000 0660 0660 0660 0660 2664 6666 FE7F"
|
||||
$"FE7F 6666 2664 0660 0660 0660 0660",
|
||||
$"0FF0 0FF0 0FF0 0FF0 2FF4 6FF6 FFFF FFFF"
|
||||
$"FFFF FFFF 6FF6 2FF4 0FF0 0FF0 0FF0 0FF0",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (133, locked, preload) {
|
||||
$"0180 03C0 07E0 0180 0180 7FFE 7FFE 0000"
|
||||
$"0000 7FFE 7FFE 0180 0180 07E0 03C0 0180",
|
||||
$"03C0 07E0 0FF0 03C0 FFFF FFFF FFFF FFFF"
|
||||
$"FFFF FFFF FFFF FFFF 03C0 0FF0 07E0 03C0",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (134, locked, preload) {
|
||||
$"0000 0000 0000 0000 8001 8001 4102 3FFC"
|
||||
$"4102 8001 8001",
|
||||
$"0000 0000 0000 0000 8001 8001 4102 3FFC"
|
||||
$"4102 8001 8001",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (135, locked, preload) {
|
||||
$"0000 0180 03C0 07E0 0180 0180 0180 7FFE"
|
||||
$"7FFE",
|
||||
$"0180 03C0 07E0 0FF0 0FF0 03C0 FFFF FFFF"
|
||||
$"FFFF FFFF",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (136, locked, preload) {
|
||||
$"0000 0000 0000 0000 0000 0000 0000 7FFE"
|
||||
$"7FFE 0180 0180 0180 07E0 03C0 0180",
|
||||
$"0000 0000 0000 0000 0000 0000 FFFF FFFF"
|
||||
$"FFFF FFFF 03C0 0FF0 0FF0 07E0 03C0 0180",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (137, locked, preload) {
|
||||
$"0000 0000 0000 1E18 1C38 1E70 17E0 03C0"
|
||||
$"0380 0700 0E00 1C00 18",
|
||||
$"0000 0000 3F80 3F18 3E38 3E70 3FE0 33C0"
|
||||
$"2380 0700 0E00 1C00 18",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (138, locked, preload) {
|
||||
$"0000 0000 0000 0018 0038 0070 00E0 01C0"
|
||||
$"03C0 07E8 0E78 1C38 1878",
|
||||
$"0000 0000 0000 0018 0038 0070 00E0 01C4"
|
||||
$"03CC 07FC 0E7C 1C7C 18FC 01FC",
|
||||
{8, 8}
|
||||
};
|
||||
|
||||
resource 'CURS' (139, locked, preload) {
|
||||
$"0000 0000 0000 1878 1C38 0E78 07E8 03C0"
|
||||
$"01C0 00E0 0070 0038 0018",
|
||||
$"0000 0000 01FC 18FC 1C7C 0E7C 07FC 03CC"
|
||||
$"01C4 00E0 0070 0038 0018",
|
||||
{7, 8}
|
||||
};
|
||||
|
||||
resource 'CURS' (140, locked, preload) {
|
||||
$"0000 0000 0000 1800 1C00 0E00 0700 0380"
|
||||
$"03C0 17E0 1E70 1C38 1E18",
|
||||
$"0000 0000 0000 1800 1C00 0E00 0700 2380"
|
||||
$"33C0 3FE0 3E70 3E38 3F18 3F80",
|
||||
{8, 6}
|
||||
};
|
||||
|
||||
resource 'CURS' (141, locked, preload) {
|
||||
$"0000 0180 03C0 07E0 0180 0180 0180 7FFE"
|
||||
$"7FFE 0180 0180 0180 07E0 03C0 0180",
|
||||
$"0180 03C0 07E0 0FF0 0FF0 03C0 FFFF FFFF"
|
||||
$"FFFF FFFF 03C0 0FF0 0FF0 07E0 03C0 0180",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (142, locked, preload) {
|
||||
$"0000 0000 0000 1878 1C38 0E78 07E8 03C0"
|
||||
$"03C0 17E0 1E70 1C38 1E18",
|
||||
$"0000 0000 387C 3CFC 3E7C 1FFC 0FFC 07E8"
|
||||
$"17E0 3FF0 3FF8 3E7C 3F3C 3E1C",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (143, locked, preload) {
|
||||
$"0000 0000 0000 1E18 1C38 1E70 17E0 03C0"
|
||||
$"03C0 07E8 0E78 1C38 1878",
|
||||
$"0000 0000 3E1C 3F3C 3E7C 3FF8 3FF0 17E0"
|
||||
$"07E8 0FFC 1FFC 3E7C 3CFC 387C",
|
||||
{7, 7}
|
||||
};
|
||||
|
||||
resource 'CURS' (200, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7FB8 7C74 6CF2 46FE 069E 035C 0338 0000",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FFB8"
|
||||
$"FFFC FFFE FFFF EFFF CFFF 87FE 07FC 03B8",
|
||||
{1,1}
|
||||
};
|
||||
|
||||
resource 'CURS' (201, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7FB8 7C7C 6CBA 4692 06BA 037C 0338 0000",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FFB8"
|
||||
$"FFFC FFFE FFFF EFFF CFFF 87FE 07FC 03B8",
|
||||
{1,1}
|
||||
};
|
||||
|
||||
resource 'CURS' (202, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7FB8 7C5C 6C9E 46FE 06F2 0374 0338 0000",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FFB8"
|
||||
$"FFFC FFFE FFFF EFFF CFFF 87FE 07FC 03B8",
|
||||
{1,1}
|
||||
};
|
||||
|
||||
resource 'CURS' (203, locked, preload) {
|
||||
$"0000 4000 6000 7000 7800 7C00 7E00 7F00"
|
||||
$"7FB8 7C44 6CEE 46FE 06EE 0344 0338 0000",
|
||||
$"C000 E000 F000 F800 FC00 FE00 FF00 FFB8"
|
||||
$"FFFC FFFE FFFF EFFF CFFF 87FE 07FC 03B8",
|
||||
{1,1}
|
||||
};
|
||||
|
||||
data 'TMPL' (129, "ldes") {
|
||||
$"0756 6572 7369 6F6E 4457 5244 0452 6F77" /* .VersionDWRD.Row */
|
||||
$"7344 5752 4407 436F 6C75 6D6E 7344 5752" /* sDWRD.ColumnsDWR */
|
||||
$"440B 4365 6C6C 2048 6569 6768 7444 5752" /* D.Cell HeightDWR */
|
||||
$"440A 4365 6C6C 2057 6964 7468 4457 5244" /* DÂCell WidthDWRD */
|
||||
$"0B56 6572 7420 5363 726F 6C6C 424F 4F4C" /* .Vert ScrollBOOL */
|
||||
$"0C48 6F72 697A 2053 6372 6F6C 6C42 4F4F" /* .Horiz ScrollBOO */
|
||||
$"4C07 4C44 4546 2049 4444 5752 4408 4861" /* L.LDEF IDDWRD.Ha */
|
||||
$"7320 4772 6F77 424F 4F4C" /* s GrowBOOL */
|
||||
};
|
||||
|
||||
resource 'ldes' (128, purgeable) {
|
||||
versionZero {
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
hasVertScroll,
|
||||
noHorizScroll,
|
||||
0,
|
||||
noGrowSpace
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user