kHighLevelEvent = 23 # Don't know what header file this should come from
SCROLLBARWIDTH = 16 # Again, not a clue...
+# Trick to forestall a set of SIOUX menus being added to our menubar
+SIOUX_APPLEMENU_ID=32000
+
# Map event 'what' field to strings
eventname = {}
self.bar = None
self.menus = None
- def addmenu(self, title, after = 0):
- id = self.getnextid()
+ def addmenu(self, title, after = 0, id=None):
+ if id == None:
+ id = self.getnextid()
if DEBUG: print 'Newmenu', title, id # XXXX
m = NewMenu(id, title)
m.InsertMenu(after)
class Menu:
"One menu."
- def __init__(self, bar, title, after=0):
+ def __init__(self, bar, title, after=0, id=None):
self.bar = bar
- self.id, self.menu = self.bar.addmenu(title, after)
+ self.id, self.menu = self.bar.addmenu(title, after, id)
bar.menus[self.id] = self
self.items = []
self._parent = None
class AppleMenu(Menu):
def __init__(self, bar, abouttext="About me...", aboutcallback=None):
- Menu.__init__(self, bar, "\024")
+ Menu.__init__(self, bar, "\024", id=SIOUX_APPLEMENU_ID)
if MacOS.runtimemodel == 'ppc':
self.additem(abouttext, None, aboutcallback)
self.addseparator()
PyMac_InitMenuBar()
{
MenuHandle applemenu;
+ Str255 about_text;
+ static unsigned char about_sioux[] = "\pAbout SIOUX";
if ( sioux_mbar ) return;
#if 0
return;
}
if ( (applemenu=GetMenuHandle(SIOUX_APPLEID)) == NULL ) return;
- SetMenuItemText(applemenu, 1, "\pAbout Python...");
+ GetMenuItemText(applemenu, 1, about_text);
+ if ( about_text[0] == about_sioux[0] &&
+ strncmp((char *)(about_text+1), (char *)(about_sioux+1), about_text[0]) == 0 )
+ SetMenuItemText(applemenu, 1, "\pAbout Python...");
}
/*