Re: cocoa app from scratch
Re: cocoa app from scratch
- Subject: Re: cocoa app from scratch
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 31 Jul 2004 19:31:43 -0700
Hello...
Actually the NSApplication class provides the interface to deal with
the menu bar. The mainMenu and setMainMenu: NSApplication instance
methods allow you to get and set the NSMenu associated with the menu
bar.
The (somewhat obscurely named) setAppleMenu: instance method allows
you to set the application menu (the menu that uses the name of your
application and is next to the system provided Apple menu). The
"Window" menu is also handled by methods in NSApplication. If you
wanted to add the font menu, you would get it from NSFontManager.
So, most of the functionality (in terms of programmtically building a
menu bar in Cocoa) is available, it is just spread around AppKit and
there are certain restrictions about when you can do certain things.
Louis
I doubt that would work. It is true that Cocoa internally uses the
Carbon Menu Manager to put the menus on the screen, but if you made
the menu bar yourself you would not have a way of informing Cocoa
about the Carbon objects you have created, and it undoubtedly needs
access to those, as there is a lot of auxiliary Cocoa info that gets
associated with those objects.
Finlay may be right, it is possible that the menu bar is the one
case where Cocoa has not provided any (public) alternative means to
create the menu bar other than the nib file. If one was absolutely
fixated on doing everything programatically, though, you could
create a nib file that has nothing but one essentially empty menu
bar (you might have to have the Apple menu, though...) and fill the
rest in via the NSMenu class.
- Dennis D.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.