{

              
            
               ͻ ͻ ͻ    ͻ ͻ
                    ˼ ͹ ͼ ͹     ͻ
                   ͼ          ͼ ͼ

  The MAX Graphics GUI Kit is Copyright 1995-Current Larry L. Athey (LA-Soft).
  Color Averaging procedures are courtesy of Sean Price (Rude Dog Software).


  NOTE: This kit is dependent on the shareware version of "FastGraph/Light"
        by Ted Gruber Software (www.fastgraph.com)...

  ALSO: Yes, this kit does everything in real mode...I've seen too many odd
        things happen in my own and other's protected mode programs, I just
        don't trust it....Real mode works just fine for me and my needs....

  PLUS: Yes, you're right again...This sucker isn't object oriented either.
        I guess this whole mess just makes me either the crappiest, or just
        the damn laziest programmer in the world. Hey, it's free, it works,
        and it get the job done for me, that's all I care about...  :)

}
{$I DEFINES.INC}
UNIT GUI_UNIT;

INTERFACE

{}
TYPE GUI_Color_Scheme = RECORD  {Record for the SVGA color scheme.           }
     Win1Back,                  {Window type 1 background.                   }
     Win4Back,                  {Window type 4 background.                   }
     Win1High,                  {Window type 1 highlight.                    }
     Win4High,                  {Window type 4 highlight.                    }
     Win1Low,                   {Window type 1 lowlight.                     }
     Win4Low,                   {Window type 4 lowlight.                     }
     Win1Frame1,                {Window type 1 frame high.                   }
     Win1Frame2,                {Window type 1 frame low.                    }
     Win4Frame,                 {Window type 4 frame.                        }
     ActiveHdr,                 {Color for active window headers.            }
     InactiveHdr,               {Color for inactive window headers.          }
     HdrTitle,                  {Window header title color.                  }
     ButtonFrame,               {Button frame color.                         }
     ButtonFace,                {Button background.                          }
     ButtonHigh,                {Button highlight.                           }
     ButtonLow,                 {Button lowlight.                            }
     ButtonHot,                 {Button hotkey color.                        }
     ButtonText,                {Button title color.                         }
     FrameLow,                  {Frame lowlight.                             }
     FrameHigh,                 {Frame highlight.                            }
     BoxBack,                   {Raised/Lowered box background.              }
     BoxHigh,                   {Raised/Lowered box highlight.               }
     BoxLow,                    {Raised/Lowered box lowlight.                }
     FieldTextHigh,             {Active entry field text color.              }
     FieldTextLow,              {Inactive entry field text color.            }
     FieldBack,                 {Entry field background.                     }
     QuoteColor,                {Color for BBS message quotes.               }
     MsgColor,                  {Color for BBS message text.                 }
     TearColor,                 {Color for BBS message tear lines.           }
     FlagColor,                 {Color for BBS message flags.                }
     MsgIDcolor,                {Color for BBS message ID info.              }
     TextBack,                  {Background color for reader/editor/picklist.}
     PickHighBack,              {Picklist item highlight background color.   }
     PickHighFore,              {Picklist item highlight foreground color.   }
     ScreenColor  : BYTE;       {Screen background color.                    }
     END;
{}
TYPE WindowRecord = RECORD      {Record for window settings.                 }
     X1,Y1,X2,Y2  : INTEGER;    {Window coordinates.                         }
     WType        : BYTE;       {Window type.                                }
     Title        : STRING;     {Window title.                               }
     END;
{}
TYPE ButtonRecord = RECORD      {Record for button settings.                 }
     ButtonType   : BYTE;       {Type of button for the current record.      }
     X,Y,Width    : INTEGER;    {Button X/Y coordinates and width.           }
     Height       : INTEGER;    {Button height in pixels                     }
     Title        : STRING[30]; {Button title.                               }
     ButStr       : STRING[20]; {Button hotkey extension string.             }
     Sound        : STRING[12]; {Button sound attachment file name.          }
     Return       : BYTE;       {Return code (ie: Ordinal Character Value).  }
     Holdable     : BOOLEAN;    {Is the button holdable?                     }
     HasIcon      : BOOLEAN;    {Is there an icon on the button?             }
     FieldOn      : BOOLEAN;    {If mouse field, is the field visible?       }
     Icon         : BYTE;       {Main icon record location.                  }
     Flip         : BYTE;       {Secondary icon record location.             }
     IX,IY        : INTEGER;    {Icon X/Y coordinates.                       }
     END;
{}
TYPE Button_Array = ARRAY[1..128] OF ButtonRecord;{Array of buttons.         }
{}
TYPE FieldRecord  = RECORD      {Record for entry field settings.            }
     X,Y          : INTEGER;    {Field X/Y coordinates.                      }
     Text         : STRING;     {Entry field text.                           }
     EType        : BYTE;       {Entry field type.                           }
     ELength      : BYTE;       {Character width of entry field.             }
     CursorPos    : BYTE;       {Entry field cursor position.                }
     Active       : BOOLEAN;    {Is this the currently selected field?       }
     Width        : INTEGER;    {Entry field pixel width.                    }
     Size         : BYTE;       {Entry field font size (0 or 1).             }
     END;
{}
TYPE Field_Array  = ARRAY[1..128] OF FieldRecord;{Array of entry fields.     }
{}
TYPE Pick_List    = ARRAY[1..800] OF STRING[77];
{^ This is the array in memory that holds the text for picklist items.       }
{}
TYPE Pick_Info    = RECORD      {Record for the picklist settings.           }
     Active       : BOOLEAN;    {Has the picklist been activated?            }
     Running      : BOOLEAN;    {Is the picklist running?                    }
     X,Y          : INTEGER;    {Picklist X/Y coordinates.                   }
     Top          : INTEGER;    {Default selected item at the top of the list}
     NumItems     : INTEGER;    {Total number of items in the picklist.      }
     ItemsOnScrn  : INTEGER;    {Number of items displayed on the screen.    }
     Current      : INTEGER;    {The currently selected picklist item.       }
     MaxChars     : BYTE;       {Character width of the picklist.            }
     Locator      : INTEGER;    {PickList locator position.                  }
     Item         : ARRAY[1..30] OF WORD;{Item index in the picklist window. }
     Width        : INTEGER;    {The right most location of the picklist.    }
     Bottom       : INTEGER;    {The bottom most location of the picklist.   }
     END;
{}
TYPE PalScroller  = RECORD      {Record for the color palette scroller.      }
     Active       : BOOLEAN;    {Has the palette scroller been activated?    }
     X,Y          : INTEGER;    {X/Y coordinates of the palette scroller.    }
     Top          : BYTE;       {Color value of the top scroller element.    }
     Current      : BYTE;       {The currently selected palette color.       }
     Item         : ARRAY[1..16] OF WORD;{Item index in the palette scroller.}
     Width        : INTEGER;    {The right most location of the scroller.    }
     Bottom       : INTEGER;    {The bottom most location of the scroller.   }
     END;
{}
TYPE Text_Buffer  = ARRAY[1..800] OF STRING[79];
{^ This is the text buffer for the text editor and text reader.              }
{}
TYPE Text_Reader  = RECORD      {The record for the text reader settings.    }
     X,Y          : INTEGER;    {Text reader X/Y coordinates.                }
     Row          : INTEGER;    {Current text line Y coordinate.             }
     Col          : INTEGER;    {Current text line X coordinate.             }
     Lines        : INTEGER;    {How many lines of text in the buffer.       }
     Last         : INTEGER;    {The last text line written to the screen.   }
     Active       : BOOLEAN;    {Has the text reader been activated?         }
     Running      : BOOLEAN;    {Is the text reader running?                 }
     END;
{}
TYPE Text_Editor  = RECORD      {Record for the text editor settings.        }
     Row          : INTEGER;    {Text editor row location.                   }
     Active       : BOOLEAN;    {Has the text editor been activated?         }
     Running      : BOOLEAN;    {Is the text editor running?                 }
     Done         : BOOLEAN;    {Has the user pressed ^Q or ^Z ?             }
     END;
{}
TYPE Icon_Flips   = RECORD      {Record for the flipping icons.              }
     X,Y          : INTEGER;    {Icon X,Y coordinate.                        }
     Icon         : Array[1..4] OF BYTE;{Icon library record positions.      }
     Size         : BYTE;       {Icon size: 1=16, 2=30, 3=60 pixels.         }
     END;
{}
TYPE Flip_Array   = ARRAY[1..128] OF Icon_Flips;{Array of flipping icons.    }
{}
TYPE Text_Port    = RECORD      {Record for the text view port coordinates.  }
     StartX       : INTEGER;    {Text view port upper left X coordinate.     }
     StartY       : INTEGER;    {Text view port upper left Y coordinate.     }
     ColLimit     : BYTE;       {Text view port columns.                     }
     RowLimit     : BYTE;       {Text view port rows.                        }
     Active       : BOOLEAN;    {Is the text view port active?               }
     END;
{}
CONST
  BBSmessages     : BOOLEAN = FALSE;{Translate BBS message text lines?       }
  FPtr            : POINTER = NIL;  {Pointer to the external GEM font file.  }
  GPtr            : POINTER = NIL;  {Pointer to the GEM System font.         }
  BPtr            : POINTER = NIL;  {Pointer to the 5x8 Bitmapped Font.      }

