else if ( kind == kEventMenuTargetItem ) {  MenuRef menuRef; ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef); gCurrentlyTrackedMenuID = ::GetMenuID(menuRef); }
static pascal OSStatus MyMenuEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData){  OSStatus result = eventNotHandledErr;  UInt32 kind = ::GetEventKind(event);  if (kind == kEventMenuOpening || kind == kEventMenuClosed) {    nsISupports* supports = reinterpret_cast<nsISupports*>(userData);    nsCOMPtr<nsIMenuListener> listener(do_QueryInterface(supports));    if (listener) {      MenuRef menuRef;      ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef);      nsMenuEvent menuEvent;      menuEvent.message = NS_MENU_SELECTED;      menuEvent.eventStructType = NS_MENU_EVENT;      menuEvent.point.x = 0;      menuEvent.point.y = 0;      menuEvent.widget = nsnull;      menuEvent.time = PR_IntervalNow();      menuEvent.mCommand = (PRUint32) menuRef;      if (kind == kEventMenuOpening)        listener->MenuSelected(menuEvent);      else        listener->MenuDeselected(menuEvent);    }  }    return result;}