NSWindow - Types

I am currently creating a framework in Swift to encapsulate NSWindows (for starters)

I am trying to decide how best to define a given window (Document, Modal etc) similar to how Xojo does it…

I was thinking just 3

  • Document [non modal, defaults to all traffic lights]
  • Modal [same as document, but modal]
  • Box [modal, but no title, no traffic lights]


Doesnt the Xojo ones correspond to the style masks for NSWindow ?
And Xojo lets you toggle other aspects of that style mask for the traffic lights etc

no ?

well yes and no… there are more window styles than macOS “supports”, some seem to actually be duplicates of each other.
What I wanted to do was define basic default types, since the mask must be assigned when the window is created (this does not include the traffic lights)

// | .borderless=0 | .titled=1 || .closable=2 | .miniaturizable=4 | .resizable=8 | .fullScreen=16384

and if it is or is not modal, this too affects some INIT features

that makes sense too

this seems to be the current list

// .borderless	                  0
// .titled	                      1
// .closable	                  2 // red ball
// .miniaturizable                4 // yellow ball
// .resizable	                  8 // green ball
// .utilityWindow                16
// .docModalWindow	             64
// .nonactivatingPanel          128
// .texturedBackground          256 // deprecated
// .unifiedTitleAndToolbar     4096 // has no effect anymore
// .hudWindow                  8192
// .fullScreen  	          16384
// .fullSizeContentView	      32768 // not much use

where anything over 128 seems to be of little use, and I’m still not sure what 16, 64 and 128 do (yet)

fullSizeContentView is useful if you want to place (scrolling?) content under the titlebar like how Safari scrolls up under the semi-translucent titlebar.

Or creating full height “source lists”.

Or for providing a hiding titlebar so that while editing the user has a bit more “workspace” but when they mouse over the titlebar area it re-appears (also when window is not foreground).