VAR
  SysClk          : ^WORD; {Real mem $40:$6C} {BIOS system clock counter.    }
  C               : GUI_Color_Scheme;{The color scheme record variable.      }
  WRec            : WindowRecord;{The window record variable.                }
  TvPort          : Text_Port;   {The text view port record variable.        }
  PickInfo        : Pick_Info;   {The picklist record variable.              }
  Scroller        : PalScroller; {The scroller record variable.              }
  TextReader      : Text_Reader; {The text reader record variable.           }
  TextEditor      : Text_Editor; {The text editor record variable.           }
  Buttons         : ^Button_Array;{The button pointer variable.              }
  Fields          : ^Field_Array;{The entry field pointer variable.          }
  IconFlip        : ^Flip_Array; {The icon flip pointer variable.            }
  PickList        : ^Pick_List;  {The picklist text pointer variable.        }
  TBuff           : ^Text_Buffer;{The text buffer pointer variable.          }
{}NFlips          : BYTE;        {The total number of flipping icons.        }
{}NFields         : BYTE;        {The total number of fields in a window.    }
{}NButtons        : BYTE;        {The total number of buttons in a window.   }
{}FieldNum        : BYTE;        {The currently selected field number.       }
{}WindowNumber    : BYTE;        {The currently active window number.        }
  WinTag          : CHAR;        {Identifier file tag for screen save files. }
{}MC              : CHAR;        {Character returned by mouse handler.       }
  ShowBanner      : BOOLEAN;     {Show the info banner upon startup? [Y/N]   }
{}AltKey          : BOOLEAN;     {Was the last MC keypress an ALT key? [Y/N] }
{}SVGAmode        : BOOLEAN;     {Are we in SVGA mode? [Y/N]                 }
  ConvertIt       : BOOLEAN;     {Convert color codes? [Y/N]                 }
{}Mouse_On        : BOOLEAN;     {Is the mouse cursor turned on? [Y/N]       }
{}MouseInstalled  : BOOLEAN;     {Is the mouse driver installed? [Y/N]       }
  AllowDragging   : BOOLEAN;     {Allow window dragging? [Y/N]               }
  DragActive      : BOOLEAN;     {Is window dragging currently active? [Y/N] }
  ExplodeOn       : BOOLEAN;     {Are exploding windows activated? [Y/N]     }
  ShowIcons       : BOOLEAN;     {Show the lower right corner MAX icons?[Y/N]}
{}LastPressed     : BYTE;        {The number of the last button pressed.     }
{}SvgaID          : INTEGER;     {The SVGA Chipset ID Number.                }
{}Old_Mode        : INTEGER;     {Original screen mode before FireUpGui.     }
{}OldX            : INTEGER;     {Last X coordinate of the mouse for dragging}
{}OldY            : INTEGER;     {Last Y coordinate of the mouse for dragging}
{}OrgX            : INTEGER;     {Original X1 coordinate of a window.        }
{}OrgY            : INTEGER;     {Original Y1 coordinate of a window.        }
  BackDropImage   : STRING[80];  {640x480x256 PCX image to use as a backdrop.}
  IconLib16       : STRING[80];  {File name of the 16x16 icon library file.  }
  IconLib30       : STRING[80];  {File name of the 30x30 icon library file.  }
  IconLib60       : STRING[80];  {File name of the 60x60 icon library file.  }
  EditorFile      : STRING[80];  {Default file name for text editor saving.  }
  MsgInfPath      : STRING[80];  {Path to MSGINF file for editing messages.  }

