home *** CD-ROM | disk | FTP | other *** search
- {-----------------------------------------------------------------------------}
- { TEGL Windows ToolKit II }
- { Copyright (C) 1990, TEGL Systems Corporation }
- { All Rights Reserved. }
- {-----------------------------------------------------------------------------}
- {$I switches.inc}
- {$V-}
-
- Unit TEGLMenu;
-
- INTERFACE
-
- USES
- teglfont,
- virtmem,
- FastGrph, {constants eg. JAGGED}
-
- errorlog,
- TEGLSpec,
- TEGLIntr, {required for mouseposition}
- TEGLUnit;
-
- const
- MenuEntryHeight = 3;
- MaxTextStringSize = 40;
-
- TYPE
- OptionEPtr = ^OptionEntry;
- OptionMPtr = ^OptionMenu;
-
- OMEventPtr = ^OMEvents;
- OMEvents = RECORD
- OptionMN : OptionMptr;
- OptionType : Byte;
- entrycallproc : callproc;
- ms : msclickptr;
- END;
-
- OptionMenu = RECORD
- NextOM : OptionMPtr;
- numofentries : Word;
- maxwidth : Word;
- displaynum : word;
- margin : Word;
- fonttype : Pointer;
- Proportional : boolean;
- FirstEntry : OptionEPtr;
- CurrentEntry : OptionEPtr;
- CurrentOEnum : Word;
-
- fs : imagestkptr;
- ms : msclickptr;
- x,y,x1,y1 : word;
- slidems : msclickptr;
- selectedOEnum : word;
- END;
-
- OptionEntry = RECORD
- NextOE : OptionEPtr;
- entryline : String[MaxTextStringSize];
- entryactive : Boolean;
- entrycolor : Integer;
- entrycallproc : callproc;
- entrysubOM : OptionMPtr;
-
- entryms : msclickptr;
- entryud : userrecptr;
- OM : optionmptr;
-
- entryboolean : boolean;
- entryvalue : word;
- entryglobal : pointer;
- END;
-
-
- MenuConstants = RECORD
- BarMenuMargin : Word;
- BarMenuColor : Word;
- BarTextColor : Word;
- BarBorderColor : Word;
- BarBorderShow : Boolean;
- OMSliderWidth : word;
- OMSliderheight : word;
- OMInactiveJagged : Boolean;
- OMSeparatorLine : word;
- OMMargin : word;
- OMTabSize : word;
- OMInactiveColor : Word;
- OMactiveColor : Word;
- OMBorderColor : Word;
- HideSubMenu : Boolean;
- END;
-
- const
- {$I teglmenu.inc}
- {*------------------------------------------------------------------------*
- | Menu Constants |
- *------------------------------------------------------------------------*}
- MC : MenuConstants =
- (BarMenuMargin : 16;
- BarMenuColor : 15;
- BarTextColor : 0;
- BarBorderColor : 15;
- BarBorderShow : TRUE;
- OMSliderWidth : 12;
- OMSliderHeight : 10;
- OMInactiveJagged : False;
- OMSeparatorLine : $ff;
- OMMargin : 10;
- OMTabSize : 8;
- OMInactiveColor : 7;
- OMactiveColor : 0;
- OMBorderColor : 0;
- HideSubmenu : FALSE
- );
-
- HERC_MC : MenuConstants =
- (BarMenuMargin : 16;
- BarMenuColor : 15;
- BarTextColor : 0;
- BarBorderColor : 0;
- BarBorderShow : TRUE;
- OMSliderWidth : 15;
- OMSliderHeight : 12;
- OMInactiveJagged : TRUE;
- OMSeparatorLine : $ff;
- OMMargin : 10;
- OMTabSize : 8;
- OMInactiveColor : 0;
- OMactiveColor : 0;
- OMBorderColor : 0;
- HideSubmenu : FALSE
- );
-
- AnchorOMPtr : OptionMPtr = NIL;
- CurrentOMPtr : OptionMPtr = NIL;
-
-
- {
- BarMenu Type
- ------------
-
- UpperLeft ---=======--- UpperRight ---=======---
- | | | |
- +---+ +---+
-
- LowerLeft +---+ LowerRight +---+
- | | | |
- ---=======--- ---=======---
-
-
- SubMenu Type
- ------------
- +---+
- RightTop +-----+ RightBottom +-----| |
- |=====+---+ |=====+---+
- +-----| | +-----+
- +---+
- +---+
- LeftTop +-----+ LeftBottom | |-----+
- +---+=====| +---+=====|
- | |-----+ +-----+
- +---+
- }
- UpperRight = 0;
- UpperLeft = 1;
- LowerRight = 2;
- LowerLeft = 3;
- RightTop = 4;
- LeftTop = 5;
- Rightbottom = 6;
- Leftbottom = 7;
- NoToggleEntry = 8;
- NoToggleExit = 16;
-
-
- {*------------------------------------------------------------------------*
- | Bar Menu routines |
- *------------------------------------------------------------------------*}
- Procedure CreateBarMenu(x,y,ln:Word);
- Procedure OutBarOption(EntryStr:String; OM:OptionMptr);
- Procedure OutBarEvent(EntryStr:String; EntryCallProc:callproc);
- {should define global key click}
-
- {*------------------------------------------------------------------------*
- | Option Menu / Option Entry |
- *------------------------------------------------------------------------*}
-
- function GetOMOE(OM:OptionMptr; OENum:word):OptionEptr;
- function GetFSOM(fs:ImageStkPtr):optionmptr;
-
- Procedure EntryStatus(OM:OptionMPtr; OENum:Word; status:Boolean);
- Procedure OptionText(OM:OptionMPtr; OENum : Word; EntryStr:String);
-
- {*------------------------------------------------------------------------*
- | Option Menu. Basis of Drop down Menus |
- *------------------------------------------------------------------------*}
- Function CreateOptionMenu(Fonttype:Pointer) : OptionMPtr;
- procedure SetOMDisplaynum(om: Optionmptr; displaynum:word);
- procedure SetOMMaxwidth(om: Optionmptr; maxwidth:word);
- procedure SetOMMargin(om: Optionmptr; margins:word);
- Procedure DefineOptions(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc);
- Procedure DefineOptionsSub(OM:OptionMptr; EntryStr:String; Active:Boolean; OM2:OptionMptr);
- Procedure DefineOptionsRadio(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc;
- Radiovalue:word; VAR RadioVar:word);
- Procedure DefineOptionsCheck(OM:OptionMptr; EntryStr:String; Active:Boolean; EntryCallProc:callproc;
- VAR ChkMark:boolean);
- Procedure SetCurrentOEPos(OM:OptionMPtr; OENum:Word);
-
- Procedure DropOptionEntry(OM:OptionMPtr; OENum:Word);
- Procedure DropOptionMenu(OM:OptionMPtr);
-
- {*------------------------------------------------------------------------*
- | Option Menu Events. |
- *------------------------------------------------------------------------*}
-
- {should define underscores with connecting keystrokes}
- Procedure DefineOptionClickArea(fs:ImageStkPtr; x,y,x1,y1:Word; OM:OptionMPtr; Sense:Boolean; OMType:Byte; Keycode:word);
- Procedure DropOptionClickAreas(fs:imagestkptr);
-
- {*------------------------------------------------------------------------*
- | Menu Color Constants |
- *------------------------------------------------------------------------*}
- Procedure SetOptionMenuColors(activecolor,inactivecolor:Word);
- Procedure SetOptionMenuBorderColor(Color:Word);
- Procedure SetBarTextColor(Color:Word);
- Procedure SetBarMenuMargin(margin:Word);
- Procedure SetBarMenuColor(Color:Word);
- Procedure SetBarBorderOff; {Set Bar Border Off}
- Procedure SetBarBorderColor(Color:Word); {set bar border color}
- Procedure SetHideSubMenu(on_off:Boolean); {leaves menu on screen}
- Procedure SetMenuMargin(pixsize:word); {default is 10 pixels.. set for checkmarks}
- Procedure SetMenuTabsize(charnum:word); {tabs are |, not $09}
- Procedure SetSeparatorLine(mask:word); {fillpattern, dashed lines are $EE}
- Procedure SetInactiveJaggies(on_off:Boolean); {inactive entries on GEM are jagged}
- Procedure SetOMSliderSize(width,height:word); {sets slider button width/height}
-
- Function MenuTextWidth(mystr:String):Integer;
- {strlen based on menu interpretation}
-
- Procedure OutMenuTextXY(x,y,color:Integer; mystr:String; maxw:word);
- {maxw provides the tail end for right justication}
-
- function OMExists(OM : OptionMPtr) : boolean;
- {checks if it is a valid OM}
-
- Function ScanQuickKey(mystr:String):word;
- {extracts the scan code from a menu string eg. ~A~}
-
- Function OpenOptionMenu(x,y:Word; OM:OptionMPtr) : ImageStkPtr;
- {potential picklist}
-
-
- IMPLEMENTATION
-