Creating a styles menu like the one in the ruler accessory view of NSLayoutManager...
Creating a styles menu like the one in the ruler accessory view of NSLayoutManager...
- Subject: Creating a styles menu like the one in the ruler accessory view of NSLayoutManager...
- From: Keith Blount <email@hidden>
- Date: Sun, 27 Jul 2008 08:22:48 -0700 (PDT)
Hi,
I'm fairly sure that this isn't possible without hooking into private methods of NSLayoutManager, but it's worth asking on the off-chance...
In a standard rich text NSTextView, the ruler view has an accessory view provided by NSLayoutManager. This accessory view has several handy controls in it - a styles pop-up menu, a lists pop-up menu, an alignment segmented control and so forth. However, for my own app I'm overriding NSLayoutManager to get rid of this accessory view. Instead, I'm providing a Pages-like format bar; the reason for this is that, given that you can split the editor in my app and therefore have two text views visible, you can also have two accessory views visible which can take up more screen estate than necessary; having the same controls in one bar that affects both text views will take up less space and provide a less cluttered experience. Adding most of the controls to this format bar is straightforward - bold, italic, underline, foreground/background colour, alignment etc are all relatively easy. However, it seems that there is no way of grabbing a list of available
styles in order to provide a styles menu like the one that appears in the standard accessory view (nor no way of grabbing the lists menu, for that matter). I can just create a button that calls -orderFrontStylesPanel: if necessary, but this will involve more steps for the user (having to go through the sheet to get to the menu), and I'd really just like to provide a list of styles like the one in the standard NSLayoutManager accessory view.
Is there any way of doing this? As I say, from surveying the docs and searching online, I don't think it's possible - I think these lists and how the menus are generated by NSLayoutManager's accessory view are all contained in private methods - but I'd love to discover I'm wrong.
Many thanks in advance and all the best,
Keith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden