home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / gui / guienv376.lha / GUIEnvironment / M2Amiga / Modules / GUIEnvD.def < prev    next >
Encoding:
Modula Definition  |  1994-12-18  |  14.8 KB  |  434 lines

  1. (****************************************************************************
  2.  
  3. $RCSfile: GUIEnvD.def $
  4.  
  5. $Revision: 1.7 $
  6.     $Date: 1994/12/18 12:03:13 $
  7.  
  8.     All type and const definition for GUIEnvironment
  9.  
  10.     M2Amiga Modula-2 Compiler V4.3
  11.  
  12.   Copyright © 1994, Carsten Ziegeler
  13.                     Augustin-Wibbelt-Str.7, 33106 Paderborn, Germany
  14.  
  15.  
  16. ****************************************************************************)
  17. DEFINITION MODULE GUIEnvD; (*$ Implementation:=FALSE *)
  18.  
  19.   FROM SYSTEM     IMPORT ADDRESS;
  20.   FROM ExecD      IMPORT MsgPortPtr;
  21.   FROM GraphicsD  IMPORT TextAttrPtr;
  22.   FROM IntuitionD IMPORT IDCMPFlagSet, ScreenPtr, WindowPtr, GadgetPtr,
  23.                          DrawInfoPtr, IntuiMessagePtr, MenuItemPtr;
  24.   FROM LocaleD    IMPORT CatalogPtr, LocalePtr;
  25.   FROM UtilityD   IMPORT HookPtr, TagItemPtr, tagUser;
  26. IMPORT R;
  27.  
  28.  
  29. (* ======================================================================= *)
  30. (*                               Error codes                               *)
  31. (* ======================================================================= *)
  32.  
  33. CONST
  34.  
  35.   geDone             =   0;   (* no error, everything done *)
  36.   geMemoryErr        =   1;   (* not enough memory *)
  37.   geWindowErr        =   2;   (* no window specified *)
  38.   geVisualInfoErr    =   3;   (* couldn't get VisualInfo *)
  39.   geDrawInfoErr      =   4;   (* couldn't get DrawInfo *)
  40.   geGuideErr         =  50;   (* couldn't display AmigaGuide node *)
  41.  
  42.   geGadContextErr    = 100;   (* GadTools CreateContext failed *)
  43.   geGadCreateErr     = 101;   (* error calling CreateGadget/NewObject *)
  44.   geGadTooManyErr    = 102;   (* more than 256 gadgets *)
  45.   geGadKeyTwiceErr   = 103;   (* same key equivalent for two gadgets *)
  46.   geGadUnknownKind   = 104;   (* unknown gadget kind *)
  47.   geGadChainErr      = 105;   (* ChainStart/ChainEnd missing *)
  48.   geGadHookErr       = 106;   (* Hook function failed *)
  49.  
  50.   geMenuCreateErr    = 200;   (* error calling CreateMenu *)
  51.   geMenuStripErr     = 201;   (* error calling SetMenuStrip *)
  52.   geMenuLayoutErr    = 202;   (* error calling LayoutMenus *)
  53.   geMenuTooManyErr   = 203;   (* more than 256 menu items *)
  54.  
  55.  
  56. (* ======================================================================= *)
  57. (*                         GE Hook functions                               *)
  58. (* ======================================================================= *)
  59.  
  60. (* The GUIEnvironment hook functions:
  61.    - The hook functions are implemented as amiga callback hooks as
  62.      documented in the Utilities documentation
  63.    - Before a hook functions is called, the A4 register is set
  64.    - The A0 register points to Hook structure
  65.    - The A1/A2 register are used as stated below
  66.  
  67. *)
  68.  
  69. (* ------------------------ return values -------------------------------- *)
  70.  
  71.   gehKeyShifted  = 512;
  72.   gehKeyUnknown  = -1;
  73.  
  74. (* ------------------------ The hook functions --------------------------- *)
  75.  
  76. TYPE
  77.  
  78.          (* Hook function for key equivalents:
  79.  
  80.               A1      : Currently unused, set to NIL
  81.               A2      : LONGINT : The ASCII character code
  82.               RESULT  : LONGINT : gehKeyUnknown if the key is not a key
  83.                                   equivalent or the number of the gadget,
  84.                                   or the number of the gadget plus
  85.                                   gehKeyShifted !
  86.  
  87.  
  88.             Handle message hook
  89.  
  90.               A1, A2  : Currently unused, set to NIL
  91.               RESULT  : LONGINT, handled as BOOLEAN
  92.                         Return TRUE, if GUIEnv should not work on the
  93.                         message anymore, otherwise FALSE
  94.  
  95.  
  96.             Refresh hook
  97.  
  98.               A1, A2  : Currently unused, set to NIL
  99.               RESULT  : Currently unused, set this always to 0 !
  100.  
  101.  
  102.             Gadget event message hook
  103.  
  104.               A2      : Pointer to event gadget
  105.               A1      : Currently unused, set to NIL
  106.               RESULT  : LONGINT, handled as BOOLEAN
  107.                         If you want to wait for further messages return
  108.                         TRUE, otherwise FALSE to exit the message-loop.
  109.  
  110.  
  111.             Menu event message hook
  112.  
  113.               A2      : Pointer to event menu item (if possible)
  114.               A1      : Currently unused, set to NIL
  115.               RESULT  : LONGINT, handled as BOOLEAN
  116.                         If you want to wait for further messages return
  117.                         TRUE, otherwise FALSE to exit the message-loop.
  118.  
  119.  
  120.             Gadget creation hook
  121.  
  122.               A2      : Pointer to event gadget
  123.               A1      : Currently unused, set to NIL
  124.               RESULT  : LONGINT, handled as BOOLEAN
  125.                         If your creation hook has done his work, return
  126.                         TRUE, otherwise FALSE to stop creation !
  127.  
  128. *)
  129.  
  130. (* ======================================================================= *)
  131. (*                               Gadgets                                   *)
  132. (* ======================================================================= *)
  133.  
  134. CONST
  135. (* ----------------------- gadget kinds ---------------------------------- *)
  136.  
  137.   gegKinds                 =  65535; (* GUIEnv gadgets *)
  138.   gegProgressIndicatorKind =  65536;
  139.   gegBevelboxKind          =  65537;
  140.   gegBorderKind            =  65538;
  141.  
  142.   gegBOOPSIKinds           = 131071; (* BOOPSI gadgets *)
  143.   gegBOOPSIPublicKind      = 131072;
  144.   gegBOOPSIPrivateKind     = 131073;
  145.  
  146. (* ----------------------- gadget chain flags ---------------------------- *)
  147.  
  148. TYPE
  149.   GEGChainFlags = (gegChainUpNext, gegChainUpPrev, gegChainDownNext,
  150.                    gegChainDownPrev, gengcf4, gengcf5, gengcf6,
  151.                    gengcf7, gengcf8);
  152.  
  153.   GEGChainFlagSet = SET OF GEGChainFlags;  (* 16 bits *)
  154.  
  155. (* ----------------------- gadget description flags ---------------------- *)
  156.  
  157. CONST
  158.   gegDistNorm    =  0;  (* Normal distance *)
  159.   gegDistAbs     =  1;  (* absolute distance from an object *)
  160.   gegDistRel     =  2;  (* relative distance from an object *)
  161.   gegDistPercent =  3;  (* percentual distance *)
  162.  
  163.   gegObjBorder   =  0;  (* window border *)
  164.   gegObjGadget   =  4;  (* gadget (standard is previous gadget) *)
  165.  
  166.   gegObjRight    =  0;  (* distance from which part of the object *)
  167.   gegObjBottom   =  0;
  168.   gegObjLeft     = 32;
  169.   gegObjTop      = 32;
  170.  
  171. (* ----------------------- gadget tag values ----------------------------- *)
  172.  
  173.   gegACTIVATIONUP  =  0;
  174.   gegACTIVATIONDOWN=  1;
  175.  
  176.  
  177.   gegALLGADGETS    = -1;
  178.  
  179. (* ----------------------- gadget tags ----------------------------------- *)
  180.  
  181.   gegBase = tagUser + 016000H;
  182.   gegText            = gegBase +  1;
  183.   gegFlags           = gegBase +  2;
  184.   gegFont            = gegBase +  3;
  185.   gegUserData        = gegBase +  4;
  186.   gegDescription     = gegBase +  5;
  187.   gegObjects         = gegBase +  6;
  188.   gegGuideNode       = gegBase +  7;
  189.   gegCatalogString   = gegBase + 10;
  190.   gegClass           = gegBase + 11;
  191.   gegVarAddress      = gegBase + 12;
  192.   gegHandleInternal  = gegBase + 13;
  193.   gegStartChain      = gegBase + 14;
  194.   gegEndChain        = gegBase + 15;
  195.   gegActivate        = gegBase + 16;
  196.   gegChainActivation = gegBase + 17;
  197.   gegStatus          = gegBase + 19;
  198.   gegUpAHook         = gegBase + 20;
  199.   gegDownAHook       = gegBase + 21;
  200.   gegCreationAHook   = gegBase + 22;
  201.  
  202.   gegPIMaxValue      = gegBase + 50;
  203.   gegPICurrentValue  = gegBase + 51;
  204.   gegBBRecessed      = gegBase + 52;
  205.  
  206.   gegDisable         = gegBase + 100;
  207.   gegEnable          = gegBase + 101;
  208.   gegSetVar          = gegBase + 102;
  209.   gegGetVar          = gegBase + 103;
  210.   gegActivateUp      = gegBase + 104;
  211.   gegActivateDown    = gegBase + 105;
  212.  
  213.   gegAddress         = gegBase + 200;
  214.   gegLeftEdge        = gegBase + 201;
  215.   gegTopEdge         = gegBase + 202;
  216.   gegWidth           = gegBase + 203;
  217.   gegHeight          = gegBase + 204;
  218.   gegRedraw          = gegBase + 205;
  219.  
  220.  
  221. (* ----------------------- GUIGadgetInfo structure ------------------------ *)
  222.  
  223. TYPE
  224.  
  225.   GUIGadgetInfoPtr = POINTER TO GUIGadgetInfo; (* gadget^.userData *)
  226.  
  227.   GUIGadgetInfo = RECORD  (* a pointer to this structure is stored in
  228.                              gadget^.userData *)
  229.     userData : ADDRESS;   (* use this for own user data *)
  230.     kind     : LONGINT;   (* gadget kind *)
  231.  
  232.     gadgetClass : ADDRESS;(* The BOOPSI Gadget Class *)
  233.  
  234.     functionUp   : HookPtr;
  235.     functionDown : HookPtr;
  236.  
  237.     guideNode: ADDRESS;   (* The AmigaGuide node for this gadget *)
  238.  
  239.   END;
  240.  
  241. (* ======================================================================= *)
  242. (*                             Menu Items                                  *)
  243. (* ======================================================================= *)
  244.  
  245. CONST
  246. (* ---------------------- menu item tags --------------------------------- *)
  247.  
  248.   gemBase = tagUser + 018000H;
  249.   gemUserData        = gemBase + 1;
  250.   gemGuideNode       = gemBase + 3;
  251.   gemCatalogString   = gemBase + 4;
  252.   gemShortCut        = gemBase + 5;
  253.   gemFlags           = gemBase + 6;
  254.   gemMutualExclude   = gemBase + 7;
  255.   gemAHook           = gemBase + 8;
  256.  
  257. (* ---------------------- GUIMenuInfo structure -------------------------- *)
  258.  
  259. TYPE
  260.  
  261.   GUIMenuInfoPtr = POINTER TO GUIMenuInfo; (* menu^.userData *)
  262.  
  263.   GUIMenuInfo = RECORD    (* a pointer to this structure is stored in
  264.                               menuitem^.userData *)
  265.     userData : ADDRESS;   (* use this for own user data *)
  266.  
  267.     function : HookPtr;
  268.  
  269.     guideNode: ADDRESS;   (* The AmigaGuide node for this menuitem *)
  270.  
  271.   END;
  272.  
  273.  
  274.  
  275. (* ======================================================================= *)
  276. (*                            GUIInfo                                      *)
  277. (* ======================================================================= *)
  278.  
  279. (* -------------------------- GUIInfo structure -------------------------- *)
  280.  
  281.   GUIInfoPtr = POINTER TO GUIInfo;
  282.   GUIInfo = RECORD
  283.     window     : WindowPtr;         (* pointer to the used Window *)
  284.     screen     : ScreenPtr;         (* pointer to window's screen *)
  285.     visualInfo : ADDRESS;           (* pointer to screen's VisualInfo *)
  286.     drawInfo   : DrawInfoPtr;       (* pointer to a copy of DrawInfo *)
  287.     localeInfo : LocalePtr;         (* pointer to locale environment *)
  288.  
  289.     menuFont : TextAttrPtr;         (* pointer to menu-font. Is set to
  290.                                        screens font. *)
  291.  
  292.     creationWidth  : INTEGER;       (* window inner width *)
  293.     creationHeight : INTEGER;       (* window inner height *)
  294.  
  295.     msgPort  : MsgPortPtr;          (* Pointer to IDCMP-Port *)
  296.  
  297.     intuiMsg : IntuiMessagePtr;     (* Points to a copy of the
  298.                                        FULL IntuiMessage even if it
  299.                                        is extended (OS3.0+) *)
  300.  
  301.  (* Additional information about the message: *)
  302.     msgClass : IDCMPFlagSet;
  303.  
  304.     msgCode     : INTEGER;
  305.     msgBoolCode : BOOLEAN;
  306.     msgCharCode : CHAR;
  307.  
  308.     msgGadget  : GadgetPtr;
  309.  
  310.     msgItemAdr : MenuItemPtr;
  311.  
  312.     msgGadNbr  : INTEGER;
  313.  
  314.     msgMenuNum : INTEGER;
  315.     msgItemNum : INTEGER;
  316.     msgSubNum  : INTEGER;
  317.  
  318.  (* Some user stuff: *)
  319.     userData      : ADDRESS;        (* for own data *)
  320.     compilerReg   : ADDRESS;        (* for compiler data reg *)
  321.  
  322.     gadgetGuide   : ADDRESS;        (* name & path for the guide *)
  323.     menuGuide     : ADDRESS;        (* name & path for the guide *)
  324.  
  325.     catalogInfo   : CatalogPtr;     (* points to the catalog given
  326.                                        with the GUI_CatalogFile tag *)
  327.     gadgetCatalogString : LONGINT;  (* The number of the next string *)
  328.     menuCatalogString   : LONGINT;  (* in the catalog *)
  329.  
  330.     vanKeyHook    : HookPtr;        (* Hook functions *)
  331.     handleMsgHook : HookPtr;
  332.     refreshHook   : HookPtr;
  333.  
  334.     hookInterface : ADDRESS;
  335.  
  336.     creationFont  : TextAttrPtr;    (* GUIDefinition: text/gadget font *)
  337.     textFont      : TextAttrPtr;    (* Font for gadgets and text *)
  338.   END;
  339.  
  340. CONST
  341.  
  342. (* --------------------------- GUI Tags ------------------------------------ *)
  343.  
  344.   guiBase = tagUser + 015000H;
  345.   guiTextFont            = guiBase +  1;
  346.   guiMenuFont            = guiBase +  2;
  347.   guiCreateError         = guiBase +  4;
  348.   guiUserData            = guiBase +  5;
  349.   guiCompilerReg         = guiBase +  6;
  350.   guiGadgetGuide         = guiBase +  8;
  351.   guiMenuGuide           = guiBase +  9;
  352.   guiCatalogFile         = guiBase + 10;
  353.   guiGadgetCatalogOffset = guiBase + 11;
  354.   guiMenuCatalogOffset   = guiBase + 12;
  355.   guiCreationWidth       = guiBase + 13;
  356.   guiCreationHeight      = guiBase + 14;
  357.   guiMsgPort             = guiBase + 16;
  358.   guiRefreshAHook        = guiBase + 17;
  359.   guiHandleMsgAHook      = guiBase + 18;
  360.   guiVanKeyAHook         = guiBase + 19;
  361.   guiHookInterface       = guiBase + 20;
  362.   guiCreationFont        = guiBase + 21;
  363.   guiPreserveWindow      = guiBase + 22;
  364.  
  365.   guiRemoveMenu          = guiBase + 100;
  366.   guiRemoveGadgets       = guiBase + 101;
  367.   guiClearWindow         = guiBase + 102;
  368.   guiEmptyMsgPort        = guiBase + 103;
  369.   guiDoBeep              = guiBase + 104;
  370.   guiLock                = guiBase + 105;  (* Requires ReqTools *)
  371.   guiUnLock              = guiBase + 106;  (* Requires ReqTools *)
  372.  
  373.  
  374. (* -------------------- Preserve Window Flags ---------------------------- *)
  375.  
  376.   guiPWFull    = 0;   (* Preserve the window and the min and max values *)
  377.   guiPWSize    = 1;   (* Preserve only the window *)
  378.   guiPWMinMax  = 2;   (* Preserve only the min and max values *)
  379.  
  380.  
  381. (* ======================================================================= *)
  382. (*                             Requester                                   *)
  383. (* ======================================================================= *)
  384.  
  385. (* -------------------- Requester kinds ---------------------------------- *)
  386.  
  387.   gerGeneralKind = 0;
  388.   gerOKKind      = 1;
  389.   gerDoItKind    = 2;
  390.   gerYNCKind     = 3;
  391.   gerFileKind    = 4;
  392.   gerDirKind     = 5;
  393.  
  394.   gerRTKind      = 100;  (* Requires ReqTools *)
  395.   gerRTOKKind    = 101;
  396.   gerRTDoItKind  = 102;
  397.   gerRTYNCKind   = 103;
  398.   gerRTFileKind  = 104;
  399.   gerRTDirKind   = 105;
  400.  
  401. (* --------------------- Return values ----------------------------------- *)
  402.  
  403.   gerCancel = 0;  (* gerYNCKind / gerDoItKind / gerOKKind /
  404.                      gerFileKind / gerDirKind*)
  405.   gerYes    = 1;  (* gerYNCKind / gerDoItKind / gerFileKind / gerDirKind *)
  406.   gerNo     = 2;  (* gerYNCKind *)
  407.  
  408. (* --------------------- Requester tags ---------------------------------- *)
  409.  
  410.   gerBase = tagUser + 017000H;
  411.   gerGadgets        = gerBase +  1;
  412.   gerArgs           = gerBase +  2;
  413.   gerFlags          = gerBase +  3;
  414.   gerTitle          = gerBase +  4;
  415.   gerIDCMP          = gerBase +  5;
  416.   gerPattern        = gerBase +  6;
  417.   gerNameBuffer     = gerBase +  7;
  418.   gerFileBuffer     = gerBase +  8;
  419.   gerDirBuffer      = gerBase +  9;
  420.   gerSave           = gerBase + 10;
  421.   gerLocaleID       = gerBase + 11;
  422.  
  423.  
  424. (* ======================================================================= *)
  425. (*                              Windows                                    *)
  426. (* ======================================================================= *)
  427.  
  428. (* ---------------------- window tags ------------------------------------ *)
  429.  
  430.   gewBase = tagUser + 019000H;
  431.   gewOuterSize = gewBase + 1;
  432.  
  433. END GUIEnvD.
  434.