home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / dskutl / swp-ms10.ark / MENU.UNT < prev    next >
Text File  |  1989-09-27  |  2KB  |  81 lines

  1. {.L-}  { Suppress listing by ListT }
  2. {*
  3.  * --------------------------------------------------------------------
  4.  *                       M E N U   U N I T
  5.  * --------------------------------------------------------------------
  6.  *
  7.  * This 'unit' contains the primitives to build a simple menu system.
  8.  * It does not contain any hardware dependencies.
  9.  *
  10.  *              I N T E R F A C E   S E C T I O N
  11.  *}
  12.  
  13. type
  14.    TitleString = string[40] ;  { String to contain a title }
  15.  
  16. {
  17.   procedure DisplayMenuHead ;
  18.   procedure DisplayMenuTail ;
  19.   procedure DisplayTitle( VariaTitle : TitleString ) ;
  20.   procedure InitMenuUnit( FixedTitle : TitleString ) ;
  21. }
  22.  
  23. {*
  24.  *        I M P L E M E N T A T I O N   S E C T I O N
  25.  *}
  26. var
  27.    FixedTitlePtr : ^TitleString ;  { Right title, program name }
  28.  
  29. procedure DisplayTitle( VariaTitle : TitleString ) ;
  30. {*
  31.  * Display both the fixed title and the variable title on the top line
  32.  * of the screen. The titles are underlined and the rest of the screen
  33.  * is cleared.
  34.  * Note : It is assumed that the screen width is 80 characters!
  35.  *}
  36. var
  37.    FreeSpace : Integer ;  { Free space on top line }
  38.    I         : Integer ;  { Loop control variable }
  39. begin
  40.    ClrScr ;
  41.    Write( FixedTitlePtr^ ) ;
  42.    FreeSpace:= 79 - Length( FixedTitlePtr^ ) ;
  43.    if FreeSpace>5 then
  44.      Write( Copy(VariaTitle,1,FreeSpace):FreeSpace ) ;
  45.    WriteLn ;
  46.  
  47.    For I:= 1 to 79 do
  48.      Write( '-' ) ;
  49.    WriteLn ;
  50. end ;  { of DisplayTitle }
  51.  
  52. procedure DisplayMenuHead ;
  53. {*
  54.  * Display the (standard) header of a menu.
  55.  *}
  56. begin
  57.    WriteLn ;
  58.    WriteLn( ' Cmd  Action' ) ;
  59.    WriteLn ;
  60. end ;  { of DisplayMenuHead }
  61.  
  62. procedure DisplayMenuTail ;
  63. {*
  64.  * Display the (standard) tail of a menu.
  65.  *}
  66. begin
  67.    WriteLn ;
  68.    WriteLn( ' <Q>  Quit' ) ;
  69.    WriteLn ;
  70. end ;  { of DisplayMenuTail }
  71.  
  72. procedure InitMenuUnit( FixedTitle : TitleString ) ;
  73. {*
  74.  * Save the location of the fixed title.
  75.  *}
  76. begin
  77.    FixedTitlePtr:= Ptr( Addr(FixedTitle) ) ;
  78. end ;  { of InitMenuUnit }
  79. {.L+}
  80.  
  81.