Re: cocoa app from scratch
Re: cocoa app from scratch
- Subject: Re: cocoa app from scratch
- From: "Dennis C. De Mars" <email@hidden>
- Date: Sun, 1 Aug 2004 00:28:01 -0700
OK, I didn't think of looking in NSApplication (although I guess that
was an obvious place to look). Of course, that's why I was using the
phrase "it is possible that" since I wasn't absolutely sure there
wasn't a way of doing it programatically.
It would be interesting to see a concrete example of a "nib-less" Cocoa
App (that is, one that used the AppKit in some way, not just Foundation
based).
- Dennis D.
On Jul 31, 2004, at 7:31 PM, Louis C. Sacha wrote:
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.
_______________________________________________
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.