home *** CD-ROM | disk | FTP | other *** search
/ Windoware / WINDOWARE_1_6.iso / source / winobj / winobj.doc < prev    next >
Text File  |  1991-01-14  |  40KB  |  1,131 lines

  1.  
  2.                              Object Windows
  3.  
  4.                        The C++ Window Class System
  5.  
  6.                                Version 1.0
  7.  
  8.                             January 10, 1991
  9.  
  10.                           by Lake View Software
  11.  
  12.                  Copyright (c) 1991  All Rights Reserved
  13.  
  14.                             Reference Manual
  15.  
  16.  
  17.  
  18.  
  19. ****************************************************************************
  20.                          Features of Object Windows
  21. ****************************************************************************
  22.  
  23.         -   Powerful windowing system.  Allows as many window objects as
  24.             memory permits.  Windows objects can be stacked, tiled, moved,
  25.             resized, and changed in many other ways.  There is a whole
  26.             assortment of various input and output messages to interact
  27.             with windows.  All window are active and can be written to
  28.             at any time.
  29.  
  30.         -   All windows can be virtual.  This allows you to create
  31.             windows larger than the screen.  Data entry screens automatically
  32.             pan around the virtual window as the user moves the cursor.
  33.             panning can also be software controlled.
  34.  
  35.         -   Multi-field formatted data entry.  You can create data entry
  36.             forms that consist of one or more input fields.  You have full
  37.             control over user input and can tie validation functions into
  38.             each input field.
  39.  
  40.         -   Moving bar menus.  You can easily create pop-up, pull-down, and
  41.             Lotus-style menus, as well as any other custom menu that you can
  42.             define.
  43.  
  44.         -   Scrollable pick menus.  Allow you to pick one item from a list
  45.             of items.
  46.  
  47.         -   Several video output methods.  These include direct screen
  48.             writing, direct screen writing with CGA snow reduction, and
  49.             video BIOS writing.
  50.  
  51.         -   Keyboard management routines.  Allows you to tie keystrokes to
  52.             functions, and specify a function to be called while waiting
  53.             for a keypress.
  54.  
  55.         -   Soon to come will be a fully interactive screen painter.  This
  56.             will allow for simple creation of windowed screen data entry.
  57.  
  58.  
  59. ****************************************************************************
  60.                          Registration Information
  61. ****************************************************************************
  62.  
  63.     Window Objects is distributed as User-Supported software.  You are free
  64.     to copy and distribute this software freely, however, if you find it of
  65.     use to you, you are encouraged to register your copy.  Registering your
  66.     copy of the software helps the author continue to provide professional-
  67.     quality software at very reasonable prices.
  68.  
  69.     The Basic Registration is $35.00 and includes the remaining memory
  70.     models: Small, Compact, Medium, Large, and Huge. Royalty-free use of
  71.     library functions, unlimited technical support, and low-cost upgrades.
  72.     The fully interactive screen painter will is an added bonus.
  73.  
  74.     The Full Registration is $50.00 and includes all memory models plus
  75.     full library source.  The library is completely written in C++ using
  76.     Borland's Turbo C++ v1.0.  All window classes use the same low-level
  77.     C functions.  This allows easy porting to other operating systems.
  78.     This will also include source to the interactive screen painter.
  79.  
  80.     All materials are shipped on 5.25-inch or 3.5-inch floppy diskettes.
  81.     Please specify when ordering.
  82.  
  83.     Non-U.S. orders need to include $5.00 extra to cover additional shipping
  84.     and handling charges.  Checks and money orders must be drawn on a U.S.
  85.     bank.  Please send all payments payable in U.S. Dollars to:.
  86.  
  87.                 ******************************************
  88.                 *           Lake View Software           *
  89.                 *           4321 Harborough Rd.          *
  90.                 *           Columbus, OH 43220           *
  91.                 ******************************************
  92.  
  93.     All major upgrades will be available for only $15.00.
  94.  
  95.     Please report any errors (BUGS) or suggestions
  96.     to Lake View Software at:
  97.  
  98.                  GEnie:  J.CAPUTO1
  99.             CompuServe:  74270,1140
  100.  
  101.  
  102. ****************************************************************************
  103.                                 Files
  104. ****************************************************************************
  105.  
  106.     WINOBJ_S.LIB    =   WinObj library.  You must link to this file to
  107.                         use any of the windows object messages.  The demo
  108.                         is distributed with the Small model library only.
  109.  
  110.     WINOBJ.HPP      =   WinObj class definitions.  Must be #included in
  111.                         your program to link with winobj.lib.  This will
  112.                         also include win.h.
  113.  
  114.     WINMENU.HPP     =   WinMenu class definitions.  Must be #included in
  115.                         any program using the menuing system.  This header
  116.                         file will include winobj.hpp with it.
  117.  
  118.     WINPICK.HPP     =   WinPick class definitions.  Will include winobj.hpp
  119.                         with it.
  120.  
  121.     WIN.H           =   Defines low level .C functions used by WinObj.lib.
  122.                         Also defines various window function options and
  123.                         key strokes.  This is automatically included with
  124.                         winobj.hpp
  125.  
  126.     DEMO.EXE        =   A demo program written using Object Windows.
  127.  
  128.     DEMO.CPP        =   Demo program using the WinObj library.
  129.  
  130.     DEMO.MAK        =   Make file for demo.cpp.
  131.                         To build demo.exe:
  132.                             MAKE -fDEMO
  133.  
  134.     SCR.EXE         =   An interactive screen painter.  This program can
  135.                         greatly aid in designing screen.  When finished
  136.                         you can produce the base source code for your
  137.                         applications.  The screen painter was written
  138.                         using Object Windows.  Registered users will
  139.                         receive complete C++ source to SCR.EXE.  SCR
  140.                         was written using the Object Windows Library.
  141.  
  142.     SCR.DOC         =   Interactive Screen Painter documentation.
  143.  
  144.     SCRDEMO.SCR     =   A demo screen for use with the Screen Painter.
  145.  
  146. *****************************************************************************
  147.                         Declaring a Window Object
  148. *****************************************************************************
  149.  
  150.     WinObj <Object> (int v_h=0,int v_w=0)
  151.  
  152.         v_h     =   Virtual height of the window.  Default is 0
  153.                     If declared as the default (0) then the virtual
  154.                     height will be set to the height of the window
  155.                     when it is opened.
  156.  
  157.         v_w     =   Virtual width of the window.  Default is 0
  158.                     If declared as the default (0) then the virtual
  159.                     width will be set to the width of the window
  160.                     when it is opened.
  161.  
  162.         The virtual height and width can be changed any time the window
  163.         is not opened, using the set_virtual message.
  164.  
  165.         EXAMPLE:
  166.                 WinObj window_a;
  167.                 main()
  168.                 {
  169.                     WinObj window_b ( 100, 100);
  170.                     ~ ~ ~ ~
  171.                     ~ ~ ~
  172.                     ~ ~ ~
  173.                 }
  174.  
  175. ****************************************************************************
  176.                                 WinObj Messages
  177. ****************************************************************************
  178.  
  179.  
  180. center
  181.     Centers a string in the virtual window, using the current attribute.
  182.  
  183.     USAGE:  int center (int y, char *str);
  184.  
  185.  
  186.     RETURNS:    W_OK,W_NOTOPEN
  187. ========================================
  188. change_border
  189.     Changes the border style for the window object.  Optionally changes the
  190.     border color.
  191.  
  192.     USAGE:  void change_border (int type, int color = -1);
  193.  
  194.     Required arguments.
  195.         type    =   new border type.  Use any of the types below.
  196.             W_SPACES
  197.             W_DOUBLE        W_SINGLE
  198.             W_DOUSIN        W_SOLID
  199.  
  200.     Optional arguments.
  201.         color   =   new border attribute.  Default is -1 which
  202.                     will leave border color unchanged.
  203.  
  204.     EXAMPLE:
  205.         main()
  206.         {
  207.             WinObj a;
  208.             a.open (12,12,20,50);
  209.             ~~~
  210.             a.change_border ( W_DOUSIN, _BLUE|WHITE);
  211.             ~~
  212.             ~
  213.             a.close();
  214.         }
  215. =======================================
  216. close
  217.     Close the window object.  A window object can be opened and closed
  218.     as often as you like through its life.  A window will automatically be
  219.     closed when it leaves the scope of your application.
  220.  
  221.     USAGE:  void close();
  222.  
  223.     EXAMPLE:
  224.         main()
  225.         {
  226.             WinObj a;
  227.             a.open (12,12,20,50);
  228.             ~~~
  229.             ~~
  230.             ~
  231.             a.close();
  232.             a.open (10,10,15,35,W_SPACES,_BLUE|GREEN);
  233.             a.close();
  234.         }
  235. =======================================
  236. clr_eol
  237.     Clears the window to the end of the current line.
  238.     The cursor position is not changed.
  239.  
  240.     USAGE:  void clr_eol();
  241. =======================================
  242. clr_win
  243.     Clears the window with the current attribute.
  244.  
  245.     USAGE:  void clr_win();
  246.  
  247.     EXAMPLE:
  248.         main()
  249.         {
  250.             WinObj a;
  251.             a.open (1,1,12,40);
  252.             a.bprintf("This is a test string.");
  253.             a.set_attr(_BLUE|WHITE);
  254.             a.clr_win();
  255.             a.close();
  256.         }
  257. =======================================
  258. del_line
  259.     Deletes a line in the window object.  All text below the line
  260.     is pulled up and a blank line is inserted at the end.  The cursor
  261.     position will not be changed.
  262.  
  263.     USAGE:  void del_line (int y);
  264.         y = row to be deleted.
  265. =======================================
  266. gotoxy
  267.     Move the cursor inside the window.
  268.  
  269.     USAGE:  void gotoxy (int y=0, int x=0);
  270.  
  271.     Optional arguments.
  272.         y   =   New y location.  default to origin.
  273.         x   =   New x location.  default to origin.
  274.  
  275.     EXAMPLE:
  276.         main()
  277.         {
  278.             WinObj a;
  279.             a.open (12,12,20,50);
  280.             ~~~
  281.             a.gotoxy(5,5);
  282.             ~
  283.             a.close();
  284.         }
  285. =======================================
  286. hide
  287.     Hides the window object.  Non of the window contents will be changed.
  288.  
  289.     USAGE:  void hide ();
  290.  
  291. =======================================
  292. ins_line
  293.     Insert a line in the window object.  All text from the line down is
  294.     pushed down. The last line will be pushed out of the window.  A blank
  295.     line will be inserted.  The cursor position will not change.
  296.  
  297.     USAGE:  void ins_line(int y);
  298.         y = row number to be inserted.
  299. =======================================
  300. move
  301.     Moves a window on the screen.  The window contents are left in tact.
  302.     The window does not have to be active to move.  It will slide under
  303.     other windows if needed.
  304.  
  305.     USAGE:  int move (int start_y,int start_x);
  306.  
  307.         start   = new start coordinates for the upper left of the window
  308.                   object.
  309.  
  310.     RETURNS:  W_OK, or W_ERROR if your coordinates cause the window to
  311.               move off the screen.
  312. =======================================
  313. open
  314.     Opens a window object on the screen.
  315.  
  316.     USAGE: int open (int sr,int sc,int er,int ec,
  317.                      int btype=W_DOUBLE,int wattr=_BLACK|LGREY,
  318.                      int battr=_BLACK|LGREY)
  319.  
  320.     RETURNS:    0 if successful.
  321.  
  322.     Required arguments.
  323.         sr      =   Start row for the window.
  324.         sc      =   Start column for the window.
  325.         er      =   End row for the window.
  326.         ec      =   End column for the window.
  327.     Optional arguments.
  328.         btype   =   Border type.  default is W_DOUBLE.
  329.             W_NOBORDER      W_SPACES
  330.             W_DOUBLE        W_SINGLE
  331.             W_DOUSIN        W_SOLID
  332.         wattr   =   Window attribute. default is _BLACK|LGREY.
  333.         battr   =   Border attribute. default is _BLACK|LGREY.
  334.  
  335.     EXAMPLE:
  336.         main()
  337.         {
  338.             WinObj a;
  339.             a.open (12,12,20,50);
  340.             ~~~
  341.             ~~
  342.             ~
  343.         }
  344. =======================================
  345. pan
  346.  
  347.     Adjust the virtual window by delta number of characters.  The
  348.     window automatically adjusts it pan location when you move the
  349.     cursor.  This keeps the cursor always in the window.  You can
  350.     use pan to adjust it manually if you need.
  351.  
  352.     USAGE:  int pan (int delta_y, int delta_x);
  353.  
  354.          delta  = the change in the x and/or y coordinate.
  355.  
  356.     RETURNS:    W_OK, W_NOTOPEN
  357.  
  358.     SEE:  set_pan()
  359.  
  360. =======================================
  361. printf && bprintf
  362.  
  363.     Display a formatted string in the window at the current cursor position.
  364.     bprintf will print to the window buffer and will not be displayed until
  365.     a refresh is called.  These functions work very much like the printf
  366.     function in C.  Both have an optional xy coordinate.
  367.  
  368.     USAGE:  void printf (char *,...);
  369.             void bprintf (char *,...);
  370.             void bprintf ( int y, int x, char *,...);
  371.             void printf  ( int y, int x, char *,...);
  372.  
  373.     EXAMPLE:
  374.         main()
  375.         {
  376.             WinObj a;
  377.             int i = 2;
  378.             a.open (12,12,20,50);
  379.             a.gotoxy(5,5);
  380.             a.bprintf("( 2 + 2 = %d )",i+2);
  381.             a.gotoxy();
  382.             a.bprintf("This is the window origin.");
  383.             a.update();
  384.             ~
  385.             a.close();
  386.         }
  387. =======================================
  388. set_active
  389.     Brings a window to the surface.  This will also unhide a function.
  390.     Set_active is called each time you input a keystroke from a window.
  391.  
  392.     USAGE:  void set_active();
  393.  
  394. =======================================
  395. set_attr
  396.     Sets a new default attribute for the window object.
  397.  
  398.     USAGE:  int set_attr (int new_attr);
  399.  
  400.     RETURNS:    previous attribute.
  401.  
  402.     Required arguments.
  403.         new_attr    =   New attribute for window.  Can be any legal color
  404.                         Mono screens will be remapped to use only black on
  405.                         white or white on black.
  406.  
  407.     EXAMPLE:
  408.         main()
  409.         {
  410.             WinObj a;
  411.             a.open (12,12,20,50);
  412.             ~~~
  413.             a.new_attr (_RED|YELLOW);   // All characters from this point will
  414.                                         // be displayed as yellow on red.
  415.             ~~~
  416.             ~~
  417.             ~
  418.             a.close();
  419.         }
  420. =======================================
  421. set_attr
  422.     changes the attribute for a region in a window.
  423.  
  424.     USAGE:  void set_attr (int new_attr,int y,int x,int cnt=1);
  425.  
  426.         new_attr    = new attribute for the region.
  427.         y,x         = start y,x coordinates.
  428.         cnt         = number of characters to change.  default is 1.
  429.  
  430. =======================================
  431. set_fill
  432.     Set the window fill character.  Default is spaces.
  433.  
  434.     USAGE:  void set_fill (char ch);
  435. =======================================
  436. set_virtual
  437.     Changes the virtual height and width of a window.  This
  438.     can only be done when the window is closed.
  439.  
  440.     USAGE:  int set_virtual (int vh, int vw);
  441.  
  442.         vh  = new virtual height.
  443.         vw  = new virtual width.
  444.  
  445.     Setting the vh and/or vw to zero causes them to be automatically set
  446.     when open is called.
  447.  
  448.     RETURNS:    W_OK or W_OPENED
  449. =======================================
  450. size
  451.     Set a new size for the displayed window object.  The virtual height
  452.     and width are left unchanged.  This means you can not make a window
  453.     larger than its virtual sizes.
  454.  
  455.     USAGE:  int size (int new_height,int new_width);
  456.  
  457.     RETURNS:  W_OK, or W_ERROR if your new size is less than 1.
  458. =======================================
  459. title
  460.     Add, change or remove a window title.  The window title will have the
  461.     same attribute as the window border.
  462.  
  463.     USAGE:  void title(char *str,int position=W_CENTER);
  464.  
  465.     Required arguments.
  466.         str         =   Title string to display.  If NULL then the window
  467.                         title will be removed.
  468.     Optional arguments.
  469.         position    =   Position of the title.  default is Center.
  470.             W_CENTER    W_LEFT      W_RIGHT
  471.  
  472.     EXAMPLE:
  473.         main()
  474.         {
  475.             WinObj a;
  476.             a.open (12,12,20,50);
  477.             a.title ("[ Window 1 ]", W_LEFT);
  478.             ~~~
  479.             ~
  480.             a.close();
  481.         }
  482. =======================================
  483. unhide
  484.     Unhide a hidden window object.
  485.  
  486.     USAGE:  void unhide ();
  487. =======================================
  488. update
  489.     Update the window object.  This will display all buffered output.
  490.     The window does not have to be the active window to be updated.
  491.  
  492.     USAGE:  void update();
  493.  
  494.     EXAMPLE:
  495.         see printf
  496.  
  497.  
  498.  
  499.  
  500. *****************************************************************************
  501.                     Window Input Routines
  502. *****************************************************************************
  503. get_key
  504.     Get a key from the keyboard at the current window location.  A refresh
  505.     will be automatically called if needed.
  506.  
  507.     USAGE:  int get_key (int echo=W_NOECHO);
  508.  
  509.     Optional arguments.
  510.         echo    =   Determine weather or not to echo the keystroke to the
  511.                     window.  default = no echo.
  512.                             W_ECHO      W_NOECHO
  513.  
  514.     Returns.
  515.         Ascii and key scan code from win.h.
  516.             key & 0x00ff  = Ascii character returned
  517.             key >>8       = Scan code.
  518.  
  519.     EXAMPLE:
  520.         main()
  521.         {
  522.             WinObj a;
  523.             a.open (1,1,12,40);
  524.             a.bprintf("This is a test string.");
  525.             a.bprintf(2,0,"Press Escape to exit.");
  526.             while (a.get_key() != ESC);
  527.             a.close();
  528.         }
  529. =======================================
  530. get
  531.     Get a variable from a screen window.  Will display each get with the
  532.     current get_attr attribute.
  533.  
  534.     USAGE:  int get (int y,int x,long int i, int len=5);
  535.             int get (int y,int x, double d, int len=10, int dec=2);
  536.             int get (int y,int x, char *str, char *picture=NULL);
  537.             int get (int y,int x, char *str, char style);
  538.  
  539.     Valid Picture characters.
  540.             x   =   Allow any character.
  541.             X   =   Allow any character.  Letters will be converted to
  542.                     upper case.
  543.             a   =   Allow letters and spaces only.
  544.             A   =   Allow letters and spaces only.  Letters will be
  545.                     converted to upper case.
  546.             9   =   Allow numbers and spaces only.
  547.  
  548.             Any other characters in a picture clause will be forced into
  549.             the output string. ie ( , - and even spaces.
  550.  
  551.     Valid Style characters
  552.                     L   convert field to 'L'owercase.
  553.                     U   convert field to 'U'ppercase.
  554.                     F   convert 'F'irst character to uppercase.
  555.                     D   MM/DD/YY date field.
  556.                     S   999-99-9999 Social Security number field
  557.                     P   (999) 999-9999 phone number.
  558.                     Z   99999-9999 zip code.
  559.  
  560.         Warning:
  561.             If a NO picture is used the len of the string (str) will be used
  562.             and any characters will be allowed.  This is the default.  Be
  563.             sure you have a NULL terminated string.
  564.  
  565.             The length of the picture clause will override the len of the
  566.             string.
  567.  
  568.             If a style is used be sure the char * has enough space to
  569.             accomidate the style type.
  570.  
  571.     EXAMPLES:
  572.             char state[] = "  ";
  573.             long i=0;
  574.             double d;
  575.             char phone[16]="";
  576.             char name[16]="", ss[12]="";
  577.  
  578.             get (10,10,state,'U');      // state forced to upper case.
  579.             get (12,10,i,3);        // get a 3 digit integer
  580.             get (13,10,d);          // get a 2 decimal double, 10 chars. long
  581.             get (15,10,name,"Xxxxxxxxxxxxxx");  get a 15 char. name with the
  582.                                                  first character forced to upper
  583.             get (20,10,phone,"(999) 999-9999");  get a phone number using a
  584.                                                  picture statement.
  585.             get (21,10,ss,'S');    // get a ss # using a style.
  586.  
  587.     RETURNS:
  588.             W_OK if successful.
  589.             W_ERROR if invalid x,y.
  590.             W_NOTOPEN if window not opened.
  591. =======================================
  592. valid
  593.     Assign a valid function to the previous get.
  594.  
  595.     USAGE:  int valid (int (*func)(void *));
  596.  
  597.     func() will be called each time the user attempts to leave the
  598.     get field.  read will not let the user leave the current get until
  599.     your valid function returns a non zero value.  The read function
  600.     will let the user exit the read with a press of ESC regardless if
  601.     the valid function returns true.
  602.  
  603.     The valid function will be called with a pointer to the current
  604.     get object.  This can be a long, double or string pointer.
  605.  
  606.     RETURNS:
  607.         0  if successful.
  608.         -1 if no previous get.
  609. =======================================
  610. clear_gets
  611.     Clear all gets for a window.  This allows you to use the get
  612.     system to display the data but not read it from the screen.
  613.  
  614.     USAGE:  void clear_gets()
  615. =======================================
  616. read
  617.     Read all gets from the window object.
  618.  
  619.     USAGE:  int read();
  620.  
  621.     RETURNS:
  622.             Key pressed to exit read.  User can exit with an Enter on
  623.             the last field, Escape, or PgDn.
  624.  
  625. ****************************************************************************
  626.                             Information Functions
  627. ****************************************************************************
  628.  
  629. do_youown
  630.     Ask a window object if it owns a coordinate on the screen.  If it
  631.     does then return the character and attribute of that coordinate.
  632.     Owning a coordinate means the window is the most active in that
  633.     spot on the screen.  It is posible for a window to use a spot on
  634.     the screen but not be the current owner.  A hidden window owns
  635.     NO spots on the screen.
  636.  
  637.     USAGE:  int do_youown (int y,int x, char &ch, char &attr);
  638.         y,x     physical screen coordinates.
  639.         ch      will return with the character if owned.
  640.         attr    will return with the attribute if owned
  641.  
  642.     RETURNS:    0 if not owned
  643.                 1 if the window owns the coordinate.
  644.  
  645.     SEE:    who_owns()
  646. ========================================
  647. get_pan
  648.     get the current virtual starting point for the displayed window.
  649.  
  650.     USAGE:  int get_pan(int &y, int &x)               // return current pan coord
  651.  
  652.             When called, get_pan will set y,x to the current start location
  653.             for the virtual window.
  654.  
  655.     RETURNS:    W_OK or W_NOTOPEN.
  656. ========================================
  657. get_scr
  658.     get the current screen location of the window
  659.  
  660.     USAGE:  int get_scr (int &sr,int &sc,int &er,int &ec);
  661.  
  662.             When called, get_scr will set sr,sc,er,ec to the current
  663.             window location on the screen.
  664.  
  665.     RETURNS:    W_OK or W_NOTOPEN
  666. ========================================
  667. is_open
  668.     report windows open status.
  669.  
  670.     USAGE:  int is_open();
  671.  
  672.     RETURNS: true if open, 0 if not.
  673. ========================================
  674. max_x
  675.     get maximum x coordinate for window.
  676.  
  677.     USAGE:  int max_x();
  678.  
  679.     RETURNS:
  680.             max x coordinate or W_NOTOPEN if window is not opened.
  681.  
  682. ========================================
  683. max_y
  684.     get maximum y coordinate for window.
  685.  
  686.     USAGE:  int max_y();
  687.  
  688.     RETURNS:
  689.             max y coordinate or W_NOTOPEN if window is not opened.
  690.  
  691. ========================================
  692. ret_char
  693.     retrieve a character from a window objext.
  694.  
  695.     USAGE:  int ret_attr(int y,int x);
  696.  
  697.     RETURNS:  The ascii value of the character at the given window
  698.               coordinates.
  699. =======================================
  700. ret_attr
  701.     retrieve an attribute from a window object.
  702.  
  703.     USAGE:  int ret_attr (int y,int x);
  704.  
  705.     RETURNS:  The attribute value of the character at the given window
  706.               coordinates.
  707. ========================================
  708. wherexy
  709.     get the current cursor location for the window.
  710.  
  711.     USAGE:  int wherexy(int &y,int &x);
  712.  
  713.             When called, wherexy will set y,x to the current cursor coordinates
  714.  
  715.     RETURNS:    W_OK or W_NOTOPEN.
  716. ========================================
  717. who_owns
  718.     Return a pointer to the window object which owns a coordinate on the
  719.     screen.
  720.  
  721.     USAGE:  WinObj *who_owns (int y,int x,char &ch,char &attr);
  722.         y,x     physical screen coordinates.
  723.         ch      will return with the character if owned by anyone.
  724.         attr    will return with the attribute if owned by anyone.
  725.  
  726.     RETURNS:  A pointer to the window object who owns the spot
  727.               on the screen.
  728.               0 if not owned.
  729.  
  730. ****************************************************************************
  731.                             Menu Objects
  732. ****************************************************************************
  733.     WinMenu  <Object>
  734.  
  735.     Menu objects are derived from WinObj objects.  This means the
  736.     window messages are also available to the menu objects, with a few
  737.     additions to aid in the constructions of menus.
  738.  
  739.  
  740.     There are three necessary steps to creating a menu.
  741.         1.) Open the menu as you would any other window.  This gives
  742.             it a location and color on the screen.
  743.         2.) Declare your menu selections.  (prompt)
  744.         3.) Read the menu.  This returns the user selection.
  745.  
  746.         EXAMPLE:
  747.                 main()
  748.                 {
  749.                     WinMenu  m;
  750.                     m.open (4,23,16,53,W_SOLID,_BLUE|WHITE,_BLUE|DGREY);
  751.                     m.title ("[ Demo Menu ]");
  752.                     m.prompt (1,4,1,"Data entry");
  753.                     m.prompt (3,4,2,"Moving windows");
  754.                     m.prompt (5,4,3,"Random windows");
  755.                     m.prompt (7,4,4,"Menu demo");
  756.                     m.prompt (9,4,0,"Quit");
  757.                     int choice = m.read(1);
  758.                     switch (choice) {
  759.                         case 1:
  760.                             ~~~~~~
  761.                             break;
  762.                         case 2:
  763.                             ~~~~~~
  764.                             break;
  765.                         ~~~~~~
  766.                     }
  767.                 }
  768.  
  769.  
  770. ****************************************************************************
  771.                             Menu Messages
  772. ****************************************************************************
  773. prompt
  774.     declares a menu selection.  The selection will not be displayed in
  775.     the window until you call read.
  776.  
  777.     USAGE:  int prompt(int y,int x,int return_val,char *str,char *message=NULL);
  778.  
  779.         y           = The start row in the menu window.
  780.         x           = The start column in the menu window.
  781.         return_val  = The value you wish this selection to return.
  782.         str         = The prompt string.
  783.         message     = The message to display in the optional message box
  784.                       when this prompt is pointed to.
  785.  
  786.     RETURNS:    W_NOMEM if out of memory
  787.                 W_NOTOPEN if the menu has not been opened.
  788.                 W_OK
  789. ==========================================
  790. read
  791.     Read the user selection from the menu window.
  792.     The user can use the arrow keys to move from one selection to the next,
  793.     then press Enter to make the selection.  The user can also press the
  794.     first letter of the menu selection.  The read function will also unhide
  795.     a previously hidden menu object.
  796.  
  797.     USAGE:  int read (int start_pos);
  798.  
  799.         start_pos   = the first selection to point to.  The read function
  800.                       will attempt to match start_pos with one of the
  801.                       return_vals used in the prompt function.  It will
  802.                       then point to this selection first.
  803.  
  804.     RETURNS:  W_ERROR if no prompts were activated.
  805.               W_ESCAPE if escape was used to exit.
  806.  
  807.               Otherwise it returns the return_val of the user selected
  808.               prompt.
  809. ==================================================
  810. reset
  811.     This resets a menu object and closes it so you can use it again for
  812.     a different type of menu.
  813.  
  814.     USAGE:  void reset();
  815. ==================================================
  816. set_barattr
  817.     This sets the attribute for the menu selection bar.  The default
  818.     is _LGREY|BLACK.
  819.  
  820.     USAGE:  int set_barattr(int attr);
  821.  
  822.     RETURNS:    the previous attribute.
  823. ==================================================
  824. message_line
  825.     This sets the screen line to display a menu message.  The menu read
  826.     message will open a 1 line window using this entire screen line.  Your
  827.     declared messages will be displayed in this window as the user moves
  828.     the menu bar.
  829.  
  830.     USAGE:  int message_line (int new_line_no);
  831.  
  832.         new_line_no = the line number to use. if this is less than 0
  833.                       no message line will be used.  The menu object
  834.                       default is -1;
  835.  
  836.     RETURNS:    the previous line number.
  837.  
  838.     EXAMPLE:
  839.         main()      // A lotus style menu.
  840.         {
  841.             WinMenu m;
  842.             m.open (1,0,1,79,W_NOBORDER,_BLUE|WHITE);
  843.             m.message_line(2);
  844.             m.prompt (0, 1,1,"Worksheet","Global, Column, Status, Delete");
  845.             m.prompt (0,12,2,"Range","Format, Label, Erase, Name, Justify,
  846. Prot");
  847.             m.prompt (0,19,3,"Copy","Copy a cell or range of cells");
  848.             m.prompt (0,25,4,"Move","Move a cell or range of cells");
  849.             m.prompt (0,31,5,"File","Retrieve, Save, Combine, Xtract...");
  850.             m.prompt (0,37,6,"Print","Print a worksheet to a printer or file");
  851.             m.prompt (0,44,0,"Quit","Quit the menu demo");
  852.  
  853.             int choice=1;
  854.             while (choice != 0) {
  855.                 choice = m.read(choice);
  856.                 switch (choice) {
  857.                     case 1:
  858.                         menu_demo2();
  859.                         break;
  860.                     case 2:
  861.                         break;
  862.                 }
  863.             }
  864.         }
  865.  
  866. ===============================================
  867. message_attr
  868.     Changes the attribute for the message line.  The default is
  869.     _BLACK|WHITE.
  870.  
  871.     USAGE:  int message_attr(int new_attr);
  872.  
  873.     RETURNS:    the previous attribute.
  874.  
  875. ****************************************************************************
  876.                             Pick-List Object
  877. ****************************************************************************
  878.  
  879.     WinPick  <Object>
  880.  
  881.     Pick-List objects ar derived from WinObj objects.  This means the window
  882.     messages are also available to the pick-list objects, with a few
  883.     additions to aid in the construction of pick-lists.
  884.  
  885.     There are three necessary steps to creating a pick-list.
  886.         1.) Open the pick-list window the same as you would open
  887.             any other window.  This gives it a location and color
  888.             on the screen.
  889.         2.) Assign a char * array to the list object.
  890.         3.) Read the pick list.  This returns the user selection.
  891.  
  892.     EXAMPLE:
  893.         char *list[] = { "January","February",
  894.                          "March","April",
  895.                          "May","June",
  896.                          "July","August",
  897.                          "September","October",
  898.                          "November","December", 0 };
  899.  
  900.         void main()
  901.         {
  902.             WinPick pl;
  903.             pl.open (6,41,11,53,W_DOUSIN,_BLUE|WHITE,_BLUE|BLACK);
  904.             pl.prompt (list);
  905.             int choice = pl.read();
  906.             WinObj w;
  907.             w.open (6,23,11,53,W_DOUSIN,_BLUE|WHITE,_BLUE|BLACK);
  908.             w.printf (1,1,"You picked %s.",list[choice]);
  909.             w.set_attr(_BLUE|LGREY);
  910.             w.printf (3,1,"Press any key to continue.");
  911.             w.get_key();
  912.         }
  913.  
  914. ****************************************************************************
  915.                           Pick-List Messages
  916. ****************************************************************************
  917. prompt
  918.     assigns an array of characters pointers to the list object.  This can be
  919.     any size list of character strings.  The last element of the list must
  920.     be a NULL pointer, or you must provide a count of items to pick from.
  921.  
  922.     USAGE: void prompt(char *list[],int count=-1);
  923.  
  924.         list    =   a pointer to the list of strings.
  925.         count   =   the number of elements to pick from. (Optional)
  926.                     if you omit this parameter the WinPick object will
  927.                     search for a NULL to determine the end of the list.
  928.  
  929. =======================================
  930. read
  931.     Gets the users choice from the pick list.
  932.  
  933.     USAGE:  int read();
  934.  
  935.     RETURNS:    the element number of the users selection.
  936.                 W_ERROR if the list window is not opened.
  937.                 W_ESCAPE if list is exited with an escape
  938. =========================================
  939. set_barattr
  940.     Sets the attribute for the pick-list bar.  The default is
  941.     _LGREY|BLACK
  942.  
  943.     USAGE:  int set_barattr (int new_attr);
  944.  
  945.     RETURNS:    the previous attribute.
  946.  
  947.  
  948.  
  949. ****************************************************************************
  950.                          Low Level Functions
  951. ****************************************************************************
  952. ----------------------------Screen functions-------------------------------
  953. Win_init
  954.     Start the low level screen system.  This is called automatically by
  955.     the first window function used.  This function will clear the screen
  956.     the first time it is called.
  957.  
  958.     USAGE:  void Win_init (int mode);
  959.  
  960.         mode:   W_MONO  =   Force mono attributes only.
  961.                 W_BIOS  =   Force bios screen writes.
  962.                 W_DEFAULT = Auto detect the system configuration.
  963.                 W_SNOW  =   Force CGA snow checking.
  964.  
  965.         Any of these modes can be combined by oring.
  966.                 example:  Win_init (W_BIOS | W_MONO);
  967. ========================================
  968. Win_clr
  969.     Clear a section of the screen with an attribute.
  970.     No testing is done on screen coordinates.
  971.  
  972.     USAGE: void Win_clr(int sr,int sc, int er, int ec,int color);
  973.  
  974. ===========================================
  975. Win_dispch
  976.     Display a character on the screen.
  977.     No coordinate testing is done.
  978.  
  979.     USAGE: void Win_dispch (int y, int x, int color, char ch);
  980. ============================================
  981. Win_dispst
  982.     Display a NULL terminated string on the screen.
  983.  
  984.     USAGE:  void Win_dispst ( int y,int x,int color,char *str,int max );
  985.  
  986.         max     = max number of characters to display.
  987. ============================================
  988. Win_gotoxy
  989.     Move the cursor on the screen.
  990.  
  991.     USAGE:  void Win_gotoxy (int y, int x);
  992. ============================================
  993. Win_hidecur
  994.     Hide the screen cursor.
  995.  
  996.     USAGE:  void Win_hidecur();
  997. ============================================
  998. Win_showcur
  999.     Unhide the screen cursor.
  1000.  
  1001.     USAGE:  void Win_showcur();
  1002. ============================================
  1003. Win_beep
  1004.     Beep the speeker.
  1005.  
  1006.     USAGE:  void Win_beep();
  1007. ============================================
  1008. Win_mono
  1009.     Turn black & white color remaping on or off.
  1010.  
  1011.     USAGE:  void Win_mono (int on_off);
  1012.  
  1013.         Call with W_ON or W_OFF
  1014. ============================================
  1015. Win_snow
  1016.     Turn snow checking on or off.
  1017.  
  1018.     USAGE:  void Win_snow(int on_off);
  1019.  
  1020.         Call with W_ON or W_OFF
  1021. ============================================
  1022. Win_bios
  1023.     Turn bios writes on or off.
  1024.  
  1025.     USAGE:  void Win_bios (int on_off);
  1026.  
  1027.         Call with W_ON or W_OFF
  1028.  
  1029.  
  1030. ---------------------------Key Functions------------------------------------
  1031.  
  1032. Win_getkey
  1033.     Get a key stroke from the keyboard.
  1034.  
  1035.     USAGE:  int Win_getkey();
  1036.  
  1037.     RETURNS:    scan code + ascii value of key pressed.
  1038.  
  1039.         Scan code   =   key >> 8
  1040.         ascii value =   key & 0x00ff
  1041. ============================================
  1042. Win_keystuf
  1043.     Stuf a keystroke in the internal buffer.
  1044.  
  1045.     USAGE:  int Win_keystuf (int key);
  1046.             key     =   Scan code + ascii value of key to stuff.
  1047.  
  1048.     Key strokes are stacked not queued.  If you wish to display
  1049.     a string you must insert the keystrokes in reverse.
  1050.         Example:
  1051.                 char *str = "Keyboard stuf routine";
  1052.                 int i = strlen(str);
  1053.                 while (i)
  1054.                     Win_keystuf(str[--i]);
  1055.  
  1056.     RETURNS:    W_OK or W_ERROR if the buffers is full
  1057.                 Buffer is 40 keystrokes.
  1058. ============================================
  1059. Win_lastkey
  1060.     Return the last key gotten by Win_getkey
  1061.  
  1062.     USAGE:  int Win_lastkey ();
  1063.  
  1064.     RETURNS:   scan code + ascii value of key gotten.
  1065. ============================================
  1066. Win_setonkey
  1067.     Assign a function to a hot key.  You may use as may hot keys
  1068.     as you like.  You can turn off a hot key by assigning the
  1069.     key to NULL.
  1070.  
  1071.     USAGE:  void Win_setonkey (int key,void (* func)(void));
  1072.  
  1073.     key         = scan code/ascii code combination of hot key.
  1074.                   Many of the keys are defined in WIN.H
  1075.     func        = pointer to the hot key function.  If NULL then
  1076.                   hot key will be deactivated.
  1077. =============================================
  1078. Win_setbkloop
  1079.     Assign a function to execute while waiting for a keypress.  You
  1080.     can only have one function assigned at a time.  To turn off this
  1081.     process assign NULL.
  1082.  
  1083.     USAGE:  void Win_setbkloop (void (* func)(void));
  1084.  
  1085.  
  1086. --------------------------------String Functions---------------------------
  1087. str_clear
  1088.     Clears a string to a given number of spaces
  1089.  
  1090.     USAGE:  char *str_clear (char *str, int len);
  1091.         str =   String to be cleared.
  1092.         len =   New length of string.
  1093.  
  1094.     RETURNS: a pointer to str
  1095. ====================================
  1096. str_setsz
  1097.     Sets the size of a char string.
  1098.  
  1099.     USAGE:  char *str_setsz (char *str, int len);
  1100.  
  1101.         str =   String to be truncated or padded.
  1102.         len =   New length of string.
  1103.  
  1104.     RETURNS:    pointer to str.
  1105. =========================================
  1106. strfill
  1107.     Return a string filled with a character.
  1108.  
  1109.     USAGE:  char *strfill (char ch,int count);
  1110.  
  1111.         ch  =   character to use.
  1112.         cnt =   length of return string.  MAX of 149.
  1113.  
  1114.     RETURNS:  pointer to a static string buffer or NULL if invalid length.
  1115. ==========================================
  1116. strtrim
  1117.     Trims trailing spaces from a string.
  1118.  
  1119.     USAGE:  char *strtrim (char *str);
  1120.  
  1121.     RETURNS: pointer to the string which was trimmed.
  1122. ===========================================
  1123. is_in
  1124.     Test a string for a given character.
  1125.  
  1126.     USAGE:  int is_in (char ch,char *str);
  1127.  
  1128.     RETURNS: 0 if ch is not in str.
  1129.              1 if ch is in str.
  1130.  
  1131.