Menu Extras, Preference Panes, and HIServices.framework
Menu Extras, Preference Panes, and HIServices.framework
- Subject: Menu Extras, Preference Panes, and HIServices.framework
- From: Chris Boot <email@hidden>
- Date: Sun, 28 Oct 2001 03:58:36 +0100
Hi,
I've written a Menu Extra which is working just fine. I've also implemented
a System Preferences prefs pane to control the menu extra.
I used gdb, nm, and otool to figure out how the Sound panel (and others)
were showing, removing, and getting the status of their Menu Extras, and
found out a great deal about it, but my poor knowledge of assembly has got
me stuck.
I've included a header file which I hacked up which shows what I've got so
far. I would appreciate it if someone could please help me (and eventually
others) to get this interface working properly.
If only there was a class-dump for plain old C code...
>
>> BEGIN QUOTED FILE: CoreMenuExtra.h
/*
* $Id: CoreMenuExtra.h,v 1.1.1.1 2001/10/28 01:55:29 bootc Exp $
* SysMenu: CoreMenuExtra.h
*
* Created by bootc on Sun Oct 28 2001.
* Copyright (c) 2001 The Macintosh Developer Center. All rights reserved.
*
* Reverse-engineered (using gdb, otool, and nm) functions present in
* HIServices.framework for dealing with Menu Extras. What a mess...
*
* I'm no expert in assembly code. In fact, I know almost nothing about
it,
* so if someone can help me out I'd be very grateful. In effect, I don't
* know exactly how many parameters there are for these functions and
exactly
* what they do, nor am I sure of the return types.
*/
#include <CoreFoundation/CoreFoundation.h>
/*
* MenuExtraRef
*
* Discussion:
* From what I can figure out, this seems to be an opaque type with no
* ties to real memory (as in, an index in a private array/hashtable).
*/
typedef struct OpaqueMenuExtraRef *MenuExtraRef;
/*
* CoreMenuExtraAddMenuExtra()
*
* Discussion:
* This routine inserts a Menu Extra into the menu bar.
*
* Parameters:
*
* inURL:
* The URL to the Menu Extra to add.
*
* inAfterItem:
* The index after which item you want it inserted (0: leftmost, 1:
next
* one along, -1: last one (after clock));
*
* Result:
* If the Menu Extra is already in the menu bar, this returns memFullErr.
* I don't know about any other error codes, but I'm sure they exist.
*/
OSStatus CoreMenuExtraAddMenuExtra(
CFURLRef inURL,
SInt32 inAfterItem);
/*
* CoreMenuExtraGetMenuExtra()
*
* Discussion:
* Gets a reference to a Menu Extra in the menu bar.
*
* Parameters:
*
* inIdentifier:
* The bundle identifer of the Menu Extra to fetch.
*
* outMenuExtra:
* A reference to the menu extra. Doesn't seem to have any significant
* value. NULL if not present in menu bar.
*
* Result:
* This returns noErr even if the Menu Extra is not present, in which
case
* outMenuExtra will be NULL.
*/
OSStatus CoreMenuExtraGetMenuExtra(
CFStringRef inIdentifier,
MenuExtraRef * outMenuExtra);
/*
* CoreMenuExtraRemoveMenuExtra()
*
* Discussion:
* Removes a Menu Extra from the menu bar.
*
* Parameters:
*
* inMenuExtra:
* The Menu Extra to remove.
*
* Result:
* The only error code I've seen here is noErr. It crashes if you pass
it
* an invalid reference.
*/
OSStatus CoreMenuExtraRemoveMenuExtra(
MenuExtraRef inMenuExtra);
>
>> END QUOTED FILE
PS: Sorry about the cross-post, but I thought it was appropriate. If you
think I should ask this question elsewhere, please direct me where.
Thanks very much,
--
Chris Boot
email@hidden
Your mouse has moved. You must restart Windows NT
for this change to be recognized.