nswindow

Layering Cocoa WebView - Drawing on top?

旧城冷巷雨未停 提交于 2019-12-05 10:19:57
webview in core animation layer The only other thread I can find is the above which doesn't necessarily fit my needs. Is there a reliable way to simply draw a view on top of a webview? I've tried to layer a regular NSView on top of WebView, and it draws right at first, but any movement in the webview (scrolling the page etc) appears to invalidate the view and produces visual artifacts. I've tried: [[[NSApp mainWindow] contentView] addSubview:view positioned:NSWindowAbove relativeTo:webView]; No luck there, same problems -- z-ordering doesn't seem to work unless I'm missing something. Is this

Centering Windows on screen

怎甘沉沦 提交于 2019-12-05 07:27:06
Short and sweet: How can I tell Interface Builder to center a window on a user's screen? I've seen the positioning tool on the inspector, but eyeballing doesn't always land as squarely as I like. Is this something where I should switch over to Xcode and add something to the init or awakeFromNib methods? You could use [window center] as answered by wahkiz, but that might not be exactly what you want. The documentation states that this will put the window centered horizontally, but somewhat above the vertical centre. In this way the window has a visual prominence. If you want to put your window

Mac OS X, make a window go over menu bar

雨燕双飞 提交于 2019-12-05 04:44:32
Is it possible to make a window to go over the menu bar, without going in fullscreen? Thanks in Advance! Yes, trivially: window.level = NSMainMenuWindowLevel + 1; (Reference: Drawing to the Full Screen , OpenGL Programming Guide for Mac OS X .) sebastianmarkow is correct in that this is terrible behaviour for a normal document window, but there are several window types for which this is normal: cursors, tool tips, and special utilities like Xscope. I liked Jens Ayton's answer, but rather than pick an arbitrary number like that, I think it would be preferred that you use one of the defined

How to disable NSDocument's window title popup

谁说我不能喝 提交于 2019-12-05 03:40:44
I have an NSDocument based app with autosave enabled. I'd like to prevent this popup from showing: I have tried returning nil from NSWindow's –title, –representedFilename and –representedURL which hide the title effectively hide the title but have no effect on the downward facing disclosure indicator and the popup. Is there a way I can prevent this popup from being presented? I was able to prevent the button from being shown by overriding NSWindow's + (NSButton *)standardWindowButton:(NSWindowButton)windowButtonKind forStyleMask:(NSUInteger)windowStyle and returning nil for

NSWindow launching with wrong size after setting contentViewController to NSTabViewController

浪子不回头ぞ 提交于 2019-12-05 02:00:15
问题 I have an Xcode project with an NSWindowController whose contentViewController was set to a subclass of NSViewController . I recently removed the NSViewController subclass from the storyboard and replaced the contentViewController with an NSTabViewController subclass. Now, when I run the application, the NSWindow opens with a size of 500x500 instead of the size of the first tab. What's more, there is no view I can see in the storyboard that has a size of 500x500, and that size isn't being

Quit app when NSWindow closes

一曲冷凌霜 提交于 2019-12-05 01:56:00
How correctly to quit the Mac OS X app, when the main (the only one) closes? I know there a method - (void)windowWillClose:(NSNotification *)notification in NSWindowDelegate . But it isn't quite suitable in my case, because it is called before NSWindow closes. You cannot have windowDidClose event since the notification that accompanies it would be holding an invalid object (the window is likely to have been deallocated on close). To achieve what you need, make your class the delegate of the Application, and implement the following method: - (BOOL)

Window visible on all spaces (including other fullscreen apps)

落花浮王杯 提交于 2019-12-05 01:12:12
问题 I'm trying to make a window (NSWindow) visible on all the spaces including other full screen app windows. I've been trying to set a higher window level as well as playing with expose and spaces settings in the inspector. I found some solutions here, but they do not work. At least on El Capitan. Here is a sample code to test: let window = NSWindow(contentRect: NSRect(x: 300, y: 300, width: 200, height: 200), styleMask: NSBorderlessWindowMask, backing: .Buffered, `defer`: true) window

Allow views in childWindow to become key without losing focus on parentWindow

丶灬走出姿态 提交于 2019-12-05 00:34:48
问题 I added a childWindow of a custom subclass of NSWindow to a parentWindow (also a custom subclass of NSWindow). The childWindow has the NSBorderlessWindowMask and canBecomeKeyWindow: is overridden to return YES and canBecomeMainWindow: to return NO. The childWindow is set to resize with the parentWindow. So I want to create the illusion that the views of the childWindow are part of the parentWindow. The main idea is to arrange the document windows created by the document-based application

Open New Window in Swift

空扰寡人 提交于 2019-12-04 23:33:11
问题 I am trying to open a new window in my Swift application but I cannot get it to open. class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(aNotification: NSNotification) { openMyWindow() } func openMyWindow() { if let storyboard = NSStoryboard(name: "Main",bundle: nil) { if let vc = storyboard.instantiateControllerWithIdentifier("MyList") as? MyListViewController { var myWindow = NSWindow(contentViewController: vc) myWindow.makeKeyAndOrderFront(self) let

Click through custom NSWindow

不羁岁月 提交于 2019-12-04 21:22:11
I have custom NSWindow with custom NSView set as its contentView. The window gets initialized with: [window setOpaque:NO]; [window setBackgroundColor: [NSColor clearColor]]; [window setHasShadow: NO]; [window setAcceptsMouseMovedEvents: YES]; [window setLevel: NSFloatingWindowLevel]; Content view, in its drawRect draws simple circle filled by solid color. All this works OK - the window appears on desktop and I see that circle. The only thing that does not work: the whole window rectangle is not transparent for mouse clicks. If I will click outside the circle (but inside invisible window box)