зеркало из https://github.com/mozilla/gecko-dev.git
don't use method selectors unnecessarily in cursor code. b=464313 r=smichaud sr=roc a=beltzner
This commit is contained in:
Родитель
0481903b3d
Коммит
a98da0bc2e
|
@ -63,14 +63,6 @@ static nsCursorManager *gInstance;
|
|||
*/
|
||||
+ (nsMacCursor *) createCursor: (enum nsCursor) aCursor;
|
||||
|
||||
/*! @method createNSCursor:
|
||||
@abstract Creates the appropriate cursor implementation from the arguments.
|
||||
@discussion Creates a native Mac cursor, using NSCursor.
|
||||
@param aCursor selector indicating the NSCursor cursor to create
|
||||
@result the Mac native implementation of the cursor
|
||||
*/
|
||||
+ (nsMacCursor *) createNSCursor: (SEL) aCursor;
|
||||
|
||||
@end
|
||||
|
||||
@implementation nsCursorManager
|
||||
|
@ -107,16 +99,16 @@ static nsCursorManager *gInstance;
|
|||
return [nsMacCursor cursorWithCursor: [NSCursor arrowCursor]];
|
||||
case eCursor_wait:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeWatchCursor];
|
||||
case eCursor_select:
|
||||
case eCursor_select:
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor IBeamCursor]];
|
||||
case eCursor_hyperlink:
|
||||
return [nsCursorManager createNSCursor: @selector(pointingHandCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor pointingHandCursor]];
|
||||
case eCursor_crosshair:
|
||||
return [nsCursorManager createNSCursor: @selector(crosshairCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor crosshairCursor]];
|
||||
case eCursor_move:
|
||||
return [nsCursorManager createNSCursor: @selector(openHandCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor openHandCursor]];
|
||||
case eCursor_help:
|
||||
return [nsMacCursor cursorWithImageNamed: @"help" hotSpot: NSMakePoint(1,1)];
|
||||
return [nsMacCursor cursorWithImageNamed: @"help" hotSpot: NSMakePoint(1,1)];
|
||||
case eCursor_copy:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeCopyArrowCursor];
|
||||
case eCursor_alias:
|
||||
|
@ -127,11 +119,11 @@ static nsCursorManager *gInstance;
|
|||
case eCursor_cell:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemePlusCursor];
|
||||
case eCursor_grab:
|
||||
return [nsCursorManager createNSCursor: @selector(openHandCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor openHandCursor]];
|
||||
case eCursor_grabbing:
|
||||
return [nsCursorManager createNSCursor: @selector(closedHandCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor closedHandCursor]];
|
||||
case eCursor_spinning:
|
||||
return [nsMacCursor cursorWithResources: 200 lastFrame: 203]; // better than kThemeSpinningCursor
|
||||
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:
|
||||
|
@ -139,7 +131,7 @@ static nsCursorManager *gInstance;
|
|||
case eCursor_vertical_text:
|
||||
return [nsMacCursor cursorWithImageNamed: @"vtIBeam" hotSpot: NSMakePoint(7,8)];
|
||||
case eCursor_all_scroll:
|
||||
return [nsCursorManager createNSCursor: @selector(openHandCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor openHandCursor]];;
|
||||
case eCursor_not_allowed:
|
||||
case eCursor_no_drop:
|
||||
return [nsMacCursor cursorWithThemeCursor: kThemeNotAllowedCursor];
|
||||
|
@ -147,34 +139,34 @@ static nsCursorManager *gInstance;
|
|||
// Resize Cursors:
|
||||
//North
|
||||
case eCursor_n_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeUpCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeUpCursor]];
|
||||
//North East
|
||||
case eCursor_ne_resize:
|
||||
return [nsMacCursor cursorWithImageNamed: @"sizeNE" hotSpot: NSMakePoint(8,7)];
|
||||
//East
|
||||
case eCursor_e_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeRightCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeRightCursor]];
|
||||
//South East
|
||||
case eCursor_se_resize:
|
||||
return [nsMacCursor cursorWithImageNamed: @"sizeSE" hotSpot: NSMakePoint(8,8)];
|
||||
//South
|
||||
case eCursor_s_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeDownCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeDownCursor]];
|
||||
//South West
|
||||
case eCursor_sw_resize:
|
||||
return [nsMacCursor cursorWithImageNamed: @"sizeSW" hotSpot: NSMakePoint(6,8)];
|
||||
//West
|
||||
case eCursor_w_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeLeftCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeLeftCursor]];
|
||||
//North West
|
||||
case eCursor_nw_resize:
|
||||
return [nsMacCursor cursorWithImageNamed: @"sizeNW" hotSpot: NSMakePoint(7,7)];
|
||||
//North & South
|
||||
case eCursor_ns_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeUpDownCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeUpDownCursor]];
|
||||
//East & West
|
||||
case eCursor_ew_resize:
|
||||
return [nsCursorManager createNSCursor: @selector(resizeLeftRightCursor)];
|
||||
return [nsMacCursor cursorWithCursor: [NSCursor resizeLeftRightCursor]];
|
||||
//North East & South West
|
||||
case eCursor_nesw_resize:
|
||||
return [nsMacCursor cursorWithImageNamed: @"sizeNESW" hotSpot: NSMakePoint(8,8)];
|
||||
|
@ -194,15 +186,6 @@ static nsCursorManager *gInstance;
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
+ (nsMacCursor *) createNSCursor: (SEL) aCursor
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
return [nsMacCursor cursorWithCursor:[NSCursor performSelector:aCursor]];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче