From db9ff36ad9944deed06eb2abb511ca972d4b0807 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Tue, 12 Mar 1996 13:32:03 +0000 Subject: Added checkmenu() method (to checkmark an entry) and delete() method to remove a menu. --- Mac/Lib/FrameWork.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Mac/Lib/FrameWork.py b/Mac/Lib/FrameWork.py index bbf1448..504e9dc 100644 --- a/Mac/Lib/FrameWork.py +++ b/Mac/Lib/FrameWork.py @@ -371,10 +371,15 @@ class MenuBar: def addmenu(self, title, after = 0): id = self.getnextid() + print 'Newmenu', title, id # XXXX m = NewMenu(id, title) m.InsertMenu(after) DrawMenuBar() return id, m + + def delmenu(self, id): + print 'Delmenu', id # XXXX + DeleteMenu(id) def addpopup(self, title = ''): return self.addmenu(title, -1) @@ -401,6 +406,14 @@ class Menu: self.id, self.menu = self.bar.addmenu(title, after) bar.menus[self.id] = self self.items = [] + + def delete(self): + self.bar.delmenu(self.id) + del self.bar.menus[self.id] + del self.bar + del self.items + del self.menu + del self.id def additem(self, label, shortcut=None, callback=None, kind=None): self.menu.AppendMenu('x') # add a dummy string @@ -436,6 +449,11 @@ class Menu: class MenuItem: def __init__(self, menu, title, shortcut=None, callback=None, kind=None): self.item = menu.additem(title, shortcut, callback) + self.menu = menu + + def check(self, onoff): + self.menu.menu.CheckItem(self.item, onoff) + class RadioItem(MenuItem): def __init__(self, menu, title, shortcut=None, callback=None): -- cgit v0.12