home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TVTOOL.ZIP / TVMENUS.INT < prev    next >
Encoding:
Text File  |  1992-10-08  |  2.2 KB  |  75 lines

  1. {*
  2. *   TvMenus.pas
  3. *
  4. *   Enhancements to Turbo Vision menus.
  5. *
  6. *   Copyright 1992 by Richard W. Hansen
  7. *
  8. *}
  9.  
  10. UNIT TvMenus;
  11.  
  12. {$I TVDEFS.INC}
  13.  
  14. INTERFACE
  15.  
  16.  
  17. USES
  18.   TvConst,
  19.   App,
  20.   Drivers,
  21.   Menus,
  22.   Views,
  23.   Objects;
  24.  
  25.  
  26. CONST
  27.   Marker      : String[10] = '√';   { The text marker for chosen items      }
  28.   NoMarker    : String[10] = ' ';   { The text used to clear unmarked items }
  29.   MarkerLen   : Byte       = 1;     { Marker and NoMarker must both be
  30.                                       exactly this length. They can be any
  31.                                       string like "Yes" and "No ", but they
  32.                                       must be the same length and that length
  33.                                       must be exactly MarkerLen bytes.      }
  34.  
  35.  
  36.  
  37. TYPE
  38.   { PMenuBar provides a descendant of TMenuBar that wil display check
  39.     marked items. Call the function NewMarkedItem below instead of
  40.     NewItem to get a check mark menu ite when initializing a menu. Call
  41.     ToggleMarker, SetMarker, ClearMarker, and MarkerIsSet, to manipulate
  42.     and and check for marked items. Use ResetMarkers to clear a range and
  43.     set a single marker to ON.
  44.   }
  45.   PNewMenuBar = ^TNewMenuBar;
  46.   TNewMenuBar = Object(TMenuBar)
  47.     Procedure HandleEvent(var E : TEvent);      Virtual;
  48.     Procedure ToggleMarker(Cmd : Word);
  49.     Procedure SetMarker(Cmd : Word);
  50.     Procedure ClearMarker(Cmd : Word);
  51.     Function  MarkerIsSet(Cmd : Word): Boolean;
  52.     Procedure ResetMarkers(FirstCmd : Word;
  53.                            LastCmd  : Word;
  54.                            NewCmd   : Word);
  55.     Function  FindCmd(AMenu : PMenu;
  56.                       Cmd   : Word): PMenuItem;
  57.   end;
  58.  
  59.  
  60. { Returns a PMenuItem just line NewItem, but will add the needed space for
  61.   a marker. If desired you can manually mark an item, just make sure that
  62.   Name = Marker + ' ' + MenuItemName.
  63. }
  64. Function NewMarkedItem(Name, Param : TMenuStr;
  65.                        KeyCode     : Word;
  66.                        Command     : Word;
  67.                        AHelpCtx    : Word;
  68.                        Next        : PMenuItem): PMenuItem;
  69.  
  70. Function PopupMenu(PopMenu : PMenuBox): Word;
  71.  
  72. Function MousePopupMenu(PopMenu : PMenuBox): Word;
  73.  
  74.  
  75.