
Now copy the "SystemUIPlugin.h" file from your home folder to the project folder and add it to Classes group.Ĭreate the new class from the "Objective-C class" template. Then remove the "main.c" file from the project. Add the "amework" either by drag-n-dropping it from Finder or via "Project/Add FrameWorks." menu. In ist entries/Cocoa Specific, set the Principal class to "SampleMenuExtra".In ist entries/Basic Information, set Identifier to something like "com.M圜ompany.SampleMenu".In Settings/Expert View, change the "WRAPPER_EXTENSION" from "bundle" to "menu".We need to tune some parameters, so select the "Targets" tab and click the "Sample" target. Now we have the API to the NSMenuExtra (and the whole SystemUIPlugin) private framework.Ĭreate a new ProjectBuilder project using the Cocoa Bundle template. They should be: - initWithFrame:(NSRect)fp12 menuExtra:fp28 Replace the "expanded" struct _NSRect types in the initWithFrame and drawRect methods of NSMenuExtraView class.Remove the "?" sign in the struct declarations in the NSMenuExtra and NSDockExtra interfaces.First, add the #import just under the comments. Open it in Project Builder and look at its nice content. We need to do some editing before it will be compilable. You would find the "SystemUIPlugin.h" file in it. Run this command, and check inside your home folder. If you put the "class-dump" binary inside the /Applications folder, then the command line would be /Applications/class-dump -e /System/Library/PrivateFrameworks/amework/Versions/A/SystemUIPlugin > SystemUIPlugin.h. The class-dump is a command-line utility, so we will run it in terminal. To obtain this framework API, we would use very useful class-dump utility by Steve Nygard. Objective-C keeps plenty of information about class names, inheritance, methods, e.t.c., so it is possible to get this information from the compiled binary. The NSMenuExtra class resides in the SustemUIPlugin private framework.
#Menumeters tutorial code#
You will definitly want to look at their source code at a later time to learn more about the NSMenuExtra functionality. Another drawback, they are all distributed under GNU License, making it impossible for shareware/commercial developer to use their source code. They are very valuable examples, but personaly I've found that they are a bit too complex for the beginner.

Although not as convinient and powerful as NSMenuExtra (you can not Command-drag to rearrange or remove NSStatusItem, you have to have a running application to keep it in the menu bar, e.t.c.), it is still documented (at least partialy) and recommended way.

#Menumeters tutorial software#
Where are no any guarantees what this software would work in the following major MacOS X versions. This is the software which is using private, undocumented MacOS X API.

By Rustam Muginov // What you should understand before creating a MenuExtra
