nscursor

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

孤人 提交于 2021-02-10 12:39:57
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

风流意气都作罢 提交于 2021-02-10 12:31:55
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

99封情书 提交于 2021-02-10 12:31:47
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

Cocoa nsview change cursor

妖精的绣舞 提交于 2020-02-27 23:09:27
问题 I tried to change the default cursor in my cocoa application. I read about this but the standard approach isn't working for me. I try to add to my OpenGLView subclass this method: - (void) resetCursorRects { [super resetCursorRects]; NSCursor * myCur = [[NSCursor alloc] initWithImage:[NSImage imageNamed:@"1.png"] hotSpot:NSMakePoint(8,0)]; [self addCursorRect: [self bounds] cursor: myCur]; NSLog(@"Reset cursor rect!"); } It`s not working. Why? 回答1: There're two ways you can do it. First - the

Cocoa predefined resize mouse cursor?

岁酱吖の 提交于 2019-12-21 16:54:37
问题 Is the resize mouse cursor used by Preview (e.g. when resizing shapes) a system cursor? It's not available directly as a method in NSCursor but then it doesn't look like there's a private resource for the cursor in the Preview app's bundle either.. Are there more system cursors other than the methods defined by the NSCursor class..? 回答1: I think you are particularly interested in these class methods (Preview.app dissasembly). +[NSCursor resizeAngle45Cursor]; which calls +[NSCursor

How to disable all NSCursor updates in my application?

允我心安 提交于 2019-12-12 09:53:31
问题 In my macOS application, I have a custom WebView. When the user moves the mouse cursor over different elements in the WebView's webpage like text, links, etc. (which are implemented as subviews, I think), the cursor updates automatically, based on the type of the element. My requirement is that I want to set a custom cursor for the WebView (even for my entire application if possible), and not let it change whatsoever, at least till I programmatically change it in some other part of the code.

How to retrieve the backing image for an `[NSCursor arrowCursor]` (say) as an `NSImage`

允我心安 提交于 2019-12-11 21:14:27
问题 The documentation for NSCursor doesn't seem to provide any way of retrieving the actual cursor images. Can anyone suggest a method? 来源: https://stackoverflow.com/questions/56304537/how-to-retrieve-the-backing-image-for-an-nscursor-arrowcursor-say-as-an-n

How to prevent a NSCursor from change?

我的未来我决定 提交于 2019-12-10 16:56:50
问题 I have a problem while I try to prevent a cursor from changing. I try to put an overlay View over entire window, but, if under that overlay exist an NSTextView, this will force cursor to change. I want to prevent that, and keep the arrow cursor until my overlay view will be removed. Overriding the cursorUpdate method does not work... override func cursorUpdate(with event: NSEvent) { return } Thanks! Even this (question 32447739) answer does not help. This solution is valid only if the overlay

NSCursor: “set” method has no effect

北城以北 提交于 2019-12-10 11:12:06
问题 I am working on a Mac application with Xcode (using cocos2d), trying to configure the cursor, and the "set" method does not seem to have any effect in some cases... I already had a hard time to set my cursor at the launch of the application (NSTimer to set it after the application was really launched), and now I just want it to display another image when the user clicks; I use NSNotification for that, my cursor class receives the notification, then it is supposed to set the new image, then...

resetCursorRects not working (new cursor only flashes as mouse enters)

与世无争的帅哥 提交于 2019-12-10 10:38:42
问题 I'm creating a custom view that needs a special cursor (instead of the usual arrow). I'm using the resetCursorRects to setup the new cursor and its area, but the new cursor only appears briefly when the mouse enters the rect area, returning to arrow. To check things better, I've created a new project, create a new custom view (based on NSView), add it to the window, but the problem remains. The custom view code: #import "TestView.h" @implementation TestView - (void)drawRect:(NSRect)dirtyRect