setting Custom view into menuItem in Tiger
-
Hi guys
I am stuck in some problems about setting a custom view into menuItem in
Tiger. I know that there is a method called setView in menuItem in leopard
and it's easy to use.
But what I need is to set a custom view into menuItem in Tiger.
According to the documents latest version , NSMenu is responsible for
drawing the things , and the menuItem just encapsulates the information that
NSMenu need.
Then I find another class , NSMenuView ,that's really something I want . But
the note disappointed me again .
"NSMenuView is deprecated and is no longer used to draw menus. Calling its
methods will not affect the appearance of your menus."
Now I have no idea , even the direction to the solution .
Who's responsible for drawing the menu? NSMenu seems not to have some
drawing method.
If I want to do what I want , is that mean I have to cast my custom View to
Carbon HIView , then embed this View into menuItem ?
I 'm not familiar with the carbon things . Can anyone give me some
directions on How to setting custom view into menuItem in Tiger? or where 's
point I can get into of the NSMenu drawing method? -
On Feb 14, 2008, at 12:58 PM, cai qin wrote:> Hi guys
> I am stuck in some problems about setting a custom view into
> menuItem in
> Tiger. I know that there is a method called setView in menuItem in
> leopard
> and it's easy to use.
> But what I need is to set a custom view into menuItem in Tiger.
Sorry, this is not possible. You can do some custom drawing in an
NSMenuItem by setting an image, or an attributed string that contains
an NSTextAttachmentCell, but you cannot replace the content with a
view, or do any event handling.
-Peter


