home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / GUI_LIB.ZIP / GUI_LIB@.EXE / GUI_LIB.DOC < prev    next >
Encoding:
Text File  |  1992-09-08  |  30.4 KB  |  864 lines

  1.     
  2.  
  3.  
  4.  
  5.  
  6. ****************************************************************************
  7.  
  8.                  Documentation for
  9.         GUI_LIB Library for Borland C++ and Turbo C++
  10.                 Version 1.0 a
  11. ****************************************************************************
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. All files included on this distribution diskette are copyrighted by
  23. LUDICROUS DATA - June, 1992.
  24.  
  25.     File contained herein include:
  26.         GUI_LIB.LIB             The library file itself
  27.         GUI_LIB.DOC             This file
  28.         DEMO.EXE                Demonstration file
  29.         DEMO.C                  Source code for DEMO.EXE
  30.         *.ICN                   Support files for the demo
  31.         *.BTN                   Support files for the demo
  32.         GUI_LIB.H               Header file needed to use
  33.                     GUI_LIB functions and objects
  34.         REGISTER.DOC            Product registration form
  35.         ICONEDIT.EXE            The ICONEDIT program
  36.         ICONEDIT.DOC            ICONEDIT documentation
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.     Congratulations! You have just received one of the finest graphics 
  50.     libraries available for use with Borland C++ and Borland's Turbo C++ 
  51.     compilers. Using the GUI_LIB library will enable you to create 
  52.     graphic based applications to run in DOS just as easily as creating 
  53.     text based applications. The objects included in the library are all 
  54.     familiar objects, found in many commercially available software 
  55.     packages. They include pushbuttons, icons, text entry fields, and 
  56.     bitmaps to name just a few. Some of the features in this library are 
  57.     found nowhere else! Now you can harness the power and intuitiveness 
  58.     of the Graphic User Interface for use in your applications. From 
  59.     paint programs to databases, all of your programs can benefit from 
  60.     the use of graphics. 
  61.  
  62.     If you have not already done so, I would suggest that you stop 
  63.     reading this documentation for a moment to check out the demo 
  64.     provided on the distribution diskette. The name of the demo is 
  65.     simply DEMO.EXE. In order to run the demo you must first have 
  66.     loaded your mouse driver. Any Microsoft, Logitech, or compatible 
  67.     mouse will be fine. Also, be sure that the file EGAVGA.BGI is 
  68.     in the same directory as the DEMO.EXE file. Then from the DOS prompt 
  69.     type DEMO <ENTER>. The demo highlights most of the objects in 
  70.     the library. After viewing the demo, return to the documentation.
  71.  
  72.  
  73.                 SHAREWARE
  74. ****************************************************************************
  75.  
  76.     The GUI_LIB library and it's included files are being distributed as 
  77.     Shareware. They are complete and not crippled in any way. You are free 
  78.     to use these files for a 30 day period free of charge. You may not, 
  79.     however, distribute any works created with these files in any way, 
  80.     shape or form until you have registered your copy of the package. 
  81.     If after 30 days you decide to continue using the files in this 
  82.     package you are obligated to register with the author. The concept 
  83.     of Shareware helps to keep the cost of quality software low. Please 
  84.     do your part by registering this software. Use of the software 
  85.     contained in this package after 30 days without registration will 
  86.     bring about sever penalties.
  87.  
  88.     This software package is comparable with many retail libraries 
  89.     costing hundreds of dollars. It is through the concept of Shareware 
  90.     that I am able to bring this software to you at a much reduced cost. 
  91.     What's more, registered users will receive upgrades free of cost 
  92.     rather than at an upgrade cost. 
  93.  
  94.     The price of this package is as follows:
  95.  
  96.         Single user license - $25
  97.             includes free copy of the next major upgrade of the
  98.             package.
  99.  
  100.         Corporate user license - $50
  101.             includes free copy of the next major upgrade of the
  102.             package.
  103.  
  104.  
  105.     Please use the registration form included with this package to 
  106.     register your copy. The form can be found in the file REGISTER.DOC.
  107.  
  108.     Thank you
  109.  
  110.     If you like this product you may also wish to order the
  111.     ObjectEase library also from this author. This library makes it 
  112.     easy to migrate into the realm of C++ programming by offering
  113.     the widest range of classes available in any library at any
  114.     cost. Include a note on your registration form to receive a demo
  115.     of the ObjectEase library.
  116.  
  117.  
  118.  
  119.             Use of the GUI_LIB library
  120.  
  121.     In order to utilize the objects and functions in the GUI_LIB 
  122.     library you need only add the GUI_LIB library to your project, 
  123.     and include the header file in your program code. You can then 
  124.     declare object instances and call the functions as you would with 
  125.     any other library. You must, of course, first initialize the 
  126.     graphics mode with a call to initgraph(). The GUI_LIB library file 
  127.     was compiled under the large memory model using Borland C++ 3.0 
  128.     and should be included only in projects that are also to be compiled 
  129.     for the large memory model. This is because the use of graphics 
  130.     can be very memory intensive and the large memory model gives the 
  131.     program access to all of the available RAM, not just a single 64K 
  132.     data segment.
  133.  
  134.     This documentation is divided into sections describing each of the 
  135.     various graphic objects followed by a description and examples of 
  136.     all of the methods that may be used with the object. Please take 
  137.     special note of the example fragments as they may be of great help 
  138.     to you in getting to know the proper use of these objects and 
  139.     methods. 
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. ****************************************************************************
  151.                    PANELS
  152. ****************************************************************************
  153.  
  154.     Panels can be associated with pop-up windows in a text environment. 
  155.     They serve to contain and draw attention to other objects such as 
  156.     text or pushbuttons. The class Panel is declared in the header 
  157.     file GROBJECT.H as:
  158.  
  159. class Panel:public Point
  160. {
  161.     protected:
  162.         int w;                          WIDTH
  163.         int h;                          HEIGHT
  164.         int in_or_out;                  CONCAVE or CONVEX
  165.         int thick_or_thin;              BORDER STYLE
  166.     public:
  167.         Panel();
  168.         ~Panel();
  169.         virtual void show();
  170.         void init(int xpos,int ypos,int width,int height,
  171.               int inorout,int thickorthin);
  172. };
  173.  
  174.  
  175.     The class POINT from which Panel is derived is the base class for 
  176.     all of the graphic objects in this library.
  177.  
  178.     In order to facilitate the initialization of the inorout and 
  179.     thickorthin variables the definitions IN, OUT, THICK and THIN 
  180.     may be used. These are defined in the header file.
  181.  
  182.     To declare an instance of class PANEL and display it in your 
  183.     application follow the example in the following code fragment.
  184.  
  185.     Panel mypanel;
  186.     mypanel.init(10,10,100,100,IN,THICK);
  187.     mypanel.show();
  188.  
  189.     It's just that simple. Remember that the graphics mode must first 
  190.     be initialized by a call to initgraph. If you are unfamiliar with 
  191.     this function consult your compiler documentation.
  192.  
  193.     All of the objects in this library contain the method "init". 
  194.     You must call "init" with the proper parameters before trying 
  195.     to display the object. There's no telling what might happen if 
  196.     you try to display an uninitialized object.
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205. ****************************************************************************
  206.                  BEVELS
  207. ****************************************************************************
  208.  
  209.     Bevels are just like panels with a more decorative border. All 
  210.     calls to their methods are identical except that a call to 
  211.     Bevel.init() takes one less parameter. You do not need to specify 
  212.     IN or OUT because Bevel borders always go out. Here is the 
  213.     definition. I'll skip an example as you can easily follow the 
  214.     Panel example and make appropriate substitutions.
  215.  
  216. class Bevel:public Point
  217. {
  218.     private:
  219.         int w;                          WIDTH
  220.         int h;                          HEIGHT
  221.         int thick_or_thin;              STYLE OF BORDER
  222.         Panel outerbevel;
  223.         Panel innerbevel;
  224.     public:
  225.         void init(int,int,int,int,int);
  226.         virtual void show();
  227. };
  228.  
  229.  
  230.  
  231.  
  232.  
  233. ****************************************************************************
  234.                  PUSHBUTTONS
  235. ****************************************************************************
  236.  
  237.     Pushbuttons simulate keyboard keys on the screen. They serve to 
  238.     get user input for a variety of purposes. They are very intuitive 
  239.     and can display either a text title or a graphic image.
  240.  
  241. The header file definition of the class Button is:
  242.  
  243. class Button:public Point
  244. {
  245.   protected:
  246.     int state,                  UP or DOWN
  247.     int sizex,                  WIDTH
  248.     int sizey;                  HEIGHT
  249.     char btntxt[40];            TEXT ID 
  250.     int  file_text;             TEXT ID or GRAPHIC IMAGE
  251.     void *picture;              BUFFER CONTAINING GRAPHIC IMAGE
  252.     void getpic(char*);         
  253.   public:
  254.     Button();
  255.     ~Button();
  256.     virtual void show();
  257.     virtual void press();
  258.     void init(int xpos,int ypos,char* text,int);
  259.     int hit();
  260. };
  261.  
  262.     To declare an instance of class Button you need to supply the 
  263.     parameters for the upper left x and y positions, a string which 
  264.     either represents the text to be displayed on the button or the 
  265.     name of the file containing the image to be used on the button, 
  266.     and an integer flag representing whether or not the last parameter 
  267.     refers to text or a filename.
  268.  
  269. The definitions TEXT and IMAGE can be used in this parameter and are 
  270. defined in the header file.
  271.  
  272.     Consider this example:
  273.  
  274.     Button textbutton;
  275.     textbutton.init(10,10," EXIT ",TEXT);
  276.     textbutton.show();
  277.  
  278.     This would create and display a button that said " EXIT " on it.
  279.  
  280.     Consider this:
  281.  
  282.     Button graphbutton;
  283.     graphbutton.init(10,10,"EXIT",IMAGE);
  284.     graphbutton.show();
  285.  
  286.     This would create and display a button containing the image stored 
  287.     in the file "EXIT.BTN". The file extension should not be included 
  288.     in the parameter as ".BTN" is the assumed extension. The graphic 
  289.     file must be present on the disk before trying to call this function. 
  290.     Using the ICONEDIT program supplied with this package you can very 
  291.     easily create these graphics to be included on buttons.
  292.  
  293.     Note that you do not need to specify the width and height of buttons. 
  294.     If you are using text labels the button width is determined 
  295.     automatically to accomodate up to 40 characters, and if your are 
  296.     using graphics the button defaults to 20x20. This is the size of 
  297.     the button graphics created by the ICONEDIT program.
  298.  
  299.     Pressing the button is usually done with the mouse cursor, however, 
  300.     you may find it useful to use some other trigger to press the button. 
  301.     The button method "hit()" determines if the mouse cursor is within the 
  302.     boundaries of the button. For a detailed discussion on the use of the 
  303.     mouse functions see the appropriate section of this documentation. If 
  304.     you don't understand all of the functions in this next code fragment 
  305.     you can find explanations elsewhere in this document.
  306.  
  307.     Button mybutton;                       DECLARES INSTANCE OF BUTTON
  308.     mybutton.init(10,10,"EXIT",TEXT);      INITIALIZES MYBUTTON
  309.     mybutton.show();                       DISPLAYS MYBUTTON ON SCREEN
  310.  
  311.     while(!kbhit()) {                      DO THIS WHILE NO KEYS ARE HIT
  312.       if(leftmousekeypressed()) {          IF THE LEFT MOUSE KEY IS
  313.                            PRESSED
  314.         if(mybutton.hit()) {               IF MOUSE CURSOR IS ON MYBUTTON
  315.           mybutton.press();                DISPLAY MYBUTTON AS PRESSED
  316.           while(leftmousekeypressed());    WAIT UNTIL LEFT MOUSE KEY HAS
  317.                            BEEN RELEASED
  318.           mybutton.show();                 DISPLAY MYBUTTON IN NORMAL 
  319.                            STATE
  320.           }
  321.       }
  322.     }                       
  323.  
  324.     Immediately after restoring the button to the normal (undepressed) 
  325.     state the program can branch to take whatever action the button 
  326.     calls for.  By using the Button method "press()" all of the 
  327.     redrawing and repositioning of the text and/or graphic images is 
  328.     handled automatically by the GUI_LIB library.
  329.  
  330.  
  331.  
  332.  
  333.  
  334. ****************************************************************************
  335.                   COLORBUTTONS
  336. ****************************************************************************
  337.  
  338.     Colorbuttons don't do much except tell you when they are hit and
  339. return their current color. This is very useful if you are coding a paint
  340. program and need some way to set the current foreground and background colors.
  341. I'm sure you can find some other good uses for this class as well.
  342.  
  343.     The header definition of class Colorbutton is:
  344.  
  345.  
  346. class Colorbutton:public Point
  347. {
  348.     protected:
  349.         int color;
  350.         int width;
  351.         int height;
  352.     public:
  353.         void init(int,int,int,int,int);
  354.         void show(int);
  355.         int  hit();
  356.         int getcolor();
  357.         };
  358.  
  359.     Call "init()" with integer parameters for the x and y position,
  360. the width, the height, and the color of the button. Call "show()" with
  361. and integer value representing the color of the rectangle you wish to 
  362. have surrounding the Colorbutton. By manipulating this value you can 
  363. effectively show an "active" Colorbutton in a row of Colorbuttons. "Hit()"
  364. simply returns whether or not the mouse cursor is in the Colorbutton
  365. area, and "getcolor()" return the color of the Colorbutton.
  366.  
  367.     A quick way to make a color selection bar is as follows:
  368.  
  369. Colorbutton colorarray[16];
  370. for(int i=0;i<16;i++) {
  371.     colorarray[i].init(100+(i*20),100,20,20,i);
  372.     colorarray[i].show(15);
  373.     }
  374.  
  375.  
  376.  
  377.  
  378.  
  379. ****************************************************************************
  380.                  ICONS
  381. ****************************************************************************
  382.  
  383.     Icons can be used in much the same way as buttons. They will always 
  384.     contain a graphic image, although text can be a part of the graphic. 
  385.     They are not 3 dimensional like pushbuttons.
  386.  
  387.     The graphic images for these Icon objects are created using the 
  388.     ICONEDIT program. This program produces 32x32 pixel icons that can be 
  389.     single or multi-framed. More on this in a moment.
  390.  
  391. The definition of the Icon class is:
  392.  
  393. class Icon:public Point
  394. {
  395.     protected:
  396.         int state;                      SELECTED OR NOT
  397.     public:
  398.         void far *picture;              BUFFER CONTAINING GRAPHIC       
  399.     Icon();
  400.     ~Icon();
  401.         void init(int xpos,int ypos,char* fname);
  402.         void show();
  403.         void choose();
  404.         int hit();
  405.         int ispressed();
  406.     };
  407.  
  408.     Like the other graphic objects, the Icon class must first be 
  409.     initialized with a call to "init()." Init() takes three parameter, 
  410.     the x and y coordinates of the upper left corner, and the file name 
  411.     of the file containing the graphic image for the icon. The filename 
  412.     parameter should be given without an extension as the default 
  413.     extension ".ICN" is assumed. The file named in this parameter must 
  414.     exist in the current directory.
  415.  
  416.     Let's look at a short example:
  417.  
  418.     Icon myicon;
  419.     myicon.init(10,10,"paint");
  420.     myicon.show();
  421.  
  422.     This example declares an instance of class Icon using the file 
  423.     "paint.icn" as the graphic, and then displays the icon.
  424.  
  425.     As with the pushbutton, the method "hit()" determines if the 
  426.     mouse cursor is within the boundaries of the icon. If it is, 
  427.     and if a mouse key is pressed, we can change the appearance of 
  428.     the icon to mark it as selected using the method "choose()." Here's 
  429.     a quick example, similar to that presented for the pushbutton:
  430.  
  431.     Icon myicon;
  432.     myicon.init(10,10,"paint");
  433.     myicon.show();
  434.  
  435.     while(!kbhit()) {
  436.         if(leftmousekeypressed()) {
  437.             if(myicon.hit()) {
  438.                 if(!myicon.ispressed()) {
  439.                     myicon.choose();
  440.                     while(leftmousekeypressed());
  441.                     myicon.show();
  442.                     }
  443.                 }
  444.             }
  445.         }
  446.  
  447.     Usually when an icon has been selected you will want to make 
  448.     sure that the last icon to be selected gets reset to its normal 
  449.     state with a call to "show()." Whatever action needs to be taken 
  450.     as a result of the icon's selection can be done after the call to 
  451.     "choose()." The method "ispressed()" simply returns whether or not 
  452.     the icon is already displayed in its selected state.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460. ****************************************************************************
  461.                  ACTICONS
  462. ****************************************************************************
  463.  
  464.     Acticons are exactly like Icons except that instead of simply 
  465.     reversing their image to mark them as the selected icon, they 
  466.     become animated. Acticons are created using the ICONEDIT program. 
  467.     They are created in the same manner as an Icon, but instead of just 
  468.     a single frame graphic, they contain several (up to 32) frames.
  469.  
  470. Acticons are defined in the header file as follows:
  471.  
  472. class Acticon:public Icon
  473. {
  474.     protected:
  475.         void *picture[32];              GRAPHICS BUFFERS
  476.         int state;                      SELECTED OR NOT
  477.         int numpix;                     NUMBER OF FRAMES
  478.     public:
  479.         Acticon();
  480.         ~Acticon();
  481.         void init(int,int,char*);
  482.         void show(int);
  483.         void choose();
  484.         int ispressed();
  485.         void animate(int);
  486.         void backforth(int);
  487.     };
  488.  
  489.  
  490.     Like Icons, they are initialized with a call to "init()" with 
  491.     parameters for the upper left x and y coordinates, and the file 
  492.     name containing the graphic images. When you call "show()", however, 
  493.     you must supply an integer parameter specifying which frame to 
  494.     display. Usually you will want to make this frame 0 because if 
  495.     you call "choose()" the negative image of frame 0 will be displayed 
  496.     by default.
  497.  
  498.     For example:
  499.     
  500.     Acticon myicon;
  501.     myicon.init(10,10,"paint");
  502.     myicon.show(0);
  503.  
  504.     Just like an Icon except for the parameter in the call to "show()." 
  505.     If you want to use choose to show the reverse image of the Acticon 
  506.     it is done the same as it is for class Icon. If however you want 
  507.     to animate the Acticon you must call "animate()" or "backforth()." 
  508.     Both of these methods will put the Acticon in motion. "Animate()" 
  509.     will display the frames in ascending order and then restart at 
  510.     frame 0. "Backforth()" will display the frames in ascending order, 
  511.     but when it reaches the last frame it will then display the frames 
  512.     in reverse order back to frame 0. Both of these methods take a 
  513.     single parameter which specifies the delay between displaying each 
  514.     frame. This delay is expressed in eighteenths of a second. The 
  515.     lower the value, the faster the animation. You do not need to 
  516.     specify the number of frames in the Acticon as this information is 
  517.     contained in the graphic file created by ICONEDIT. Let's take a look:
  518.  
  519.     Acticon myicon;
  520.     myicon.init(10,10,"paint");
  521.     myicon.show(0);
  522.  
  523.     while(!kbhit()) {
  524.         if(leftmousekeypressed()) {
  525.             if(myicon.hit()) {
  526.                 while(leftmousekeypressed()) 
  527.                     myicon.animate(3);
  528.                 }
  529.             }
  530.         }
  531.  
  532.     In this code fragment, if the left mouse key is pressed while the 
  533.     cursor is on the Acticon, then the Acticon will animate for as long 
  534.     as the left mouse key is pressed. Note that "animate()" and 
  535.     "backforth()" will only change the animation by one frame, so for 
  536.     continuous motion you must include calls to these methods within 
  537.     some sort of loop.
  538.     
  539.  
  540.  
  541.  
  542.  
  543. ****************************************************************************
  544.                  GSTRINGS
  545. ****************************************************************************
  546.     
  547.     No, it's not something a stripper wears, the G in Gstring simply 
  548.     stands for graphic. These object are used for getting text input 
  549.     while in graphics mode. They display their own input fields and can 
  550.     handle all of the text editing keys like arrows, backspace, delete, 
  551.     etc...
  552.  
  553. Class Gstring is defined as:
  554.  
  555. class Gstring:public Tstring {
  556.     protected:
  557.         int curpos;                     CURSOR POSITION IN STRING
  558.         int curson;                     CURSOR ON OR OFF
  559.         void showcurs();
  560.         void hidecurs();
  561.     public:
  562.         void init(int xpos,int ypos,int length,int caps);
  563.         void show();
  564.         void input();
  565.         void get_input();
  566.         void get_form_input();
  567.         int isshown();
  568.         void check_for_blink();
  569.     };
  570.  
  571.     Once again a call to "init()" is necessary to begin. The necessary 
  572.     parameters are the x and y coordinates of the upper left corner of 
  573.     the input field, the length of the field, and an integer flag to 
  574.     indicate whether of not to force the input into all capital letters. 
  575.     Any nonzero value will force all caps. 
  576.  
  577.     Notice that Gstring is not derived from class Point as are all the 
  578.     other object, but is derived from class Tstring. Tstring is not a 
  579.     part of this graphics library, but performs the same functions as 
  580.     Gstring only in text mode.
  581.  
  582.     Two methods that are part of Tstring that you might find useful are 
  583.     "preset()" and "reset()." Call "preset()" with a string parameter 
  584.     that you wish to have displayed in the input field by default, and 
  585.     "reset()" with no parameters to clear the input field. For example, 
  586.     if you wanted the input field to be displayed with the preset value 
  587.     of "Married" you would use code similar to the following:
  588.  
  589.     Gstring mystring;
  590.     mystring.init(100,10,10,0);
  591.     mystring.preset("Married");
  592.     mystring.show();
  593.  
  594.     If you don't use the "preset()" method the input field will just 
  595.     be blank, probably what you want in most cases anyway. To allow 
  596.     user input just add the statement:
  597.     
  598.     mystring.get_input();
  599.  
  600.     This will allow text input until the user presses either <ESCAPE> 
  601.     or <ENTER>. You can test for the <ESCAPE> key with the Tstring 
  602.     method "escapehit()." Let's put it all together...
  603.  
  604.     Gstring mystring;
  605.     char *the_string;
  606.  
  607.     mystring.init(100,10,10,0);
  608.     mystring.get_input();
  609.     if(mystring.escapehit())
  610.         exit(0);
  611.     else
  612.     strcpy(the_string,mystring.getstring());
  613.  
  614.     The Tstring method "getstring()" returns a char * to the actual 
  615.     text string that was entered by the user.
  616.  
  617.  
  618.  
  619.  
  620.  
  621. ****************************************************************************
  622.                GMENUBUTTON and GMENU
  623. ****************************************************************************
  624.  
  625.  
  626.     The classes Gmenubutton and Gmenu provide the capabilities for you 
  627.     to include pulldown menus in you graphics applications. The 
  628.     Gmenubutton is simply the text that will appear in the menu bar 
  629.     whereas the Gmenu is the moving bar menu that will pop up when a 
  630.     Gmenubutton is selected. Since these two objects are so closely 
  631.     related I will discuss them together. Here are the definitions:
  632.  
  633. class Gmenu {
  634.       protected:
  635.         int on;
  636.         int x,y,w,h;
  637.         int num;
  638.         gitemarray gitems;
  639.         int menuchoice;
  640.         int oldbarx,oldbary;
  641.         void *ptr;
  642.         void *menubar;
  643.       public:
  644.         Gmenu();
  645.         ~Gmenu();
  646.         void init(int xloc,int yloc,int numentries,
  647.                gitemarray gitem);
  648.         int show();
  649.         void hide();
  650.         int isshown();
  651.       };
  652.  
  653. class Gmenubutton {
  654.         protected:
  655.           int on;
  656.           int x,y;
  657.           int offfgd,offbgd;
  658.           int onfgd,onbgd;
  659.           char id[20];
  660.         public:
  661.           Gmenubutton();
  662.           ~Gmenubutton();
  663.           void init(int xloc,int yloc,int ffgd,int fbgd,
  664.                 int nfgd,int nbgd,char txt[20]);
  665.           void show();
  666.           void press();
  667.           int hit();
  668.           };
  669.  
  670.     The data element gitemarray is a predefined two dimensional 
  671.     array containing the strings that will appear in the Gmenu. 
  672.     The maximum number of items in a Gmenu is 10, and the width of 
  673.     the pop-up menu is fixed at 100 pixels. When initializing the 
  674.     strings in the gitemarray always start at index 1 rather than 
  675.     index 0. Like this:
  676.  
  677.     gitemarray menu1array;
  678.     strcpy(menu1array[1],"ITEM 1");
  679.     strcpy(menu1array[2],"ITEM 2");
  680.     etc...
  681.  
  682.     A Gmenubutton is initialized with parameters for x and y screen 
  683.     locations, normal state fgd and bgd colors, selected state fgd 
  684.     and bgd colors, and the text to be displayed.
  685.  
  686.     A Gmenu is initialized with parameters for the x and y screen 
  687.     locations, the number of entries to be in the menu, and the 
  688.     gitemarray containing the item strings. The Gmenu is popped-up 
  689.     with a call to "show()" which returns an integer representing the 
  690.     index of the gitemarray the bar was on when the selection was made. 
  691.     If no selection was made "show()" returns 11.
  692.  
  693.     Let's look at an example to hopefully clear this all up.
  694.  
  695.     gitemarray itemarray;
  696.     Gmenu mymenu;
  697.     Gmenubutton mymenubutton;
  698.     int menuchoice;
  699.  
  700.     strcpy(itemarray[1],"ITEM 1");
  701.     strcpy(itemarray[2],"ITEM 2");
  702.     strcpy(itemarray[3],"ITEM 3");
  703.     strcpy(itemarray[4],"ITEM 4");
  704.  
  705.     setfillstyle(SOLID_FILL,15);        MAKE A MENU BAR AT TOP OF SCREEN
  706.     bar(0,0,getmaxx(),10);
  707.  
  708.     mymenubutton.init(0,0,0,15,15,0,"MENU 1");
  709.     mymenubutton.show();
  710.  
  711.     mymenu.init(0,11,4,itemarray);
  712.  
  713.     if(leftmousekeypressed()) {
  714.         if(mymenubutton.hit()) {
  715.             mymenubutton.press();
  716.             choice=mymenu.show();
  717.             mymenu.hide();
  718.             mymenubutton.show();
  719.             }
  720.         }
  721.  
  722.  
  723.     In this example the integer variable choice will contain the 
  724.     number of the item that was selected. Execution can then branch 
  725.     to the appropriate functions based on this value using case 
  726.     statements.                    
  727.     
  728.  
  729.  
  730.  
  731.  
  732. ***************************************************************************
  733.                 PRINTING TEXT
  734. ***************************************************************************
  735.  
  736.     Although not part of a class library, there is a text output
  737. function included in the library that you will find most useful. The
  738. "outtextxy()" function which is part of the Borland library will only
  739. take a char* as the parameter to write to the screen. You cannot give
  740. it a variable to format into a string for you. There is a function in the
  741. GUI_LIB library called gprintxy() that will format variables into
  742. printable text for you. The definition is:
  743.  
  744.     gprintxy(int,int,char *fmt,...)
  745.  
  746.     You can use this function just as you would the "printf()" function
  747. in text mode. So for example you could write:
  748.  
  749.     int age=27;
  750.     gprintxy(100,100,"%d",age);
  751.  
  752.     "gprintxy()" will format the variable and print it to the screen
  753. correctly. The two integer parameters represent the x and y position to
  754. print the string. Remember that this function is dependent on the current
  755. text justification settings. Use the Borland library function 
  756. "settextjustify()" to alter these settings.
  757.  
  758.  
  759.  
  760. ****************************************************************************
  761.                MOUSE FUNCTIONS
  762. ****************************************************************************
  763.  
  764.     In this section I will briefly describe the functions associated 
  765.     with the mouse. These functions comply with the Microsoft mouse 
  766.     driver, however, they may not represent all of the available 
  767.     function of this driver.
  768.  
  769.     The available functions are as follows:
  770.  
  771. int     mouse_init()    returns 1 if mouse driver is installed, 0 if it                         
  772.             cannot detect a mouse driver.
  773. void    show_cursor()   makes the mouse cursor visible.
  774. void    hide_cursor()   makes the mouse cursor invisible.
  775. void    pos_mouse(int,int)      sets the mouse cursor position to the x,y                               
  776.                 coordinates given as parameters.
  777. void    sethbounds(int,int)     sets the minimum and maximum horizontal                                 
  778.                 mouse cursor boundaries according to the                                
  779.                 parameters.
  780. void    setvbounds(int,int)     sets the minimum and maximum vertical mouse                             
  781.                 cursor boundaries according to the                                      
  782.                 parameters.
  783. int     leftmousekeypressed()   returns 1 if the left mouse key is pressed,                             
  784.                 0 otherwise.
  785. int     rightmousekeypressed()  returns 1 if the right mouse key is pressed,                            
  786.                 0 otherwise.
  787.  
  788.     Future releases of the GUI_LIB library will include the ability 
  789.     to select from a number of available graphics cursors.
  790.  
  791.  
  792.     Well, that about does it. I'm sure that this being the first 
  793.     version of the documentation I will remember some things I should 
  794.     have included after it has already been distributed. Oh well, that's 
  795.     what revisions are for. That's also what registration and telephone 
  796.     support are all about. If you find that you are having trouble 
  797.     getting something to work then be prepared to register your copy 
  798.     of the package before being able to call for support. This is an 
  799.     unregistered copy and is meant for demonstration and evaluation 
  800.     purposes. I know for a fact that all of the methods contained in 
  801.     the library work correctly. I may have not given clear enough 
  802.     directions in this documentation, but if I find that to be the 
  803.     case I will correct the documentation. I cannot give phone 
  804.     support to unregistered users. Sorry.
  805.  
  806.     Don't forget to use the registration form in the file REGISTER.DOC 
  807.     to register your copy of this library package. I feel that it is 
  808.     good quality and very useful software that is well worth the price 
  809.     that I am asking. 
  810.  
  811.          
  812.  
  813.            Thank you for using software from LUDICROUS DATA
  814.     
  815.  
  816.     Note: Refer to the file ICONEDIT.DOC in the ICONEDIT directory for 
  817. a description of the use of the ICONEDIT program.
  818.  
  819.  
  820.          ----------------end-of-author's-documentation---------------
  821.  
  822.                          Software Library Information:
  823.  
  824.                     This disk copy provided as a service of
  825.  
  826.                            Public (software) Library
  827.  
  828.          We are not the authors of this program, nor are we associated
  829.          with the author in any way other than as a distributor of the
  830.          program in accordance with the author's terms of distribution.
  831.  
  832.          Please direct shareware payments and specific questions about
  833.          this program to the author of the program, whose name appears
  834.          elsewhere in  this documentation. If you have trouble getting
  835.          in touch with the author,  we will do whatever we can to help
  836.          you with your questions. All programs have been tested and do
  837.          run.  To report problems,  please use the form that is in the
  838.          file PROBLEM.DOC on many of our disks or in other written for-
  839.          mat with screen printouts, if possible.  PsL cannot debug pro-
  840.          programs over the telephone, though we can answer questions.
  841.  
  842.          Disks in the PsL are updated  monthly,  so if you did not get
  843.          this disk directly from the PsL, you should be aware that the
  844.          files in this set may no longer be the current versions. Also,
  845.          if you got this disk from another vendor and are having prob-
  846.          lems,  be aware that  some files may have become corrupted or
  847.          lost by that vendor. Get a current, working disk from PsL.
  848.  
  849.          For a copy of the latest monthly software library newsletter
  850.          and a list of the 4,000+ disks in the library, call or write
  851.  
  852.                            Public (software) Library
  853.                                P.O.Box 35705 - F
  854.                             Houston, TX 77235-5705
  855.  
  856.                                 1-800-2424-PSL
  857.                              MC/Visa/AmEx/Discover
  858.  
  859.                           Outside of U.S. or in Texas
  860.                           or for general information,
  861.                               Call 1-713-524-6394
  862.  
  863.  
  864.