home *** CD-ROM | disk | FTP | other *** search
- {*
- * TvMenus.pas
- *
- * Enhancements to Turbo Vision menus.
- *
- * Copyright 1992 by Richard W. Hansen
- *
- *}
-
- UNIT TvMenus;
-
- {$I TVDEFS.INC}
-
- INTERFACE
-
-
- USES
- TvConst,
- App,
- Drivers,
- Menus,
- Views,
- Objects;
-
-
- CONST
- Marker : String[10] = '√'; { The text marker for chosen items }
- NoMarker : String[10] = ' '; { The text used to clear unmarked items }
- MarkerLen : Byte = 1; { Marker and NoMarker must both be
- exactly this length. They can be any
- string like "Yes" and "No ", but they
- must be the same length and that length
- must be exactly MarkerLen bytes. }
-
-
-
- TYPE
- { PMenuBar provides a descendant of TMenuBar that wil display check
- marked items. Call the function NewMarkedItem below instead of
- NewItem to get a check mark menu ite when initializing a menu. Call
- ToggleMarker, SetMarker, ClearMarker, and MarkerIsSet, to manipulate
- and and check for marked items. Use ResetMarkers to clear a range and
- set a single marker to ON.
- }
- PNewMenuBar = ^TNewMenuBar;
- TNewMenuBar = Object(TMenuBar)
- Procedure HandleEvent(var E : TEvent); Virtual;
- Procedure ToggleMarker(Cmd : Word);
- Procedure SetMarker(Cmd : Word);
- Procedure ClearMarker(Cmd : Word);
- Function MarkerIsSet(Cmd : Word): Boolean;
- Procedure ResetMarkers(FirstCmd : Word;
- LastCmd : Word;
- NewCmd : Word);
- Function FindCmd(AMenu : PMenu;
- Cmd : Word): PMenuItem;
- end;
-
-
- { Returns a PMenuItem just line NewItem, but will add the needed space for
- a marker. If desired you can manually mark an item, just make sure that
- Name = Marker + ' ' + MenuItemName.
- }
- Function NewMarkedItem(Name, Param : TMenuStr;
- KeyCode : Word;
- Command : Word;
- AHelpCtx : Word;
- Next : PMenuItem): PMenuItem;
-
- Function PopupMenu(PopMenu : PMenuBox): Word;
-
- Function MousePopupMenu(PopMenu : PMenuBox): Word;
-
-
-