Questions tagged [nswindow]

an apple class that defines objects that manage and coordinate the windows an application displays on the screen

The NSWindow class defines objects (known as windows) that manage and coordinate the windows an application displays on the screen. A single NSWindow object corresponds to at most one onscreen window. The two principal functions of a window are to provide an area in which views can be placed and to accept and distribute, to the appropriate views, events the user instigates through actions with the mouse and keyboard.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html

1332 questions
12
votes
7 answers

Get ALL views and subview of NSWindow

Is there a way I can get ALL the views and subviews and subviews of these subviews (you get the idea...) of an NSWindow? Thanks.
user635064
  • 6,219
  • 12
  • 54
  • 100
12
votes
2 answers

OSX - Disable Fullscreen Mode from the zoom button?

I'm looking for either a setting option of NSWindow in XIB editor or via programmatically take I can disable the fullscreen mode feature in OS X when the user clicks the zoom button (green traffic light), as it does not work well with my UI design.…
Cai
  • 3,609
  • 2
  • 19
  • 39
12
votes
2 answers

NSWindow resize indicator not visible

How do I show resize indicators for an NSWindow without Titlebar? I created a new Xcode project(for Mac app) with storyboard. I just disabled the checkbox Title Bar in Appearance(It hides the Title bar of NSwindow). The strange thing was, after…
Kaunteya
  • 3,107
  • 1
  • 35
  • 66
12
votes
6 answers

Move a NSWindow by dragging a NSView

I have a NSWindow, on which i apply this: window.styleMask = window.styleMask | NSFullSizeContentViewWindowMask window.titleVisibility = NSWindowTitleVisibility.Hidden; window.titlebarAppearsTransparent = true; I then add a NSView behind the…
Leonard Schütz
  • 517
  • 1
  • 7
  • 16
12
votes
2 answers

Snow Leopard & LSUIElement -> application not activating properly, window not "active" despite being "key"

I'm running into a few problem with a background application that uses LSUIElement=1 to hide its dock item, menu bar and prevent it from appearing in the Command-Tab application switcher. It seems to be a Snow Leopard only problem. The application…
Frank R.
  • 2,328
  • 1
  • 24
  • 44
12
votes
4 answers

Changing color of NSWindow title text

I know this won't be a popular question and some people don't like apps that have a non-standard look, but it is useful for my application. Is it possible to change the color of the NSWindow's titlebar text, in a "standard" non-private API way? I…
iain
  • 5,660
  • 1
  • 30
  • 51
11
votes
3 answers

How do I convert Cocoa co-ords from top left == origin to bottom left == origin

I use CGWindowListCopyWindowInfo to get a list of all windows. It gives me the co-ordinates of each window based upon the origin being the top-left of the screen. If I use NSWindow's setFrame method, the co-ordinates on based upon the origin being…
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
11
votes
4 answers

Cocoa/OSX - NSWindow standardWindowButton behaving strangely once copied and added again

In my app I change the position of the standardWindowButtons close / miniturize / expand like so: //Create the buttons NSButton *minitButton = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:window.styleMask]; NSButton…
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
11
votes
2 answers

How to check if a NSWindow is visible

Is there a way to check if a NSWindow is visible or not? I want to display a sheet controller once the first window of my app became visible (the animation on 10.7 ended and the user can see the window!). If I just show the sheet in windowDidLoad,…
JustSid
  • 25,168
  • 7
  • 79
  • 97
11
votes
2 answers

SwiftUI macos NSWindow instance

Using xcode 12.3 and swift 5.3 with the SwiftUI App Life cycle to build a macOS application, what is the best way to access and change the appearance and behaviour of the NSWindow? Edit: What I'm really after is the NSWindow instance. I've added an…
hillmark
  • 807
  • 8
  • 22
11
votes
3 answers

NSWindow Mac App Store like Title Bar

How could I make an NSWindow's title bar look like that of the Mac App Store or of the app Feeder where it's height is increased and other controls are show in it. To see what I mean just check out the website for the Mac App Store :…
Joshua
  • 15,200
  • 21
  • 100
  • 172
11
votes
1 answer

Quit app when NSWindow closes

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…
Aleksejs Mjaliks
  • 8,647
  • 6
  • 38
  • 44
11
votes
3 answers

Allow an NSWindow (NSPanel) to float above full screen apps

I'm trying to add a little window that provides "quick input" from any place in the system to the main app. The user could hit a hotkey, the window pops up, and floats above all other windows. For the most part, this isn't much of a problem. I can…
radex
  • 6,336
  • 4
  • 30
  • 39
11
votes
6 answers

NSWindow returns nil (NSApplication)

I've come across an issue where I cannot access my app's main window, as it returns nil. let window = NSApplication.sharedApplication().mainWindow I've found similar questions: How to get Main Window (App Delegate) from other class (subclass of…
Naoto Ida
  • 1,275
  • 1
  • 14
  • 29
11
votes
2 answers

Detecting if the window is a key window in cocoa

I am making a application that the user will have to interact with one window and when they have that window configured the way they want it they switch to a different application then my application will begin to do other stuff which i will have…
Zanok
  • 113
  • 1
  • 5