• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cocoa app from scratch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: cocoa app from scratch (From: Shalev NessAiver <email@hidden>)
 >Re: cocoa app from scratch (From: mmalcolm crawford <email@hidden>)
 >Re: cocoa app from scratch (From: Finlay Dobbie <email@hidden>)
 >Re: cocoa app from scratch (From: Scott Thompson <email@hidden>)
 >Re: cocoa app from scratch (From: "Dennis C. De Mars" <email@hidden>)

  • Prev by Date: Password encryption
  • Next by Date: Re: Password encryption
  • Previous by thread: Re: cocoa app from scratch
  • Next by thread: Open Recent menu
  • Index(es):
    • Date
    • Thread