{ VERY IMPORTANT NOTE!                                                       }
{ --------------------                                                       }
{ All variables preceded by a pair of fancy brackets are "Read Only". DO NOT }
{ attempt to modify the values of any of these variables in your progams, or }
{ I can guarantee that you will mess up the internal operations of the GUI!! }

{Start Up And Shutdown}
FUNCTION  FireUpGui : BOOLEAN;
{^ This must be used to initialize the GUI, you cannot manually initialize   }
{  the GUI using external procedures/functions or the GUI will crash as soon }
{  as you draw your first window. This procedure is used to streamline your  }
{  program and is a "Do All" GUI start up procedure.                         }
PROCEDURE ShutDownGui;
{^ This procedure is used to completely shut down the GUI. Any time you make }
{  a call to this procedure, the GUI is finished until you make another call }
{  to FireUpGui again.                                                       }
PROCEDURE WaitForRetrace;
{^ Stalls the program until the beginning of the next vertical retrace.      }
PROCEDURE StartOffScreenDraw;
{^ Used to pop an image onto the screen. You first hide the mouse cursor and }
{  call this procedure. Draw all of your screen elements, then call the next }
{  procedure...See Below...                                                  }
PROCEDURE EndOffScreenDraw;
{^ After you have hidden the mouse cursor and finished drawing all of your   }
{  screen elements, call this procedure and turn the mouse cursor back on.   }
{  This will make the whole image pop onto the screen in one shot, rather    }
{  than seeing it draw one element at a time (See: StartOffScreenDraw)...    }
PROCEDURE InitPalette;
{^ Initializes the special GUI palette settings. All PCX/BMP/MIF images will }
{  be automatically adjusted to match these palette settings by averaging    }
{  before they are displayed. This only applies to 256 color images displayed}
{  with the procedures in GUI_IMAG. Images displayed with FastGraph's image  }
{  display routines will be displayed with no palette averaging and will end }
{  up resetting the DACs in turn causing all elements in the GUI to display  }
{  using the palette settings of the current image file.                     }
{                                                                            }
{  NOTE: The palette settings for the GUI kit are stored in the PALETTE.DAT  }
{        file. You may copy this file to the end of the executable the same  }
{        way you would copy an overlay to the end of an executable, and the  }
{        GUI kit will read these settings from there instead of an external  }
{        file.                                                               }
{                                                                            }
{Basic Drawing Elements}
PROCEDURE Draw_Line(X1,Y1,X2,Y2,FG : WORD);
{^ Some people may call this a redundant procedure, but it's actually a time }
{  and code saver. This eliminates the need for excessive code by calling    }
{  FG_Move, FG_Setcolor, and FG_Draw for every line you draw. The FG in this }
{  procedure is the Foreground color, the others are self explanatory.       }
PROCEDURE Draw_Bezier(px1,py1,px2,py2,px3,py3,px4,py4,Count,Color : INTEGER ; XORed : BOOLEAN);
{^ This procedure draws a Bezier Curve. If you are unfamiliar with the term, }
{  this is actually just a complex curve drawn with a series of lines. This  }
{  kind of curve is a popular feature in most graphical BBS interfaces. The  }
{  px1,py1..px4,py4 are coordinate values, Count determines the resolution of}
{  the curve by telling the procedure how many lines to draw to create the   }
{  curve, and the Color parameter is self explanatory. XORed determines if   }
{  the curve is or is not to be drawn in Exclusive OR mode.                  }
PROCEDURE Draw_Mesh(X1,Y1,X2,Y2,FG : WORD);
{^ This procedure draws a mesh over a specified part of the screen. If you   }
{  run Windows 95, you see this same effect every time you tell the machine  }
{  to shut down. FG is the Forground color of the mesh to draw, all of the   }
{  other parameters are self explanatory.                                    }
{Text Related}
{  All text output procedures with a font specification value determine what }
{  font to use with the numbers 1 through 4. These values are as follows:    }
{                                                                            }
{  1 - The GEM 5x8 bitmapped font.                                           }
{  2 - The GEM System Font (Similar to the Macintosh default desktop font).  }
{  3 - The 8x16 ROM resident font (ie: The DOS font).                        }
{  4 - Any external GEM font loaded with LoadUserFont().                     }
{                                                                            }
FUNCTION  TextWidth(FontSize : BYTE ; InStr : STRING) : WORD;
{^ This function is used to determine the length of a string of text using   }
{  the font size you pass to it. The result is returned in pixel width.      }
FUNCTION  TextHeight(FontSize : BYTE ; InStr : STRING) : WORD;
{^ This function is used to determine the height of a string of text using   }
{  the font size you pass to it. The result is returned in pixel width.      }
PROCEDURE LoadUserFont(FFile : STRING);
{^ This procedure loads an external font file into the FPtr pointer, which in}
{  turn allows you to use the following text output procedures to display any}
{  string of text using that font. FFile is the GEM font file name to load.  }
PROCEDURE CvtTokens(InStr : STRING ; Font : BYTE);
{^ This procedure displays a string of text and translates imbedded color    }
{  tokens which in turn changes the color of the text. These color tokens    }
{  are actually just a hold over from my BBS software & BBS door kit which   }
{  are supported here so I have equal compatibility between both ANSI, and   }
{  SVGA modes in the BBS. The values in these tokens are from 0 to 15, you   }
{  place the value inside a pair of fancy brackets before the text that you  }
{  want to display and it's color will be changed accordingly. Example:      }
(* CvtTokens('{15}This {14}Is {15}A {14}Test{15}...',2);                    *)
{  The above example will display text alternating between white and yellow  }
{  at the current graphics cursor position in font #2.                       }
PROCEDURE OutText_XY(X,Y,FG,Font : WORD ; Txt : STRING);
{^ This procedure is used to display text at specific X/Y coordinates using  }
{  the specified foreground color and font style. FG is the foreground color }
{  to use, and Font is the font style number to use. You may also imbed any  }
{  inline color token in your text as well if so desired.                    }
PROCEDURE ShadowText(X,Y,FG,SH,Font : WORD ; Txt : STRING);
{^ This procedure is similar to the above procedure with the exception that  }
{  this one plots the text in a shadowed fashion. All of the parameters are  }
{  the same with the addition of the SH parameter which determines the color }
{  of the text shadow.                                                       }
{3D Box/Rectangle Drawing}
{  Note that the following Box/Rectangle procedures are used for drawing     }
{  buttons, windows, etc. Changing the color values for these elements       }
{  will in turn affect the way other elements appear as well.                }
{                                                                            }
PROCEDURE RaisedBox(X1,Y1,X2,Y2 : WORD);
{^ This procedure draws a bright gray box on the screen with a 3D frame at   }
{  its edges to make the box appear to be raised.                            }
PROCEDURE LoweredBox(X1,Y1,X2,Y2 : WORD);
{^ This procedure is identical to the above procedure, except the frame at   }
{  the edges of the box are reversed to give a lowered appearance.           }
PROCEDURE FrameHigh(X1,Y1,X2,Y2 : WORD);
{^ This procedure simply draws a rectangle on the screen where the top and   }
{  left sides are brighter colored than the bottom and right sides to give   }
{  the frame a raised appearance on the screen.                              }
PROCEDURE FrameLow(X1,Y1,X2,Y2 : WORD);
{^ This procedure is identical to the above procedure except the colors of   }
{  the sides of the rectangle are reversed in order to give it a lowereed    }
{  appearance on the screen.                                                 }
{Window Drawing/Undrawing}
{  Everything in the GUI kit is based on window drawing and undrawing. This  }
{  allows a person to basically design a menued program with little effort.  }
{  every time you draw a new window, all of the buttons, entry fields, and   }
{  flipping icon arrays are reset to zero. However, if you have one window   }
{  on the screen with these elements in it, and then draw another window on  }
{  top of the existing window, all of these settings are saved to disk for   }
{  you. As soon as you kill the window you just drew on the screen, all of   }
{  these button, entry field, and flipping icon are read back from the disk  }
{  and restored. All of this is handled automatically for you by the GUI...  }
{                                                                            }
PROCEDURE Draw_Window(X1,Y1,X2,Y2,WType : WORD ; Title : STRING);
{^ This procedure draws a window on the screen and automatically saves any   }
{  previously defined button, entry field, and flipping icon settings to the }
{  disk. The X1,Y1,X2,Y2 parameters are self explanatory, the WType variable }
{  defines which type of window to draw on the screen. The GUI kit supports  }
{  5 different window types, they are as follows:                            }
{                                                                            }
{  1. Standard Block (Similar to MS-Windows 3.XX or OS/2)                    }
{  2. Invisible      (Just a logical window for screen saving)               }
{  3. Flat Panel     (A window with no title header or shadow)               }
{  4. Transparent    (Similar to looking thru a window screen)               }
{  5. Standard Panel (Similar to Windows 95)                                 }
{                                                                            }
{  The last parameter is the string of text that you want to appear in the   }
{  the title bar of window types 1, 4, and 5...                              }
PROCEDURE Kill_Window;
{^ This procedure is used to kill the current window. If there are any other }
{  windows on the screen before the one you are killing, any button, entry   }
{  fields, or flipping icons will be automatically restored.                 }
PROCEDURE ExplodeBox(X1,Y1,X2,Y2 : INTEGER);
{^ If you have the ExplodeOn variable set to TRUE, any time a type 1, 3, 4,  }
{  or 5 window is drawn, an exploding XOR'ed box will be drawn first to give }
{  the effect that the window is expoding onto the screen. You may also call }
{  this procedure manually if you want to use this for any other purpose.    }
{Entry Field Related}
{  All entry fields used by the GUI are handled within a pointer array. This }
{  pointer array is nil until the first call to the Entry_Field procedure in }
{  a window. As soon as the window is killed or a new window is drawn, this  }
{  array is DISPOSE'd. It will be NEW'ed again automatically if a previous   }
{  window has any entry fields in it, and those variables will be restored   }
{  automatically as well. Do not attempt to access any Fields^[X].Variables  }
{  if there are no entry fields or you will experience an Runtime Error. You }
{  are also limited to a maximum of 128 entry fields per window. All fields  }
{  are numbered 1..128 and NFields reflects the total active entry fields.   }
{                                                                            }
PROCEDURE Entry_Field(X,Y,EType,ELength,ESize : WORD ; Stuff : STRING);
{^ This procedure will draw an entry field on the screen and will NEW the    }
{  Fields^[X] array automatically for you if no other entry fields are in    }
{  use. The X and Y parameters are the coordinates for the upper left side   }
{  of the entry field. EType defines which type of entry field to display,   }
{  there are 6 types, and they are defined as follows:                       }
{                                                                            }
{  0. Normal Input, all characters allowed.                                  }
{  1. Numeric Input only.                                                    }
{  2. Proper Input, for entering properly capitalized names.                 }
{  3. Date/Phone # Input.                                                    }
{  4. Secret masked Input.                                                   }
{  5. Upper Case Input.                                                      }
{                                                                            }
{  The ELength variable defines the character length of the entry field. The }
{  ESize variable defines the font size to use in the entry field, however,  }
{  keep in mind that entry fields only support two font types. Passing a 0   }
{  tells the field to use the 5x8 bitmapped font, passing a 1 tells it to    }
{  use the 8x16 ROM resident font. And finally, Stuff is a default string of }
{  text to stuff the entry field with when it is first drawn on the screen.  }
PROCEDURE ChangeField(Number : WORD);
{^ Even though the entry fields are automatically changed for the user when  }
{  they press the <ENTER>, <TAB>, or arrow keys, you may also change fields  }
{  using code within your programs. This procedure only changes variables in }
{  the GUI to set the current entry field, you need to make a call to the    }
{  next procedure to actually redraw the field to make it appear active.     }
PROCEDURE RedrawField;
{^ Redraws the currently selected entry field....This is most likely useful  }
{  only with the previous procedure.                                         }
{Button Related}
{  All buttons used by the GUI kit are handled within a pointer array. This  }
{  pointer array is nil until the first call to any button draw procedure in }
{  a window. As soon as the window is killed or a new window is drawn, this  }
{  array is DISPOSE'd. It will be NEW'ed again automatically if a previous   }
{  window has any buttons in it, and those variables will also be restored   }
{  automatically as well. Do not attempt to access any Buttons^[X].Variables }
{  if there are no buttons or you will experience an Runtime Error. You are  }
{  also limited to a maximum of 128 buttons per window. All buttons are      }
{  numbered 1..128 and NButtons reflects the total active buttons.           }
{                                                                            }
PROCEDURE Draw_Button(X,Y,Width : WORD ; Return : BYTE ; HasIcon : BOOLEAN ; Icon : BYTE ; Title : STRING);
{^ This procedure draws what is referred to the GUI System Button. This is a }
{  button that shows a title with the first letter highlighted as well as an }
{  icon at the far right side. The button is a fixed 20 pixels high and the  }
{  title as well as the icon appear to depress when clicked. The parameters  }
{  X and Y determine the coordinates of the upper left corner of the button. }
{  Width is the width of the button in pixels. Return is the ordinal value   }
{  of the key assigned to the button. HasIcon determines whether or not an   }
{  icon is drawn at the right side of the button. And finally, Title is the  }
{  string of text that will appear on the button in font type #2.            }
PROCEDURE Radio_Button(X,Y : WORD ; Return : BYTE);
{^ This procedure draws what is referred to as a Radio Button. This type of  }
{  button is drawn with the last two icons in the current 16x16 icon library.}
{  The X and Y parameters determine the coordinates of the upper left corner }
{  of the button zone, and Return is the ordinal value of the key assigned   }
{  to the button.                                                            }
PROCEDURE Click_Zone(X,Y,Width,Height : WORD ; Return : BYTE);
{^ This procedure draws a black frame on the screen with another raised frame}
{  inside of it. This is actually just an unfilled rectangular button, which }
{  appears to depress when clicked. The X and Y parameters are the same as   }
{  the other buttons, but now you define the pixel width and height of the   }
{  button with the Width and Height parameters. Return is also the same as   }
{  with the other buttons.                                                   }
PROCEDURE User_Button(X,Y,Width,Height : WORD ; Return : BYTE);
{^ This procedure works exactly as Click_Zone with the only exception that   }
{  this one draws a filled rectangular button on the screen.                 }
PROCEDURE Mouse_Field(X,Y,Width,Height : WORD ; Return : BYTE);
{^ This procedure works just like Click_Zone and User_Button, however, this  }
{  button is invisible until the mouse hotspot is within the the button zone.}
{  If you are familiar with Microsoft's (tm) Internet Explorer package, you  }
{  have seen this same effect in its menu bars. When you move the mouse into }
{  the button zone, a raised frame appears on the screen and depresses when  }
{  you click the mouse on it. The frame then disappears when you move your   }
{  mouse outside of the button zone.                                         }
PROCEDURE Ani_Button(X,Y : WORD ; Icon1,Icon2,Size,BType,Return : BYTE);
{^ This procedure draws what is referred to as an Animated Button. This is a }
{  button of fixed size that not only depressed when clicked, but also has a }
{  pair of icons that draw over top of each other in a toggling fashion. This}
{  is where the animation factor comes into play. The X and Y parameters are }
{  the coordinates of the upper left corner of the button. Icon1 is the icon }
{  that appears when the button is in its normal state. Icon2 is the icon    }
{  that appears when the button is in its depressed state. Size determines   }
{  the size of the icon and button, 1=16x16, 2=30x30, and 3=60x60. BType is  }
{  used to determine the style of button to display, 0=Unfilled, 1=Filled. If}
{  the icons you are using don't cover the full face of the button, you will }
{  want to use a filled button to add an "Erase" between icon displays.      }
{Scrolling Picklist Related}
{  Picklists in the GUI kit are limited to 800 elements due to the 64K limit }
{  in Pascal's data segment for real mode programs. This really shouldn't be }
{  a problem for most applications. The picklist itself uses the 8x8 pixel   }
{  ROM resident font because using bitmapped fonts result in extremely slow  }
{  performance when scrolling. The up side to this is that all text in your  }
{  picklists will always be perfectly uniformed due to the fact that the font}
{  is of fixed width for all characters unlike bitmapped fonts. The picklist }
{  buffer is nil until you make a call to New_PickList, and all picklist info}
{  is saved and restored just like the button, entry field, and flipping icon}
{  info when windows are drawn and killed. Also keep in mind that picklists  }
{  automatically add two buttons to the screen which are assigned to buttons }
{  #1 and #2. These buttons are used to scroll the picklist and are assigned }
{  to the up and down arrow keys on the keyboard. Keeping this in mind, you  }
{  need to make sure the picklist is drawn on the screen before any buttons. }
{                                                                            }
PROCEDURE New_PickList(X,Y,OnScreen,MaxChars : WORD);
{^ This procedure is used to draw the picklist on the screen and to NEW the  }
{  pointer array buffer for the picklist items (text). The X and X parameters}
{  determine the upper left corner of the picklist. OnScreen determines how  }
{  many picklist items will appear on the screen at any one time which has an}
{  upper limit of 30 items. MaxChars is the character width of the picklist  }
{  field which has an upper limit of 77 characters.                          }
PROCEDURE AddTo_PickList(InString : STRING);
{^ After you have made a call to New_PickList, you use this procedure to add }
{  items (text) to the picklist. The text actually goes into the PickList^[X]}
{  pointer array, but also affects the PickInfo.NumItems variable. Do not try}
{  to use this procedure until you have NEW'ed the picklist first!!!         }
PROCEDURE SetUp_PickList;
{^ This procedure is used to basically start up the picklist after you have  }
{  stuffed the picklist with items. Do not try to use this procedure until   }
{  you have NEW'ed and stuffed the picklist first!!!                         }
PROCEDURE Reset_PickList(Item : WORD);
{^ After you have NEW'ed and stuffed the picklist, you may want it to default}
{  to another item number besides item #1. Say that you have stuffed the     }
{  picklist with 150 items, but you want the picklist to default to item #75 }
{  when it is displayed. You would NEW the picklist, stuff the picklist, call}
{  this procedure with a 75 in it, and then call SetUp_PickList. The picklist}
{  will now pop up with item #75 highlighted (selected) automatically.       }
PROCEDURE PickText(X,Y : INTEGER ; Color : BYTE ; St : STRING);
{^ This is actually nothing more than a text output procedure just like the  }
{  OutText_XY procedure, except it only plots text in the 8x8 ROM resident   }
{  font which is what's used by the picklist.                                }
{Color Palette Related}
PROCEDURE Palette_Scroller(X,Y : WORD);
{^ This procedure draws the GUI color palette scroller at X/Y coordinates on }
{  the screen. The palette scroller is a vertical bar with buttons on both   }
{  ends to scroll through the palette. This procedure is somewhat similar to }
{  the New_PickList procedure. The currently selected color is held in the   }
{  Scroller.Current variable.                                                }
PROCEDURE SetUp_Scroller;
{^ This procedure is somewhat similar to the SetUp_PickList procedure, only  }
{  is specific to the palette scroller. You can simulate the effect of the   }
{  Reset_PickList procedure by setting Scroller.Top and Scroller.Current to  }
{  the same BYTE value and then calling this procedure. This procedure must  }
{  always be called after the Palette_Scroller procedure.                    }
{Text Editor/Reader Related}
{  The text file reader and text editor in the GUI kit function is a similar }
{  fashion to the picklists. There is one record that stores the data for the}
{  reader and editor, and a pointer array that functions as a text buffer.   }
{  The text reader buffer is limited to 800 lines and the text editor buffer }
{  is limited to 800 lines. Any time you have a text editor or reader active }
{  and draw another window over top of it, all settings and buffers will be  }
{  saved to disk and immediately restored as soon as you kill the window.    }
{                                                                            }
PROCEDURE New_TextReader(Y : WORD);
{^ This procedure initializes the text file reader at the row specified by   }
{  the Y variable. The text file reader uses font type #3, so the reader is  }
{  always using the full width of the screen. The reader also automatically  }
{  adds two buttons to the screen assigned to buttons #1 and #2. So be sure  }
{  you always call this procedure before drawing any other buttons!!!        }
PROCEDURE FillTextBuffer(F : STRING);
{^ This procedure is used to stuff the text buffer after you have NEW'ed it  }
{  with the New_TextReader or New_TextEditor procedures. The F variable is   }
{  the file name of a text file to load into the buffer. Again, never call   }
{  this procedure until after a call to New_TextReader or New_TextEditor!!!  }
PROCEDURE ShowTextPage;
{^ After you have NEW'ed the text reader and stuffed the buffer with text,   }
{  you then call this procedure to start up the text reader. Absolutely do   }
{  not call this procedure before New_TextEditor and FillTextBuffer!!!       }
PROCEDURE New_TextEditor(Row : WORD);
{^ This procedure initializes the text file editor at the row specified by   }
{  the Row variable. The text file reader uses font type #3, so the editor is}
{  always using the full width of the screen. This procedure does not use the}
{  MouseHandler function at all, and the mouse is hidden while the editor is }
{  active. Unlike the text file reader, this procedure adds no buttons.      }
PROCEDURE RunTextEditor;
{^ After you have NEW'ed the text file editor and optionally stuffed it with }
{  text, you call this procedure to run the text editor. Absolutely do not   }
{  call this procedure until after a call to New_TextEditor!!!               }
{Miscellaneous Stuff}
FUNCTION  MouseHandler(DoKeys : BOOLEAN) : BYTE;
{^ This is the meat and potatos of the GUI kit. This function performs the   }
{  big nasty loop that processes all buttons, picklists, text readers, entry }
{  fields, window dragging, etc. The DoKeys parameter determines whether or  }
{  not any keyboard input is allowed. If you are using entry fields, the you }
{  certainly want to set this to TRUE. Setting this to FALSE will force the  }
{  user to use only their mouse for all input. The BYTE return value of this }
{  function reflects the number of the button clicked, and will also return  }
{  the button number if a matching keypress equals a button Return value. You}
{  should keep in mind that if you are relying on this function wholely to do}
{  all of the keyboard handling, all of your buttons must be assigned to an  }
{  ALT keypress. Otherwise, you would combine this function with a procedure }
{  to also trap the MC and AltKey variables. Keep in mind that if no key is  }
{  pressed, this function sets MC to #255 before it exits.                   }
PROCEDURE ResetGraphics;
{^ Simply resets all variables in this unit to their default values.         }
PROCEDURE Show_Mem;
{^ Redisplays the banner in the lower left corner of the screen where the    }
{  current amount of free conventional memory is displayed.                  }
PROCEDURE ShowMouse;
{^ Shows the mouse cursor and sets the variable MouseOn to TRUE.             }
PROCEDURE HideMouse;
{^ Hides the mouse cursor and sets the variable MouseOn to FALSE.            }
PROCEDURE Text_View_Port(X1,Y1,X2,Y2 : INTEGER);
{^ This procedure initializes and starts up the ANSI/TTY text view port, or  }
{  SVGA ANSI/TTY emulation feature. See GUI_ANSI.TXT for more information... }
PROCEDURE AnsiFullScreen;
{^ Starts up the SVGA ANSI/TTY emulation feature.                            }
PROCEDURE ShutDownSvga;
{^ Temporarily shuts down the SVGA interface and returns to text mode.       }
PROCEDURE RestartSvga;
{^ Restarts the SVGA interface after a call to ShutDownSvga.                 }
{}
