home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / MUI / MUIBuilder22.lha / MUIBuilder / MB / M2 / M2Mui / MBMuiMacros.def < prev    next >
Encoding:
Modula Definition  |  1994-11-30  |  14.3 KB  |  458 lines

  1. DEFINITION MODULE MuiMacros;
  2.  
  3. (****************************************************************************
  4. **
  5. **      MUI Macros 2.0
  6. **
  7. **      Converted to Modula by Christian "Kochtopf" Scholz
  8. **
  9. **      refer also to MuiMacros.mod if you want to know, how they are made.
  10. **
  11. **      $Id: MuiMacros.def,v 1.8mb 1994/11/30 Stefan Schulz Exp $
  12. **
  13. **      $Log: MuiMacros.def,v $
  14. |
  15. | Revision 1.8mb \30.11.1994\ by Stefan Schulz
  16. | Special Version for GenCodeM2:
  17. | - no dividing between MUIObsolete and non-MUIObsolete
  18. | - only Localized Functioncalls
  19. |
  20. # Revision 1.8  1994/08/18  18:52:20  Kochtopf
  21. # changed popbutton
  22. #
  23. # Revision 1.7  1994/08/11  16:59:45  Kochtopf
  24. # *** empty log message ***
  25. #
  26. # Revision 1.6  1994/06/27  22:06:41  Kochtopf
  27. # put some Macros in MUIObsolete-Parenthesis, because one should
  28. # now use mMakeObj.
  29. #
  30. # Revision 1.5  1994/02/15  21:14:05  Kochtopf
  31. # neue Macros fuer Pop* und Register definiert,
  32. # HCenter und VCenter neu
  33. # PopUp entfernt und durch PopButton ersetzt.
  34. # neue Label-Macros LLabel eingefuehrt (aus mui.h)
  35. #
  36. # Revision 1.4  1994/02/09  14:50:03  Kochtopf
  37. # Versionsnummer in 2.0 geaendert.
  38. #
  39. **
  40. ****************************************************************************
  41. ** Class Tree
  42. ****************************************************************************
  43. **
  44. ** rootclass               (BOOPSI's base class)                      
  45. ** +--Notify               (implements notification mechanism)        
  46. **    +--Family            (handles multiple children)                
  47. **    !  +--Menustrip      (describes a complete menu strip)          
  48. **    !  +--Menu           (describes a single menu)                  
  49. **    !  \--Menuitem       (describes a single menu item)             
  50. **    +--Application       (main class for all applications)          
  51. **    +--Window            (handles intuition window related topics)  
  52. **    +--Area              (base class for all GUI elements)          
  53. **       +--Rectangle      (creates (empty) rectangles)               
  54. **       +--Image          (creates images)                           
  55. **       +--Text           (creates some text)                        
  56. **       +--String         (creates a string gadget)                  
  57. **       +--Prop           (creates a proportional gadget)            
  58. **       +--Gauge          (creates a fule gauge)                     
  59. **       +--Scale          (creates a percentage scale)               
  60. **       +--Boopsi         (interface to BOOPSI gadgets)              
  61. **       +--Colorfield     (creates a field with changeable color)    
  62. **       +--List           (creates a line-oriented list)             
  63. **       !  +--Floattext   (special list with floating text)          
  64. **       !  +--Volumelist  (special list with volumes)                
  65. **       !  +--Scrmodelist (special list with screen modes)           
  66. **       !  \--Dirlist     (special list with files)                  
  67. **       +--Group          (groups other GUI elements)                
  68. **          +--Register    (handles page groups with titles)          
  69. **          +--Virtgroup   (handles virtual groups)                   
  70. **          +--Scrollgroup (handles virtual groups with scrollers)    
  71. **          +--Scrollbar   (creates a scrollbar)                      
  72. **          +--Listview    (creates a listview)                       
  73. **          +--Radio       (creates radio buttons)                    
  74. **          +--Cycle       (creates cycle gadgets)                    
  75. **          +--Slider      (creates slider gadgets)                   
  76. **          +--Coloradjust (creates some RGB sliders)                 
  77. **          +--Palette     (creates a complete palette gadget)        
  78. **          +--Colorpanel  (creates a panel of colors)                
  79. **          +--Popstring   (base class for popups)                    
  80. **             +--Popobject(popup a MUI object in a window)           
  81. **             \--Popasl   (popup an asl requester)
  82. **
  83. ***************************************************************************)
  84.  
  85. IMPORT  MD:MuiD;
  86. IMPORT  ML:MuiL;
  87. IMPORT  UD:UtilityD;
  88. FROM    MuiD     IMPORT APTR, StrPtr;
  89. FROM    UtilityD IMPORT HookPtr;
  90. FROM    SYSTEM IMPORT ADDRESS, ADR, TAG;
  91.  
  92. TYPE    ShortString = ARRAY[0..3] OF CHAR;  (* for MakeID *)
  93.  
  94.         (* Here some Types you have to use, IF you want to fill the
  95.            array, the ListDisplayHook gets as parameter and which the hook
  96.            has to fill *)
  97.  
  98.         STRING      = ARRAY[0..128] OF CHAR;
  99.         STRPTR      = POINTER TO STRING;
  100.         STRARR      = ARRAY[0..10] OF STRPTR; (* set 10 to the number of columns you have in your list *)
  101.         STRARRPTR   = POINTER TO STRARR;
  102.  
  103.         (* Use it the following way :
  104.  
  105.         Your Hookfunction :
  106.  
  107.         PROCEDURE dspfunc(hook : HookPtr; array : APTR; entry : APTR) : APTR;
  108.  
  109.             BEGIN
  110.                 CAST(STRARRPTR,array)^[0]:=ADR(first string);
  111.                 CAST(STRARRPTR,array)^[1]:=ADR(second string);
  112.                 ...
  113.                 RETURN 0;
  114.             END dspfunc;
  115.  
  116.         As you see, it is the same as string-arrays in C  *)
  117.  
  118.  
  119.         (* Here your PROCEDURE-Prototype for your hookfunction : *)
  120.  
  121.         HookDef     = PROCEDURE(HookPtr, APTR, APTR):APTR;
  122.  
  123. (*
  124. **  MUI - Object Generation
  125. **
  126. **  These Macros are equal to the C-Macros which can be found in mui.h
  127. **  But notice, that you have a different usage of these :
  128. **
  129. **  Instead of
  130. **
  131. **      app = ApplicationObject,
  132. **
  133. **              ...
  134. **
  135. **            End;
  136. **
  137. **  you now write :
  138. **
  139. **      app := ApplicationObject(TAG(buffer,    (* TAG from SYSTEM *)
  140. **
  141. **              ...
  142. **
  143. **             tagEnd));    (* tagEnd imported from UtilityD *)
  144. **
  145. **  Also you can't use :
  146. **
  147. **      app := ApplicationObject(TAG(buffer,
  148. **
  149. **              ...
  150. **  ====>            window:=WindowObject(TAG(buffer, ... , tagEnd)),
  151. **              ...
  152. **
  153. **             tagEnd));
  154. **
  155. **  instead of this, you have to define your Window-Object before the
  156. **  Application-Object and then use the pointer in the App-Definition :
  157. **
  158. **      window := WindowObject(TAG(buffer, ... , tagEnd)),
  159. **
  160. **      app := ApplicationObject(TAG(buffer,
  161. **
  162. **              ...
  163. **                   window,
  164. **              ...
  165. **
  166. **             tagEnd));
  167. **
  168. **  So you can't define a whole application with one command if you need
  169. **  the pointer of some objects later on (for a Notify, etc.)
  170. **
  171. *)
  172.  
  173. CONST   Child           = MD.maGroupChild;
  174.         SubWindow       = MD.maApplicationWindow;
  175.         WindowContents  = MD.maWindowRootObject;
  176.  
  177. PROCEDURE WindowObject(tags : UD.TagItemPtr) : APTR;
  178. PROCEDURE ImageObject(tags : UD.TagItemPtr) : APTR;
  179. PROCEDURE NotifyObject(tags : UD.TagItemPtr) : APTR;
  180. PROCEDURE ApplicationObject(tags : UD.TagItemPtr) : APTR;
  181. PROCEDURE TextObject(tags : UD.TagItemPtr) : APTR;
  182. PROCEDURE RectangleObject(tags : UD.TagItemPtr) : APTR;
  183. PROCEDURE ListObject(tags : UD.TagItemPtr) : APTR;
  184. PROCEDURE PropObject(tags : UD.TagItemPtr) : APTR;
  185. PROCEDURE StringObject(tags : UD.TagItemPtr) : APTR;
  186. PROCEDURE ScrollbarObject(tags : UD.TagItemPtr) : APTR;
  187. PROCEDURE ListviewObject(tags : UD.TagItemPtr) : APTR;
  188. PROCEDURE RadioObject(tags : UD.TagItemPtr) : APTR;
  189. PROCEDURE VolumelistObject(tags : UD.TagItemPtr) : APTR;
  190. PROCEDURE FloattextObject(tags : UD.TagItemPtr) : APTR;
  191. PROCEDURE DirlistObject(tags : UD.TagItemPtr) : APTR;
  192. PROCEDURE SliderObject(tags : UD.TagItemPtr) : APTR;
  193. PROCEDURE CycleObject(tags : UD.TagItemPtr) : APTR;
  194. PROCEDURE GaugeObject(tags : UD.TagItemPtr) : APTR;
  195. PROCEDURE ScaleObject(tags : UD.TagItemPtr) : APTR;
  196. PROCEDURE BoopsiObject(tags : UD.TagItemPtr) : APTR;
  197. PROCEDURE ColorfieldObject(tags : UD.TagItemPtr) : APTR;
  198. PROCEDURE ColoradjustObject(tags : UD.TagItemPtr) : APTR;
  199. PROCEDURE PaletteObject(tags : UD.TagItemPtr) : APTR;
  200. PROCEDURE GroupObject(tags : UD.TagItemPtr) : APTR;
  201. PROCEDURE VirtgroupObject(tags : UD.TagItemPtr) : APTR;
  202. PROCEDURE ScrollgroupObject(tags : UD.TagItemPtr) : APTR;
  203. PROCEDURE ScrmodelistObject(tags : UD.TagItemPtr) : APTR;
  204. PROCEDURE VGroup(tags : UD.TagItemPtr) : APTR;
  205. PROCEDURE HGroup(tags : UD.TagItemPtr) : APTR;
  206. PROCEDURE ColGroup(cols : LONGCARD; tags : UD.TagItemPtr) : APTR;
  207. PROCEDURE RowGroup(rows : LONGCARD; tags : UD.TagItemPtr) : APTR;
  208. PROCEDURE PageGroup(tags : UD.TagItemPtr) : APTR;
  209. PROCEDURE VGroupV(tags : UD.TagItemPtr) : APTR;
  210. PROCEDURE HGroupV(tags : UD.TagItemPtr) : APTR;
  211. PROCEDURE ColGroupV(cols : LONGCARD; tags : UD.TagItemPtr) : APTR;
  212. PROCEDURE RowGroupV(rows : LONGCARD; tags : UD.TagItemPtr) : APTR;
  213. PROCEDURE PageGroupV(tags : UD.TagItemPtr) : APTR;
  214. PROCEDURE PopString(tags : UD.TagItemPtr) : APTR;
  215. PROCEDURE PopObject(tags : UD.TagItemPtr) : APTR;
  216. PROCEDURE PopAsl(tags : UD.TagItemPtr) : APTR;
  217. PROCEDURE Register(tags : UD.TagItemPtr) : APTR;
  218. PROCEDURE MenuStripObject(tags : UD.TagItemPtr) : APTR;
  219. PROCEDURE MenuObject(tags : UD.TagItemPtr) : APTR;
  220. PROCEDURE MenuObjectT(name : StrPtr; tags : UD.TagItemPtr) : APTR;
  221. PROCEDURE MenuItemObject(tags : UD.TagItemPtr) : APTR;
  222.  
  223.  
  224. (*
  225. **  MakeID
  226. **  Generate an ID out of a 4-char-string.
  227. **  Use it the as WindowID ! (look in MuiTest for an example!)
  228. *)
  229.  
  230. PROCEDURE MakeID (name : ShortString): LONGINT;
  231.  
  232. (*
  233. **
  234. **  Hook Macros
  235. **
  236. **  Use it the following way :
  237. **      1. Write your Hook-Function :
  238. **          PROCEDURE hookfunc(hook:HookPtr; obj : APTR; args : APTR) : APTR
  239. **              BEGIN
  240. **              ...
  241. **              END hookfunc;
  242. **          Note, that your function needs not to specify registers, but
  243. **          your PROCEDURE must be looking like name(HookPtr, APTR, APTR)!!
  244. **
  245. **      2. Define in your VAR-section a pointer to a Hookrecord :
  246. **          VAR hook    : UtilitiesD.HookPtr;
  247. **
  248. **      3. fill it with MakeHook :
  249. **          MakeHook(hookfunc,hook);
  250. **
  251. **      4. Use it with MUI, as you like, e.g. :
  252. **          DoMethod(button,TAG(buffer,MD.mmCallHook,hook,arg1,arg2));
  253. **
  254. *)
  255.  
  256. PROCEDURE MakeHook(entry:HookDef; VAR hook : HookPtr);
  257.  
  258. (*
  259. **
  260. **  Spacing Macros
  261. **
  262. **  (not all from mui.h)
  263. **
  264. *)
  265.  
  266. PROCEDURE HVSpace() : APTR;
  267. PROCEDURE HSpace(x : LONGCARD) : APTR;
  268. PROCEDURE VSpace(x : LONGCARD) : APTR;
  269. PROCEDURE HCenter(obj : APTR) : APTR;
  270. PROCEDURE VCenter(obj : APTR) : APTR;
  271.  
  272. (*
  273. **
  274. **  Popup-Object
  275. **
  276. **
  277. *)
  278.  
  279. PROCEDURE PopButton(img : APTR) : APTR;
  280.  
  281.  
  282.  
  283. (*
  284. **
  285. ** String-Object
  286. **
  287. ** Creates a simple String-Gadget
  288. **
  289. *)
  290.  
  291. PROCEDURE String(contents : StrPtr; maxlen : LONGINT) : APTR;
  292. PROCEDURE KeyString(contents : StrPtr; maxlen : LONGINT; key : CHAR) : APTR;
  293.  
  294. (*
  295. **
  296. ** Checkmark
  297. **
  298. ** creates a Checkmark Gadget
  299. **
  300. *)
  301.  
  302. PROCEDURE Checkmark(selected : BOOLEAN) : APTR;
  303. PROCEDURE KeyCheckmark(selected : BOOLEAN; key : CHAR) : APTR;
  304.  
  305. (*
  306. **
  307. ** Buttons
  308. **
  309. ** Here the same note : Use small letters for Keybuttons!
  310. **
  311. *)
  312.  
  313. PROCEDURE Keybutton(name : StrPtr; key : CHAR) : APTR;
  314. PROCEDURE Simplebutton(name : StrPtr) : APTR;
  315.  
  316.  
  317. (*
  318. **
  319. **  Radio Object
  320. **
  321. *)
  322.  
  323. PROCEDURE Radio(name : StrPtr; array : APTR) : APTR;
  324. PROCEDURE KeyRadio(name : StrPtr; array : APTR; key : CHAR) : APTR;
  325.  
  326.  
  327. (*
  328. **
  329. **  Cycle-Objects
  330. **
  331. *)
  332.  
  333. PROCEDURE Cycle(array : APTR) : APTR;
  334. PROCEDURE KeyCycle(array : APTR; key : CHAR) : APTR;
  335.  
  336. (*
  337. **
  338. **  Slider-Objects
  339. **
  340. *)
  341.  
  342. PROCEDURE Slider(min, max, level : LONGINT; horiz : BOOLEAN) : APTR;
  343. PROCEDURE KeySlider(min, max, level : LONGINT; horiz : BOOLEAN; key : CHAR) : APTR;
  344.  
  345.  
  346. (*
  347. **
  348. ** Label Objects
  349. **
  350. ** The same as in mui.h
  351. **
  352. ** Label()  : create a Label for Objects without a frame
  353. ** Label1() : create a label for Objects with a standard frame (Checkmarks...)
  354. ** Label2() : create a label for Objects with double high frame (String Gadgets...)
  355. **
  356. *)
  357.  
  358. PROCEDURE Label(label : StrPtr) : APTR;
  359. PROCEDURE Label1(label : StrPtr) : APTR;
  360. PROCEDURE Label2(label : StrPtr) : APTR;
  361. PROCEDURE LLabel(label : StrPtr) : APTR;
  362. PROCEDURE LLabel1(label : StrPtr) : APTR;
  363. PROCEDURE LLabel2(label : StrPtr) : APTR;
  364. PROCEDURE KeyLabel(label : StrPtr; HiChar : CHAR) : APTR;
  365. PROCEDURE KeyLabel1(label : StrPtr; HiChar : CHAR) : APTR;
  366. PROCEDURE KeyLabel2(label : StrPtr; HiChar : CHAR) : APTR;
  367. PROCEDURE KeyLLabel(label : StrPtr; HiChar : CHAR) : APTR;
  368. PROCEDURE KeyLLabel1(label : StrPtr; HiChar : CHAR) : APTR;
  369. PROCEDURE KeyLLabel2(label : StrPtr; HiChar : CHAR) : APTR;
  370.  
  371. (*
  372. **
  373. ** Controlling Objects
  374. **
  375. ** Again the same as in mui.h :
  376. **
  377. ** set : set an attribute of an object
  378. ** get : get an attribute of an object
  379. **       didn't work in previous releases :-( (but now!! :-)
  380. **
  381. *)
  382.  
  383. PROCEDURE get(obj : APTR; attr : LONGCARD; store : ADDRESS);
  384. PROCEDURE set(obj : APTR; attr : LONGCARD; value : LONGINT);
  385. PROCEDURE nnset(obj : APTR; attr : LONGCARD; value : LONGINT); (* || added || *)
  386. PROCEDURE setmutex(obj : APTR; n : LONGINT);
  387. PROCEDURE setcycle(obj : APTR; n : LONGINT);
  388. PROCEDURE setstring(obj : APTR; s : StrPtr);
  389. PROCEDURE setcheckmark(obj : APTR; b : BOOLEAN);
  390. PROCEDURE setslider(obj : APTR; l : LONGINT);
  391.  
  392. (*
  393. ** Now some macros which are not part of mui.h (in other words : my own ;-)
  394. **
  395. ** First : NoteClose (app,obj,ID)
  396. **         ----------------------
  397. **         This macro sets up a notification on the close-gadget of a window.
  398. **         if it gets pressed, the app-obj gets back an ID
  399. **         app : the application-object, which will receive the ID
  400. **         obj : the window-object
  401. **         ID  : the ID, which will be send to the app-obj, when the user
  402. **               presses the close-gadget of the window-object specified in
  403. **               obj.
  404. *)
  405.  
  406. PROCEDURE NoteClose(app : APTR;
  407.                     obj : APTR;
  408.                     ID  : LONGINT);
  409.  
  410. (*
  411. **  Notebutton (app,obj,ID)
  412. **  -----------------------
  413. **  Sets up a notification on a button. If it gets pressed, the app-obj
  414. **  receives an ID.
  415. **  app : the app-obj, which will receive the ID.
  416. **  obj : the pointer to the Button-Object (created by Keybutton, etc.)
  417. **  ID  : The ID, which will be send to the app-obj.
  418. **
  419. *)
  420.  
  421. PROCEDURE NoteButton(app : APTR;
  422.                      obj : APTR;
  423.                      ID  : LONGINT);
  424.  
  425. (*
  426. ** RemMember (obj,member)
  427. ** ----------------------
  428. ** The following macro deletes a member from an object
  429. **
  430. ** obj      : The object which holds the child to remove
  431. ** member   : The child which shall be removed
  432. ** ATTENTION: You have to dispose the removed child-objects yourself!
  433. **
  434. *)
  435.  
  436. PROCEDURE RemMember(obj : APTR; member : APTR);
  437.  
  438. (*
  439. ** AddMember (obj,member)
  440. ** ----------------------
  441. ** This macro will add a new child to an group-  or application-object
  442. **
  443. ** obj      : The group or application to which the new object will be added
  444. ** member   : The new child-object which shall be added to obj.
  445. **
  446. *)
  447.  
  448. PROCEDURE AddMember(obj : APTR; member : APTR);
  449.  
  450. END MuiMacros.
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.