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