home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / Event speed / Reusable units / InterfacesUI.p next >
Encoding:
Text File  |  1996-10-06  |  9.9 KB  |  333 lines  |  [TEXT/PJMM]

  1. unit InterfacesUI;
  2.  
  3. {Unit for making Think Pascal work with Universal Interfaces}
  4. {All units that are not in Interfaces.lib are not reflected here.}
  5. {This implements changes to the core Toolbox, excluding most System7-}
  6. {specific units. You have to inlude them in your project anyway, so}
  7. {you can just as well make the changes in the interface files as}
  8. {necessary.}
  9.  
  10. interface
  11.  
  12. {Controls}
  13.     const
  14.         kControlNoPart = 0;
  15.         kControlLabelPart = 1;
  16.         kControlMenuPart = 2;
  17.         kControlTrianglePart = 4;
  18.         kControlButtonPart = 10;
  19.         kControlCheckBoxPart = 11;
  20.         kControlRadioButtonPart = 11;
  21.         kControlUpButtonPart = 20;
  22.         kControlDownButtonPart = 21;
  23.         kControlPageUpPart = 22;
  24.         kControlPageDownPart = 23;
  25.         kControlIndicatorPart = 129;
  26.         kControlDisabledPart = 254;
  27.         kControlInactivePart = 255;
  28.     type
  29.         ControlRef = ControlHandle;
  30.         ConstStr255Param = Str255;
  31.         WindowRef = WindowPtr;
  32.         ControlActionUPP = ProcPtr;
  33.     procedure SetControlTitle (theControl: ControlRef; title: ConstStr255Param);
  34.     inline
  35.         $A95F;
  36.     procedure GetControlTitle (theControl: ControlRef; var title: Str255);
  37.     inline
  38.         $A95E;
  39.     procedure UpdateControls (theWindow: WindowRef; updateRgn: RgnHandle);
  40.     inline
  41.         $A953;
  42.     procedure SetControlValue (theControl: ControlRef; theValue: INTEGER);
  43.     inline
  44.         $A963;
  45.     function GetControlValue (theControl: ControlRef): INTEGER;
  46.     inline
  47.         $A960;
  48.     procedure SetControlMinimum (theControl: ControlRef; minValue: INTEGER);
  49.     inline
  50.         $A964;
  51.     function GetControlMinimum (theControl: ControlRef): INTEGER;
  52.     inline
  53.         $A961;
  54.     procedure SetControlMaximum (theControl: ControlRef; maxValue: INTEGER);
  55.     inline
  56.         $A965;
  57.     function GetControlMaximum (theControl: ControlRef): INTEGER;
  58.     inline
  59.         $A962;
  60.     function GetAuxiliaryControlRecord (theControl: ControlRef; var acHndl: AuxCtlHandle): BOOLEAN;
  61.     inline
  62.         $AA44;
  63.     procedure SetControlReference (theControl: ControlRef; data: LONGINT);
  64.     inline
  65.         $A95B;
  66.     function GetControlReference (theControl: ControlRef): LONGINT;
  67.     inline
  68.         $A95A;
  69.     procedure SetControlAction (theControl: ControlRef; actionProc: ControlActionUPP);
  70.     inline
  71.         $A96B;
  72.     function GetControlAction (theControl: ControlRef): ControlActionUPP;
  73.     inline
  74.         $A96A;
  75.     procedure SetControlColor (theControl: ControlRef; newColorTable: CCTabHandle);
  76.     inline
  77.         $AA43;
  78.     function GetControlVariant (theControl: ControlRef): INTEGER;
  79.     inline
  80.         $A809;
  81.  {Dialogs}
  82.     type
  83.         DialogRef = DialogPtr;
  84.     procedure DisposeDialog (theDialog: DialogRef);
  85.     inline
  86.         $A983;
  87.     procedure UpdateDialog (theDialog: DialogRef; updateRgn: RgnHandle);
  88.     inline
  89.         $A978;
  90.     procedure GetDialogItem (theDialog: DialogRef; itemNo: INTEGER; var itemType: INTEGER; var item: Handle; var box: Rect);
  91.     inline
  92.         $A98D;
  93.     procedure SetDialogItem (theDialog: DialogRef; itemNo: INTEGER; itemType: INTEGER; item: Handle; {CONST}
  94.                                     var box: Rect);
  95.     inline
  96.         $A98E;
  97.     procedure HideDialogItem (theDialog: DialogRef; itemNo: INTEGER);
  98.     inline
  99.         $A827;
  100.     procedure ShowDialogItem (theDialog: DialogRef; itemNo: INTEGER);
  101.     inline
  102.         $A828;
  103.     procedure SelectDialogItemText (theDialog: DialogRef; itemNo: INTEGER; strtSel: INTEGER; endSel: INTEGER);
  104.     inline
  105.         $A97E;
  106.     procedure GetDialogItemText (item: Handle; var text: Str255);
  107.     inline
  108.         $A990;
  109.     procedure SetDialogItemText (item: Handle; text: ConstStr255Param);
  110.     inline
  111.         $A98F;
  112.     function FindDialogItem (theDialog: DialogRef; thePt: Point): INTEGER;
  113.     inline
  114.         $A984;
  115.     function NewColorDialog (dStorage: univ Ptr; {CONST}
  116.                                     var boundsRect: Rect; title: ConstStr255Param; visible: BOOLEAN; procID: INTEGER; behind: WindowRef; goAwayFlag: BOOLEAN; refCon: LONGINT; items: Handle): DialogRef;
  117.     inline
  118.         $AA4B;
  119.     function GetAlertStage: INTEGER;
  120.     inline
  121.         $3EB8, $0A9A;            { MOVE.W $0A9A,(SP) }
  122.  
  123.     procedure ResetAlertStage;
  124.     inline
  125.         $4278, $0A9A;
  126.     procedure DialogCut (theDialog: DialogRef);
  127.     procedure DialogPaste (theDialog: DialogRef);
  128.     procedure DialogCopy (theDialog: DialogRef);
  129.     procedure DialogDelete (theDialog: DialogRef);
  130.     procedure SetDialogFont (value: INTEGER);
  131.     inline
  132.         $31DF, $0AFA;            { MOVE.W (SP)+,$0AFA }
  133.  
  134. {Events}
  135.     function KeyTranslate (transData: univ Ptr; keycode: INTEGER; var state: LONGINT): LONGINT;
  136.     inline
  137.         $A9C3;
  138.  
  139. {Lists}
  140.     procedure LSetDrawingMode (drawIt: BOOLEAN; lHandle: ListHandle);
  141.     inline
  142.         $3F3C, $002C, $A9E7;
  143.     procedure LGetCellDataLocation (var offset: INTEGER; var len: INTEGER; theCell: Cell; lHandle: ListHandle);
  144.     inline
  145.         $3F3C, $0034, $A9E7;
  146.  
  147. {Memory}
  148.     function ApplicationZone: THz;
  149.     inline
  150.         $2EB8, $02AA;            { MOVE.L $02AA,(SP) }
  151.     function TempNewHandle (logicalSize: Size; var resultCode: OSErr): Handle;
  152.     inline
  153.         $3F3C, $001D, $A88F;
  154.     function TempMaxMem (var grow: Size): Size;
  155.     inline
  156.         $3F3C, $0015, $A88F;
  157.     function TempFreeMem: LONGINT;
  158.     inline
  159.         $3F3C, $0018, $A88F;
  160.  {  Temporary Memory routines renamed, but obsolete, in System 7.0 and later.  }
  161.     procedure TempHLock (h: Handle; var resultCode: OSErr);
  162.     inline
  163.         $3F3C, $001E, $A88F;
  164.     procedure TempHUnlock (h: Handle; var resultCode: OSErr);
  165.     inline
  166.         $3F3C, $001F, $A88F;
  167.     procedure TempDisposeHandle (h: Handle; var resultCode: OSErr);
  168.     inline
  169.         $3F3C, $0020, $A88F;
  170.     function TempTopMem: Ptr;
  171.     inline
  172.         $3F3C, $0016, $A88F;
  173.     procedure ReserveMem (cbNeeded: Size);
  174.     inline
  175.         $201F, $A040;
  176.     procedure ReserveMemSys (cbNeeded: Size);
  177.     inline
  178.         $201F, $A440;
  179.     procedure DisposePtr (p: Ptr);        {Unnecessary?}
  180.     inline
  181.         $205F, $A01F;
  182.     procedure DisposeHandle (h: Handle);    {Unnecessary?}
  183.     inline
  184.         $205F, $A023;
  185.     procedure ReallocateHandle (h: Handle; byteCount: Size);
  186.     inline
  187.         $201F, $205F, $A027;
  188.  {Menus}
  189.     type
  190.         MenuRef = MenuHandle;
  191.     procedure AppendResMenu (theMenu: MenuRef; theType: ResType);
  192.     inline
  193.         $A94D;
  194.     procedure InsertMenuItem (theMenu: MenuRef; itemString: ConstStr255Param; afterItem: INTEGER);
  195.     inline
  196.         $A826;
  197.     procedure DeleteMenuItem (theMenu: MenuRef; item: INTEGER);
  198.     inline
  199.         $A952;
  200.     procedure SetMenuItemText (theMenu: MenuRef; item: INTEGER; itemString: ConstStr255Param);
  201.     inline
  202.         $A947;
  203.     procedure GetMenuItemText (theMenu: MenuRef; item: INTEGER; var itemString: Str255);
  204.     inline
  205.         $A946;
  206.     function GetMenuHandle (menuID: INTEGER): MenuRef;
  207.     inline
  208.         $A949;
  209.     procedure DeleteMCEntries (menuID: INTEGER; menuItem: INTEGER);
  210.     inline
  211.         $AA60;
  212.     procedure DisposeMCInfo (menuCTbl: MCTableHandle);
  213.     inline
  214.         $AA63;
  215.  {OSUtils}
  216.     type
  217.         LongDateRec = DateTimeRec;
  218.         LongDateTime = Longint;
  219.     procedure LongDateToSeconds ({CONST}
  220.                                     var lDate: LongDateRec; var lSecs: LongDateTime);
  221.     inline
  222.         $2F3C, $8008, $FFF2, $A8B5;
  223.     procedure LongSecondsToDate (var lSecs: LongDateTime; var lDate: LongDateRec);
  224.     inline
  225.         $2F3C, $8008, $FFF0, $A8B5;
  226.     function IsMetric: BOOLEAN;
  227.     inline
  228.         $3F3C, $0004, $A9ED;
  229.     procedure DateToSeconds ({CONST}
  230.                                     var d: DateTimeRec; var secs: LONGINT);
  231.     procedure SecondsToDate (secs: LONGINT; var d: DateTimeRec);
  232.     inline
  233.         $205F, $201F, $A9C6;
  234. {PictUtils}
  235.     function DisposePictInfo (thePictInfoID: Longint): OSErr;
  236.     inline
  237.         $303C, $0206, $A831;
  238. {QuickDraw - unnecessary?}
  239.     procedure DisposePixMap (pm: PixMapHandle);
  240.     inline
  241.         $AA04;
  242.     procedure DisposePixPat (pp: PixPatHandle);
  243.     inline
  244.         $AA08;
  245.     procedure DisposeCTable (cTable: CTabHandle);
  246.     inline
  247.         $AA24;
  248.     procedure DisposeCCursor (cCrsr: CCrsrHandle);
  249.     inline
  250.         $AA26;
  251.     procedure DisposeCIcon (theIcon: CIconHandle);    {Rather Icons.p today?}
  252.     inline
  253.         $AA25;
  254.     procedure DisposeGDevice (gdh: GDHandle);
  255.     inline
  256.         $AA30;
  257.  {QuickdrawText}
  258. {function PixelToChar (textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; var leadingEdge: BOOLEAN; var widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;}
  259. {inline}
  260. {$2F3C, $8222, $002E, $A8B5;}
  261. {function CharToPixel (textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;}
  262. {inline}
  263. {$2F3C, $821C, $0030, $A8B5;}
  264. {procedure DrawJustified (textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);}
  265. {inline}
  266. {$2F3C, $8016, $0032, $A8B5;}
  267. {procedure MeasureJustified (textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);}
  268. {inline}
  269. {$2F3C, $801A, $0034, $A8B5;}
  270. {function PortionLine (textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;}
  271. {inline}
  272. {$2F3C, $8412, $0036, $A8B5;}
  273.  {Resources}
  274.     function GetResourceSizeOnDisk (theResource: Handle): LONGINT;
  275.     inline
  276.         $A9A5;
  277.     function GetMaxResourceSize (theResource: Handle): LONGINT;
  278.     inline
  279.         $A821;
  280.     procedure RemoveResource (theResource: Handle);
  281.     inline
  282.         $A9AD;
  283.  {TextEdit}
  284.     type
  285.         TEClickLoopUPP = ProcPtr;
  286.         WordBreakUPP = ProcPtr;
  287.     procedure TESetAlignment (just: INTEGER; hTE: TEHandle);
  288.     inline
  289.         $A9DF;
  290.     procedure TETextBox (text: univ Ptr; length: LONGINT; {CONST}
  291.                                     var box: Rect; just: INTEGER);
  292.     inline
  293.         $A9CE;
  294.     function TEStyleNew ({CONST}
  295.                                     var destRect: Rect; {CONST}
  296.                                     var viewRect: Rect): TEHandle;
  297.     inline
  298.         $A83E;
  299.     procedure TESetStyleHandle (theHandle: TEStyleHandle; hTE: TEHandle);
  300.     inline
  301.         $3F3C, $0005, $A83D;
  302.     function TEGetStyleHandle (hTE: TEHandle): TEStyleHandle;
  303.     inline
  304.         $3F3C, $0004, $A83D;
  305.     procedure TEStylePaste (hTE: TEHandle);
  306.     inline
  307.         $3F3C, $0000, $A83D;
  308.     function TEGetStyleScrapHandle (hTE: TEHandle): StScrpHandle;
  309.     inline
  310.         $3F3C, $0006, $A83D;
  311.     procedure TEUseStyleScrap (rangeStart: LONGINT; rangeEnd: LONGINT; newStyles: StScrpHandle; fRedraw: BOOLEAN; hTE: TEHandle);
  312.     inline
  313.         $3F3C, $000B, $A83D;
  314.     procedure TESetClickLoop (clikProc: TEClickLoopUPP; hTE: TEHandle);
  315.     function TEGetScrapLength: LONGINT;
  316.     procedure TESetWordBreak (wBrkProc: WordBreakUPP; hTE: TEHandle);
  317.     procedure TEStyleInsert (text: univ Ptr; length: LONGINT; hST: StScrpHandle; hTE: TEHandle);
  318.     inline
  319.         $3F3C, $0007, $A83D;
  320.  
  321. implementation
  322.  
  323. {If you need TESetClickLoop, and it isn't implemented by any library you have then you need to include}
  324. {the following code in some unit:}
  325.  
  326. {procedure TESetClickLoop (clikProc: TEClickLoopUPP; hTE: TEHandle);}
  327. {begin}
  328. {SetClikLoop(clikProc, hTE);}
  329. {end;}
  330.  
  331. {In SAT, use the file SetClikLoopGlue.p}
  332.  
  333. end.