michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsCursorManager_h_ michael@0: #define nsCursorManager_h_ michael@0: michael@0: #import michael@0: #include "nsIWidget.h" michael@0: #include "nsMacCursor.h" michael@0: michael@0: /*! @class nsCursorManager michael@0: @abstract Singleton service provides access to all cursors available in the application. michael@0: @discussion Use nsCusorManager to set the current cursor using an XP nsCusor enum value. michael@0: nsCursorManager encapsulates the details of setting different types of cursors, animating michael@0: cursors and cleaning up cursors when they are no longer in use. michael@0: */ michael@0: @interface nsCursorManager : NSObject michael@0: { michael@0: @private michael@0: NSMutableDictionary *mCursors; michael@0: nsMacCursor *mCurrentMacCursor; michael@0: } michael@0: michael@0: /*! @method setCursor: michael@0: @abstract Sets the current cursor. michael@0: @discussion Sets the current cursor to the cursor indicated by the XP cursor constant given as an argument. michael@0: Resources associated with the previous cursor are cleaned up. michael@0: @param aCursor the cursor to use michael@0: */ michael@0: - (nsresult) setCursor: (nsCursor) aCursor; michael@0: michael@0: /*! @method setCursorWithImage:hotSpotX:hotSpotY: michael@0: @abstract Sets the current cursor to a custom image michael@0: @discussion Sets the current cursor to the cursor given by the aCursorImage argument. michael@0: Resources associated with the previous cursor are cleaned up. michael@0: @param aCursorImage the cursor image to use michael@0: @param aHotSpotX the x coordinate of the cursor's hotspot michael@0: @param aHotSpotY the y coordinate of the cursor's hotspot michael@0: @param scaleFactor the scale factor of the target display (2 for a retina display) michael@0: */ michael@0: - (nsresult) setCursorWithImage: (imgIContainer*) aCursorImage hotSpotX: (uint32_t) aHotspotX hotSpotY: (uint32_t) aHotspotY scaleFactor: (CGFloat) scaleFactor; michael@0: michael@0: michael@0: /*! @method sharedInstance michael@0: @abstract Get the Singleton instance of the cursor manager. michael@0: @discussion Use this method to obtain a reference to the cursor manager. michael@0: @result a reference to the cursor manager michael@0: */ michael@0: + (nsCursorManager *) sharedInstance; michael@0: michael@0: /*! @method dispose michael@0: @abstract Releases the shared instance of the cursor manager. michael@0: @discussion Use dispose to clean up the cursor manager and associated cursors. michael@0: */ michael@0: + (void) dispose; michael@0: @end michael@0: michael@0: @interface NSCursor (Undocumented) michael@0: // busyButClickableCursor is an undocumented NSCursor API, but has been in use since michael@0: // at least OS X 10.4 and through 10.9. michael@0: + (NSCursor*)busyButClickableCursor; michael@0: @end michael@0: michael@0: #endif // nsCursorManager_h_