home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / MacInterface / menus.icl < prev    next >
Encoding:
Modula Implementation  |  1996-12-06  |  4.0 KB  |  149 lines  |  [TEXT/3PRM]

  1. implementation module menus;
  2.  
  3. import mac_types;
  4.  
  5. //    Initialization and Allocation
  6.  
  7. InitMenus :: !Toolbox -> Toolbox;
  8. InitMenus t = code (t=U)(z=Z){
  9.     instruction 0xA930
  10. };
  11.  
  12. NewMenu :: !Int !{#Char} !Toolbox -> (!MacMenuHandle,!Toolbox);
  13. NewMenu menuID menuTitle t = code (menuID=R4W,menuTitle=S,t=U)(newMenuHandle=L,z=Z){
  14.     instruction 0xA931
  15. };
  16.  
  17. DisposeMenu :: !MacMenuHandle !Toolbox -> Toolbox;
  18. DisposeMenu theMenu t = code (theMenu=L,t=U)(z=Z){
  19.     instruction 0xA932
  20. };
  21.  
  22. //    Forming the menus
  23.  
  24. AppendMenu :: !MacMenuHandle !{#Char} !Toolbox -> Toolbox;
  25. AppendMenu theMenu data t = code (theMenu=L,data=S,t=U)(z=Z){
  26.     instruction 0xA933
  27. };
  28.  
  29. AddResMenu :: !MacMenuHandle !Int !Toolbox -> Toolbox;
  30. AddResMenu theMenu theType t = code (theMenu=L,theType=L,t=U)(z=Z){
  31.     instruction 0xA94D
  32. };
  33.  
  34. //    Forming the Menu Bar
  35.  
  36. InsertMenu :: !MacMenuHandle !Int !Toolbox -> Toolbox;
  37. InsertMenu theMenu beforeID t = code (theMenu=L,beforeID=W,t=U)(z=Z){
  38.     instruction 0xA935
  39. };
  40.  
  41. ClearMenuBar :: !Toolbox -> Toolbox;
  42. ClearMenuBar t = code (t=U)(z=Z){
  43.     instruction 0xA934
  44. };
  45.  
  46. DrawMenuBar :: !Toolbox -> Toolbox;
  47. DrawMenuBar t = code (t=U)(z=Z){
  48.     instruction 0xA937
  49. };
  50.  
  51. DeleteMenu :: !Int !Toolbox -> Toolbox;
  52. DeleteMenu menuID t = code (menuID=W,t=U)(z=Z){
  53.     instruction 0xA936
  54. };
  55.  
  56. CalcMenuSize :: !MacMenuHandle !Toolbox -> Toolbox;
  57. CalcMenuSize theMenu t = code (theMenu=L,t=U)(z=Z){
  58.     instruction 0xA948
  59. };
  60.  
  61. GetMHandle :: !Int !Toolbox -> (!MacMenuHandle,!Toolbox);
  62. GetMHandle menuID t = code (menuID=R4W,t=U)(menu_handle=L,z=Z){
  63.     instruction 0xA949
  64. };
  65.  
  66. GetMenuBar :: !Toolbox -> (!Handle,!Toolbox);
  67. GetMenuBar t = code (t=R4U)(menu_list=L,z=Z){
  68.     instruction 0xA93B
  69. };
  70.  
  71. SetMenuBar :: !Handle !Toolbox -> Toolbox;
  72. SetMenuBar menu_list t = code (menu_list=L,t=U)(z=Z){
  73.     instruction 0xA93C
  74. };
  75.  
  76. InsMenuItem :: !MacMenuHandle !{#Char} !Int !Toolbox -> Toolbox;
  77. InsMenuItem theMenu itemString afterItem t = code (theMenu=L,itemString=S,afterItem=W,t=U)(z=Z){
  78.     instruction 0xA826
  79. };
  80.  
  81. DelMenuItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
  82. DelMenuItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
  83.     instruction 0xA952
  84. };
  85.  
  86. //    Choosing From a Menu
  87.  
  88. MenuSelect :: !Int !Int !Toolbox -> (!Int,!Int,!Toolbox);
  89. MenuSelect h v t = code (h=R4W,v=W,t=U)(menu_ID=W,menu_item=W,z=Z){       
  90.     instruction 0xA93D
  91. };
  92.  
  93. MenuKey :: !Int !Toolbox -> (!Int,!Int,!Toolbox);
  94. MenuKey char t = code (char=R4W,t=U)(menu_ID=W,menu_item=W,z=Z){
  95.     instruction 0xA93E
  96. };
  97.  
  98. HiliteMenu :: !Int !Toolbox -> Toolbox;
  99. HiliteMenu menuID t = code (menuID=W,t=U)(z=Z){
  100.      instruction 0xA938
  101. };
  102.  
  103. PopUpMenuSelect :: !MacMenuHandle !Int !Int !Int !Toolbox -> (!Int,!Int,!Toolbox);
  104. PopUpMenuSelect menu top left popUpItem t = code (menu=R4L,top=W,left=W,popUpItem=W,t=U)(menu_ID=W,menu_item=W,z=Z){
  105.     instruction 0xA80B
  106. };
  107.  
  108. //    Controlling the Appearance of Items
  109.  
  110. SetItem :: !MacMenuHandle !Int !{#Char} !Toolbox -> Toolbox;
  111. SetItem theMenu item itemString t = code (theMenu=L,item=W,itemString=S)(z=Z){
  112.     instruction 0xA947
  113. };
  114.  
  115. GetItem :: !MacMenuHandle !Int !{#Char} !Toolbox -> (!{#Char},!Toolbox);
  116. GetItem theMenu item s tb = (GetItem1 theMenu item s tb, NewToolbox);
  117.  
  118. GetItem1 :: !MacMenuHandle !Int !{#Char} !Toolbox -> {#Char};
  119. GetItem1 theMenu item s t = code (theMenu=L,item=W,s=A0,t=U)(itemString=A0){
  120.     instruction 0x2808            ||    move.l    a0,d4
  121.     instruction 0x42A8 0x0004    ||    clr.l    4(a0)
  122.     instruction 0x4868 0x0007    ||    pea        7(a0)
  123.     instruction 0xA946
  124.     instruction    0x2044            ||    move.l    d4,a0
  125. };
  126.  
  127. DisableItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
  128. DisableItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
  129.     instruction 0xa93a
  130. };
  131.  
  132. EnableItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
  133. EnableItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
  134.     instruction 0xa939
  135. };
  136.  
  137. CheckItem :: !MacMenuHandle !Int !Bool !Toolbox -> Toolbox;
  138. CheckItem theMenu item checked t = code (theMenu=L,item=W,checked=D1,t=U)(z=Z){
  139.     instruction 0x1F01    ||    move.b d1,-(sp)
  140.     instruction 0xa945
  141. };
  142.  
  143. //    Miscellaneous Routines
  144.  
  145. CountMItems :: !MacMenuHandle !Toolbox -> (!Int,!Toolbox);
  146. CountMItems theMenu tb = code (theMenu=R2L,tb=U)(count=W,z=Z){
  147.     instruction 0xA950        |    _CountMItems
  148. };
  149.