Right, that’s my puzzlement – I’m setting the style flags here to zero, which on Windows successfully disables all three buttons. On macOS, I’ve stepped down into the guts of the ComponentPeer code for macOS, and it looks like the maximise flag is completely ignored?
static unsigned int getNSWindowStyleMask (const int flags) noexcept
unsigned int style = (flags & windowHasTitleBar) != 0 ? NSWindowStyleMaskTitled
if ((flags & windowHasMinimiseButton) != 0) style |= NSWindowStyleMaskMiniaturizable;
if ((flags & windowHasCloseButton) != 0) style |= NSWindowStyleMaskClosable;
if ((flags & windowIsResizable) != 0) style |= NSWindowStyleMaskResizable;
…so we go more deeply into the component peer code to the point where we’re creating and initializing the
NSWindow that our component uses, and looking up the valid values of
NSWindowStyleMask on the Apple developer website, we note that there’s no style flag present to affect this fullscreen/maximize behavior, so not a JUCE problem, a macOS design that makes me harrumph.
Since my app is designed to have a maximum size, I guess that the approach to take here is:
- When we’re on the mac
- In my main component’s
paint() method, look to see if the local bounds are larger than the current max size as set by the last call to
- If so, fill the bounds in a bg color, and then make sure that my component is actually drawn into a new rect at the maximum size, centered within the window bounds.
Better ideas (not including ‘redesign the UI to work at arbitrary sizes’), anyone?