home *** CD-ROM | disk | FTP | other *** search
/ Deathday Collection / dday.bin / edit / dfe / guiobj.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-10  |  2KB  |  89 lines

  1. unit GUIObj;
  2.  
  3. interface
  4.  
  5. const evMouseDown = $0001;
  6.         evMouseUp   = $0002;
  7.         evMouseMove = $0004;
  8.         evMouseAuto = $0008;
  9.         evKeyDown   = $0010;
  10.         evCommand   = $0100;
  11.         evBroadcast = $0200;
  12.         evNothing      = $0000;
  13.         evMouse        = $000F;
  14.         evKeyboard     = $0010;
  15.         evMessage      = $FF00;
  16.  
  17.  
  18. type  PGraphPoint=^TGraphPoint;
  19.         TGraphPoint=record
  20.             X    :integer;
  21.             Y    :integer;
  22.         end;
  23.         TGraphRect=object
  24.             A    :TGraphPoint;
  25.             B    :TGraphPoint;
  26.             Procedure Assign(xa,ya,xb,yb:integer);
  27.             Procedure Move(adx,ady:integer);
  28.             Procedure Grow(adx,ady:integer);
  29.         end;
  30.         PGraphEvent=^TGraphEvent;
  31.         TGraphEvent = record
  32.             What: Word;
  33.             case Word of
  34.                 evNothing: ();
  35.                 evMouse: (
  36.                     Buttons: Byte;
  37.                     Double: Boolean;
  38.                     Where: TGraphPoint);
  39.                 evKeyDown: (
  40.                     case Integer of
  41.                     0: (KeyCode: Word);
  42.                     1: (CharCode: Char;
  43.                          ScanCode: Byte));
  44.                 evMessage: (
  45.                     Command: Word;
  46.                     case Word of
  47.                         0: (InfoPtr: Pointer);
  48.                         1: (InfoLong: Longint);
  49.                         2: (InfoWord: Word);
  50.                         3: (InfoInt: Integer);
  51.                         4: (InfoByte: Byte);
  52.                         5: (InfoChar: Char));
  53.         end;
  54.  
  55. implementation
  56.  
  57. Procedure TGraphRect.Assign(xa,ya,xb,yb:integer);
  58.  
  59.     begin
  60.         a.x:=xa;
  61.         a.y:=ya;
  62.         b.x:=xb;
  63.         b.y:=yb;
  64.     end;
  65.  
  66. Procedure TGraphRect.Move(adx,ady:integer);
  67.  
  68.     var    Width,Height:word;
  69.  
  70.     begin
  71.         Width:=b.x - a.x;
  72.         Height:=b.y - a.y;
  73.         a.x:=adx;
  74.         a.y:=ady;
  75.         b.x:=adx + Width;
  76.         b.y:=ady + Height;
  77.     end;
  78.  
  79. Procedure TGraphRect.Grow(adx,ady:integer);
  80.  
  81.     begin
  82.         dec(a.x, adx);
  83.         dec(a.y, ady);
  84.         inc(b.x, adx);
  85.         inc(b.y, ady);
  86.     end;
  87.  
  88.  
  89. end.