user4992124
user4992124

Reputation: 1594

How to do split NSToolbarItem

I'm wondering what the best way is to do a split NSToolbarItem like Xcode does. I've read the documentation, but can't figure out a way to do this. Any ideas?

enter image description here

Upvotes: 0

Views: 46

Answers (1)

seth
seth

Reputation: 1718

It's a custom control. Basically it's a custom NSView, drawing a background the same as a button/popup, draws the "selection" on both sides, handles mouse events and displays one of two menus based on which side was clicked. It's not difficult, but it's not a trivial amount of code to whip up and share either. Just look at any examples of making any kind of clickable custom view and you'll be on your way.

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaViewsGuide/SubclassingNSView/SubclassingNSView.html

Upvotes: 1

Related Questions