home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / pas / swag / oop.swg / 0019_TV-ANSI.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  72 lines

  1. {
  2. here's some code to insert your one personal desktop in TurboVision.
  3. }
  4. {$L SBLOGO}
  5. Procedure Logo; external;
  6. {
  7. The only use of this Procedure is to link in the ansi drawing. It's a TP
  8. Compatible Object File (you can make them With TheDraw). But every video
  9. dump will do. This drawing should have the dimension 22 * 80.
  10. }
  11. Type
  12.   PAnsiBackGround = ^TAnsiBackGround;
  13.   TAnsiBackGround = Object (TBackGround)
  14.     BckGrnd : Pointer;
  15.     { This is the Pointer to your video dump }
  16.  
  17.     Constructor Init (Var Bounds : TRect; APattern : Char);
  18.     Procedure Draw; Virtual;
  19.     end;
  20.  
  21. Constructor TAnsiBackGround.Init;
  22. begin
  23.   TBackGround.Init (Bounds, APattern);
  24.   BckGrnd := @Logo;
  25.  
  26. end;
  27.  
  28. Procedure TAnsiBackGround.Draw;
  29. begin
  30.   TView.Draw;
  31.   WriteBuf (0,0, 80, 23, BckGrnd^);
  32.   { The TV buffer Type is nothing more then a dump of the video memory }
  33.  
  34. end;
  35.  
  36. Type
  37.   PAnsiDesktop = ^TAnsiDesktop;
  38.   TAnsiDesktop = Object (TDesktop)
  39.     Procedure InitBackGround; Virtual;
  40.     end;
  41.  
  42. Procedure TAnsiDesktop.InitBackGround;
  43. Var
  44.   R: TRect;
  45.   AB : PAnsiBackGround;
  46. begin
  47.   GetExtent(R);
  48.   New (AB, Init(R, #176));
  49.   BackGround := AB;
  50.  
  51. end;
  52.  
  53. { Your applications InitDesktop method should look like this : }
  54.  
  55. Procedure TGenericApp.InitDesktop ;
  56. Var
  57.   AB : PAnsiDesktop;
  58.   R : TRect;
  59. begin
  60.   GetExtent(R);
  61.   Inc(R.A.Y);
  62.   Dec(R.B.Y);
  63.   New(AB, Init(R));
  64.   Desktop := AB;
  65.  
  66. end;
  67. {
  68. The only problem With this approach is that it doesn't work in 43 line mode
  69. since your background covers only 22 lines. if anyone has some nice code
  70. to move this ansi-picture in an buffer which fills up 43 lines mode I Really
  71. appreciate it !!
  72. }