summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-03-12 13:32:03 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-03-12 13:32:03 (GMT)
commitdb9ff36ad9944deed06eb2abb511ca972d4b0807 (patch)
treeeb1cc7200ec4d22ec933215a6cc5f29dfddc36e8 /Mac
parente355c4568f30b720c714d999ffb621b5bd83c137 (diff)
downloadcpython-db9ff36ad9944deed06eb2abb511ca972d4b0807.zip
cpython-db9ff36ad9944deed06eb2abb511ca972d4b0807.tar.gz
cpython-db9ff36ad9944deed06eb2abb511ca972d4b0807.tar.bz2
Added checkmenu() method (to checkmark an entry) and delete() method
to remove a menu.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Lib/FrameWork.py18
1 files changed, 18 insertions, 0 deletions
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):