1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/cocoa/nsCursorManager.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef nsCursorManager_h_ 1.9 +#define nsCursorManager_h_ 1.10 + 1.11 +#import <Foundation/Foundation.h> 1.12 +#include "nsIWidget.h" 1.13 +#include "nsMacCursor.h" 1.14 + 1.15 +/*! @class nsCursorManager 1.16 + @abstract Singleton service provides access to all cursors available in the application. 1.17 + @discussion Use <code>nsCusorManager</code> to set the current cursor using an XP <code>nsCusor</code> enum value. 1.18 + <code>nsCursorManager</code> encapsulates the details of setting different types of cursors, animating 1.19 + cursors and cleaning up cursors when they are no longer in use. 1.20 + */ 1.21 +@interface nsCursorManager : NSObject 1.22 +{ 1.23 + @private 1.24 + NSMutableDictionary *mCursors; 1.25 + nsMacCursor *mCurrentMacCursor; 1.26 +} 1.27 + 1.28 +/*! @method setCursor: 1.29 + @abstract Sets the current cursor. 1.30 + @discussion Sets the current cursor to the cursor indicated by the XP cursor constant given as an argument. 1.31 + Resources associated with the previous cursor are cleaned up. 1.32 + @param aCursor the cursor to use 1.33 +*/ 1.34 +- (nsresult) setCursor: (nsCursor) aCursor; 1.35 + 1.36 +/*! @method setCursorWithImage:hotSpotX:hotSpotY: 1.37 + @abstract Sets the current cursor to a custom image 1.38 + @discussion Sets the current cursor to the cursor given by the aCursorImage argument. 1.39 + Resources associated with the previous cursor are cleaned up. 1.40 + @param aCursorImage the cursor image to use 1.41 + @param aHotSpotX the x coordinate of the cursor's hotspot 1.42 + @param aHotSpotY the y coordinate of the cursor's hotspot 1.43 + @param scaleFactor the scale factor of the target display (2 for a retina display) 1.44 + */ 1.45 +- (nsresult) setCursorWithImage: (imgIContainer*) aCursorImage hotSpotX: (uint32_t) aHotspotX hotSpotY: (uint32_t) aHotspotY scaleFactor: (CGFloat) scaleFactor; 1.46 + 1.47 + 1.48 +/*! @method sharedInstance 1.49 + @abstract Get the Singleton instance of the cursor manager. 1.50 + @discussion Use this method to obtain a reference to the cursor manager. 1.51 + @result a reference to the cursor manager 1.52 +*/ 1.53 ++ (nsCursorManager *) sharedInstance; 1.54 + 1.55 +/*! @method dispose 1.56 + @abstract Releases the shared instance of the cursor manager. 1.57 + @discussion Use dispose to clean up the cursor manager and associated cursors. 1.58 +*/ 1.59 ++ (void) dispose; 1.60 +@end 1.61 + 1.62 +@interface NSCursor (Undocumented) 1.63 +// busyButClickableCursor is an undocumented NSCursor API, but has been in use since 1.64 +// at least OS X 10.4 and through 10.9. 1.65 ++ (NSCursor*)busyButClickableCursor; 1.66 +@end 1.67 + 1.68 +#endif // nsCursorManager_h_