nswindow

Cocoa Open a fullscreen window on the second screen maintaining the app visible on the first

元气小坏坏 提交于 2019-12-01 12:04:22
I'm developing an app on OSX 10.7 and I'm trying and the goal is to open some images on a second screen while the app has to run normally on the first. So the code is the following: NSScreen *screen = [[NSScreen screens] objectAtIndex:1]; fullScreenWindow = [[NSWindow alloc] initWithContentRect:[screenFrame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO screen:screen]; [fullScreenWindow setLevel: NSMainMenuWIndowLevel + 1]; [fullScreenWindow setOpaque: YES]; [fullScreenWindow setBackgroundColor:[NSColor yellowColor]]; fullScreenView = [[NSView alloc] initWithFrame

NSWindow with custom shadow

这一生的挚爱 提交于 2019-12-01 11:47:43
问题 I want to draw a custom shadow on an NSWindow-Object. Is there a way to do this by passing an own NSShadow-Object to NSWindow? Or a (private) method, where I can put my own drawing code? Thanks, 回答1: Don't. You shouldn't alter the look of the window. Changing the look of UI is only allowed for Apple. Normal apps should use the standard one. That said, there's a way, if you really insist on doing that. You can't just attach an NSShadow , unfortunately. Also, as far as I understand, there's no

Cocoa Open a fullscreen window on the second screen maintaining the app visible on the first

断了今生、忘了曾经 提交于 2019-12-01 10:30:23
问题 I'm developing an app on OSX 10.7 and I'm trying and the goal is to open some images on a second screen while the app has to run normally on the first. So the code is the following: NSScreen *screen = [[NSScreen screens] objectAtIndex:1]; fullScreenWindow = [[NSWindow alloc] initWithContentRect:[screenFrame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO screen:screen]; [fullScreenWindow setLevel: NSMainMenuWIndowLevel + 1]; [fullScreenWindow setOpaque: YES];

Passing Click Through Transparent Window

房东的猫 提交于 2019-12-01 10:08:31
问题 I have a fullscreen transparent window. When the user clicks on it I want the click to be sent to what's underneath the window. How would I do so? 回答1: Setting IgnoresMouseEvents to YES should do the trick.. (void)setIgnoresMouseEvents:(BOOL)ignoreMouseEvents Specifies whether the window is transparent to mouse clicks and other mouse events, allowing overlay windows. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference

How to receive notifications when moving Window by mouse?

随声附和 提交于 2019-12-01 09:28:41
I tried -setFrame:display: and -windowDidMove: but they are not sent while moving window. If You want to track NSWindow live moving, it's not possible by default You’ll have to do it on your own. It's possible to get notification when NSWindow is started to drag (move) with NSWindowWillMoveNotification or ended dragging (moving) - NSWindowDidMoveNotification . Take a look at these examples they can help You to solve live window moving problem: 1. Example: Description: Very short category on NSWindow that makes windows post NSWindowDidMove notifications continuously during dragging (much like

Changing color of the NSWindow titlebar

大城市里の小女人 提交于 2019-12-01 06:16:54
I am developing a desktop application in which I want to change the color of the title bar of an NSWindow. How exactly can I do this? NSWindow's content view has a superview, which is an instance of NSThemeFrame. That class is responsible for drawing the title text, the window/toolbar background texture, and it contains subviews for everything else (close button, full screen button, NSDocument icon, etc). You can use the Objective-C runtime to replace NSThemeFrame's drawRect: method with your own method, which will call the parent implementation and then perform custom drawing on top of it.

Changing color of the NSWindow titlebar

元气小坏坏 提交于 2019-12-01 05:10:58
问题 I am developing a desktop application in which I want to change the color of the title bar of an NSWindow. How exactly can I do this? 回答1: NSWindow's content view has a superview, which is an instance of NSThemeFrame. That class is responsible for drawing the title text, the window/toolbar background texture, and it contains subviews for everything else (close button, full screen button, NSDocument icon, etc). You can use the Objective-C runtime to replace NSThemeFrame's drawRect: method with

NSWindow restorable not always working

只谈情不闲聊 提交于 2019-12-01 01:53:23
问题 I have checked the restorable option on my NSWindow When I move my application and change its size and close/reopen my application it sets the window size and position to the last size and position but this doesn't happen on every computer where i test it. it only happens to a few computers they don't have special settings regarding the resume. Does anybody have any experience with this? 回答1: But this doesn't happen on every computer where I test it. It only happens to a few computers. They

How to change the NSScreen a NSWindow appears on

萝らか妹 提交于 2019-11-30 23:38:49
I have an application that will load a couple of windows depending on which button is pressed. All except one of these open on the mainScreen (the screen in which the main window is open in). One of them (the preference window) opens on the first screen (the screen with the menu bar). I cannot understand way it is doing this, is there a way to change the screen that a NSWindow opens on? I could not get toohtik's answer to work. What I ended up doing was subclassing NSWindow and then overriding constrainFrameRect: toScreen:. This will automatically open the new window on the "main screen" of

How to change the NSScreen a NSWindow appears on

安稳与你 提交于 2019-11-30 18:40:06
问题 I have an application that will load a couple of windows depending on which button is pressed. All except one of these open on the mainScreen (the screen in which the main window is open in). One of them (the preference window) opens on the first screen (the screen with the menu bar). I cannot understand way it is doing this, is there a way to change the screen that a NSWindow opens on? 回答1: I could not get toohtik's answer to work. What I ended up doing was subclassing NSWindow and then