1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsCursorManager_h_
6 #define nsCursorManager_h_
8 #import <Foundation/Foundation.h>
10 #include "nsMacCursor.h"
12 /*! @class nsCursorManager
13 @abstract Singleton service provides access to all cursors available in the application.
14 @discussion Use <code>nsCusorManager</code> to set the current cursor using an XP <code>nsCusor</code> enum value.
15 <code>nsCursorManager</code> encapsulates the details of setting different types of cursors, animating
16 cursors and cleaning up cursors when they are no longer in use.
18 @interface nsCursorManager
: NSObject
21 NSMutableDictionary
*mCursors
;
22 nsMacCursor
*mCurrentMacCursor
;
25 /*! @method setCursor:
26 @abstract Sets the current cursor.
27 @discussion Sets the current cursor to the cursor indicated by the XP cursor constant given as an argument.
28 Resources associated with the previous cursor are cleaned up.
29 @param aCursor the cursor to use
31 - (nsresult
) setCursor
: (nsCursor
) aCursor
;
33 /*! @method setCursorWithImage:hotSpotX:hotSpotY:
34 @abstract Sets the current cursor to a custom image
35 @discussion Sets the current cursor to the cursor given by the aCursorImage argument.
36 Resources associated with the previous cursor are cleaned up.
37 @param aCursorImage the cursor image to use
38 @param aHotSpotX the x coordinate of the cursor's hotspot
39 @param aHotSpotY the y coordinate of the cursor's hotspot
40 @param scaleFactor the scale factor of the target display (2 for a retina display)
42 - (nsresult
) setCursorWithImage
: (imgIContainer
*) aCursorImage hotSpotX
: (uint32_t) aHotspotX hotSpotY
: (uint32_t) aHotspotY scaleFactor
: (CGFloat
) scaleFactor
;
45 /*! @method sharedInstance
46 @abstract Get the Singleton instance of the cursor manager.
47 @discussion Use this method to obtain a reference to the cursor manager.
48 @result a reference to the cursor manager
50 + (nsCursorManager
*) sharedInstance
;
53 @abstract Releases the shared instance of the cursor manager.
54 @discussion Use dispose to clean up the cursor manager and associated cursors.
59 @interface
NSCursor (Undocumented
)
60 // busyButClickableCursor is an undocumented NSCursor API, but has been in use since
61 // at least OS X 10.4 and through 10.9.
62 + (NSCursor
*)busyButClickableCursor
;
65 #endif // nsCursorManager_h_