开发者

"Minimize All" with NSBorderlessWindowMask

开发者 https://www.devze.com 2023-02-14 09:28 出处:网络
I\'m working on creating a custom window design based on an NSBorderlessWindowMask-style NSWindow subclass, but I\'m running into trouble recreating some of the basic window c开发者_Python百科ommands.

I'm working on creating a custom window design based on an NSBorderlessWindowMask-style NSWindow subclass, but I'm running into trouble recreating some of the basic window c开发者_Python百科ommands. I mainly followed this post on creating custom window shapes, and used the advice from Craig Hockenberry in the comments in order to get the "Close" and "Minimize" menu items to work correctly. The problem comes in when I try to do the "Minimize All" command (and, I suspect, eventually, the "Zoom All" command).

The obvious method to use is NSApplication's -miniaturizeAll:, but it doesn't appear to do anything. Testing and research (Google) appear to point to -miniaturizeAll: not working with NSBorderlessWindowMask. I tried rolling my own, but that created its own problems (it doesn't work if the option key is held, and it doesn't minimize windows simultaneously). Is there anyway to get the real method working with NSBorderlessWindowMask?


I use this code in my main view's mouseUp: method:

if ([theEvent clickCount] > 1)
    [[self window] miniaturize:self];
0

精彩评论

暂无评论...
验证码 换一张
取 消