home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR9 / TVTOOLS.ZIP / TVTOOLS.DOC < prev    next >
Text File  |  1993-05-13  |  11KB  |  311 lines

  1. /***
  2.     Module      :   TVTOOLS
  3.  
  4.     Description :   Various tools and addings for TV 
  5.  
  6.     Remark      :   This library calls a lot of general functions 
  7.                     from the 'general' libraries (STRINGS.LIB, TOOLS.LIB,...).
  8.                     This mean that you have to include the related include 
  9.                     files.
  10.  
  11.  
  12.  
  13.   New operators:    TMenuItem  = TMenuItem + TMenuItem
  14.   =============     TMenuItem += TMenuItem
  15.                     TSItem  = TSItem + TSItem
  16.                     TSItem += TSItem
  17.                     TSubMenu += TSubMenu
  18.                     TSubMenu += TMenuItem
  19.                     TStatusDef += TStatusDef
  20.                     TStatusDef += TStatusItem
  21.  
  22.  
  23.   General List:
  24.   ============
  25.  
  26.   TGenCollection:  Same as TStringCollection
  27.                       TGenCollection( ccIndex = 0, ccIndex = 0 );
  28.  
  29.        but with two output functions:
  30.            char *getData( ccIndex );  // to return the data
  31.            char *getText( ccIndex );  // to display text in a viewer
  32.        By default, getData() calls getText().
  33.  
  34.        These functions have to be used in place of TStringCollection ones
  35.        and can be overloaded:
  36.            ccIndex indexOf( char *item );       // data index
  37.            ccIndex indexOfText( char *item );   // text index
  38.            void *firstThat( ccTestFunc Test, void *arg );     // search
  39.            void *firstTextThat( ccTestFunc Test, void *arg ); // search
  40.            int getCount();                // returns number of items
  41.            int getTextLength();           // returns maximum length of text
  42.            int compare( void *, void * ); // function to compare to items
  43.        All these virtual functions are designed to work as is with
  44.        TStringCollection lists.
  45.        The functions you need to overload to use another list mechanism are:
  46.            getData(), getText(), getCount()
  47.        the other ones use these three ones.
  48.        default compare() is case-insensitive
  49.            (also éàÅ,... are treated as normal letters).
  50.               
  51.  
  52.   ComboBox:
  53.   ========
  54.  
  55.   TComboBox:  Pop-up box with a list viewer
  56.               Must be linked with a TInputLine (or TStaticInputLine)
  57.               ans a TGenCollection.
  58.  
  59.               When pressing characters, the first list item matching these
  60.               characters is focused. If a non matching character is pressed,
  61.               a buzzer sound is output. 
  62.  
  63.               Enter or double-click is used to select an item.
  64.               The corresponding data will so be given to the TInputLine.
  65.  
  66.               TComboBox( const TRect&, TInputLine *, TGenCollection * );
  67.               TComboBox( TInputLine *, TGenCollection * ); // Right of line
  68.  
  69.  
  70.   New Input fields:
  71.   ================
  72.  
  73.   TInput1Line( x, y, len )
  74.  
  75.   T1StaticText( x, y, string ): same as TStaticText
  76.  
  77.   TStaticTextf( const TRect& bounds, const char *fmt, ... )
  78.   TStaticTextf( const ushort x, const ushort y, const char *fmt, ... )
  79.    same as TStaticText but allows same syntax as printf()
  80.  
  81.   T1Label( x, y, string, link )
  82.  
  83.  
  84.   TInputKey:    Same as TInputLine, except invalid if empty
  85.                 TInputKey( const TRect&, int len );
  86.                 TInputKey( int x, int y, int len );
  87.  
  88.  
  89.   TInputPasswd: Same as TInputLine, but display only '*'
  90.                 TInputPasswd( const TRect&, int len );
  91.                 TInputPasswd( int x, int y, int len );
  92.                                      
  93.  
  94.   TInputRegExp: Same as TInputLine, but filter input to be in a 'set'
  95.                 and check result to match the regular expression 'regexp'.
  96.                 If UPPER or LOWER is given as last parameter, all characters
  97.                 are translate into upper/lowercase (also éàÅ,...).
  98.  
  99.                 If an invalid character is pressed, a buzzer sound is output.
  100.                 If input does not match the regular expression, a messageBox
  101.                 is output at valid() time. This message may be replaced
  102.                 or disabled (0).
  103.                 char *invMsg = " \n\03Invalid entry !";
  104.  
  105.                 'set' and 'regexp' comply with UNIX-grep regular expressions;
  106.                 ex: set = "0-9a-z+-*/" or "^0-9"
  107.                     regexp = "[0-9]*.[a-zA-Z]*..*"
  108.                 'set' and 'regexp' can be nul (0 or not given).
  109.  
  110.                 TInputRegExp( const TRect&, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  111.                 TInputRegExp( int x, int y, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  112.  
  113.  
  114.   TInputInt:    Accepts only valid numeric input (int) between Min and Max
  115.                 If a wrong character is pressed, a buzzer sound is output.
  116.                 TInputInt( const TRect&, int len = 7, int min = -MAXINT, int max = MAXINT );
  117.                 TInputInt( int x, int y , int len = 7, int min = -MAXINT, int max = MAXINT );
  118.  
  119.  
  120.   TInputLong:   Accepts only valid numeric input (long) between Min and Max
  121.                 If a wrong character is pressed, a buzzer sound is output.
  122.                 TInputLong( const TRect&, int len = 12, long min = -MAXLONG, long max = MAXLONG );
  123.                 TInputLong( int x, int y , int len = 12, long min = -MAXLONG, long max = MAXLONG );
  124.  
  125.  
  126.   TInputDouble: Accepts only valid numeric input between Min and Max
  127.                 If a wrong character is pressed, a buzzer sound is output.
  128.                 TInputDouble( const TRect&, int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  129.                 TInputDouble( int x, int y , int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  130.  
  131.  
  132.   TInputHexa:   Accepts only valid hexadecimal string input
  133.                 If a wrong character is pressed, a buzzer sound is output.
  134.                 TInputHexa( const TRect&, int len );
  135.                 TInputHexa( int x, int y , int len );
  136.  
  137.  
  138.   TInputDate:   Accepts only valid date input (or empty line)
  139.                 If a wrong character is pressed, a buzzer sound is output.
  140.                 TInputDate( const TRect& );
  141.                 TInputDate( int x, int y );
  142.  
  143.  
  144.   TInputCalcul: Accepts a calculation string
  145.                 If a wrong character is pressed, a buzzer sound is output.
  146.                 TInputCalcul( const TRect&, int len );
  147.                 TInputCalcul( int x, int y, int len );
  148.  
  149.  
  150.   TStaticInputLine:
  151.                 Same as TInputLine, but input must match a TGenCollection list.
  152.  
  153.                 When pressing characters, the first list item matching these
  154.                 characters is displayed. If a non matching character is pressed,
  155.                 a buzzer sound is output.
  156.                 The left and right arrows are used to cycle through items,
  157.                 Home & End to go to first & last item
  158.                 (and the matching buffer is reset).
  159.  
  160.                 TStaticInputLine( TRect&, int len, TGenCollection *list );
  161.                 TStaticInputLine( int x, int y, int len, TGenCollection *list );
  162.  
  163.  
  164.   New InputBox:
  165.   ============
  166.  
  167.   ushort inputPasswdBox( const char *Title, const char *aLabel, char *s, uchar limit );
  168.   ushort inputPasswdBoxRect( const TRect &bounds,
  169.                              const char *Title,
  170.                              const char *aLabel,
  171.                              char *s,
  172.                              uchar limit );
  173.  
  174.  
  175.   Misc:
  176.   ====
  177.  
  178.   ushort execDialog( TWindow *d, void *data );
  179.  
  180.         Execute a dialog box and returns entered values.
  181.         Fields are pre-loaded with data values.
  182.         If data is NULL, nothing is pre-loaded nor returned.
  183.         If the dialog is cancelled, data is not modified.
  184.         Dialog is destroyed before exiting.
  185.         Return:  command (cmCancel, cmYes,...)
  186.  
  187.  
  188.   void putCommand( ushort What, ushort Command );
  189.  
  190.         Put an event containing {What, Command}
  191.  
  192.  
  193.   appSystem( command );
  194.  
  195.         Suspend critical error handler,
  196.         clears screen,
  197.         perform a system call,
  198.         resume critical error handler,
  199.         redraws screen.
  200.  
  201.         If current drive is A: or B: and is not ready
  202.         (not inserted or not formatted), ask to insert
  203.         a formatted floppy (or Cancel).
  204.  
  205.         Return: 0 if OK, -1 if spawn error, cmCancel if Cancel.
  206.  
  207.   dosShell();
  208.                        
  209.         Same as appSystem() but spawns a new shell interpreter.
  210.  
  211.  
  212.   StatusBox:
  213.   ---------
  214.  
  215.   void StatusBox( char *message );
  216.   void StatusBoxf( char *format-string, ... );
  217.  
  218.         Puts a dialog box on screen to tell the user what the program is
  219.         doing while some long calculation is being done.
  220.         If a StatusBox is already on the screen it will be removed before
  221.         displaying the new StatusBox.
  222.         Strings are limited to 255 characters (like TStaticText).
  223.  
  224.   void RemoveStatusBox( void );
  225.  
  226.         Remove a StatusBox (if one is displayed).
  227.  
  228.   Boolean existStatusBox( void );
  229.         Tests if a StatusBox is on the screen
  230.  
  231.  
  232.   Standard Buttons:
  233.   ----------------
  234.  
  235.   void OKCancelButtons( TWindow *window );
  236.  
  237.        Insert a OK and a Cancel button in a window.
  238.        Insertion in the middle of the bottom of the window.
  239.        OK button is default one.
  240.  
  241.  
  242.   void YesNoCancelButtons( TWindow *window );
  243.  
  244.        Insert a Yes and a No button in a window.
  245.        Insertion in the middle of the bottom of the window.
  246.        Yes button is default one.
  247.  
  248.                   
  249.   TFileWindow::TFileWindow( char *fileName );
  250.  
  251.         Open a file viewer Window.
  252.  
  253.  
  254.  
  255.  
  256.   Gadgets:
  257.   =======
  258.                    
  259.   Clock:    Display a clock on screen
  260.  
  261.             TClockView::TClockView( TRect& r );
  262.                r is optional (default is upper right corner).
  263.             TClockView::update();     must be called in 'idle()'.
  264.  
  265.  
  266.   Heap viewer:    Display the heap size on screen 
  267.                   and check for heap correctness.
  268.  
  269.                   THeapView::THeapView( TRect& r );
  270.                      r is optional (default is lower right corner).
  271.                   THeapView::update();      must be called in 'idle()'.
  272.  
  273.                   If an error occurs in the heap, a messageBox display
  274.                   an error message and ask if you want to display the
  275.                   message again (that means each time it is checked
  276.                   before it is solved - if it is).
  277.  
  278.  
  279.   DeskTop Calendar:      TCalendarView( TRect & r );
  280.                             r is optional 
  281.                          TCalendarView( StreamableInit );
  282.  
  283.  
  284.   DeskTop Calculator:    TCalcDisplay( TRect& r );
  285.                             r is optional
  286.                          TCalcDisplay( StreamableInit );
  287.  
  288.  
  289.                            
  290.   DeskTop ASCII table:   TAsciiChart( TRect& r );
  291.                             r is optional
  292.                          TAsciiChart( StreamableInit );
  293.  
  294.  
  295.   Other:
  296.   =====
  297.  
  298.  ushort formatFloppy( int floppy );
  299.  
  300.    Format a  floppy if needed.
  301.    - Calls the DOS command FORMAT x: [/T:nn /N:nn] /V:""
  302.    - A check is performed after the format.
  303.    - If DOS version >= 4.0 use the /AUTOTEST switch
  304.      (undocumented) to skip prompt.
  305.    - If DOS version >= 5.0 use the /U switch to speed up format.
  306.  
  307.    Parameters :    in    int  floppy ( 0 = A:, 1 = B: )
  308.  
  309.    Return     :    cmOK or cmCancel
  310.  
  311. ***/