home *** CD-ROM | disk | FTP | other *** search
- /***
- Module : TVTOOLS
-
- Description : Various tools and addings for TV
-
- Remark : This library calls a lot of general functions
- from the 'general' libraries (STRINGS.LIB, TOOLS.LIB,...).
- This mean that you have to include the related include
- files.
-
-
-
- New operators: TMenuItem = TMenuItem + TMenuItem
- ============= TMenuItem += TMenuItem
- TSItem = TSItem + TSItem
- TSItem += TSItem
- TSubMenu += TSubMenu
- TSubMenu += TMenuItem
- TStatusDef += TStatusDef
- TStatusDef += TStatusItem
-
-
- General List:
- ============
-
- TGenCollection: Same as TStringCollection
- TGenCollection( ccIndex = 0, ccIndex = 0 );
-
- but with two output functions:
- char *getData( ccIndex ); // to return the data
- char *getText( ccIndex ); // to display text in a viewer
- By default, getData() calls getText().
-
- These functions have to be used in place of TStringCollection ones
- and can be overloaded:
- ccIndex indexOf( char *item ); // data index
- ccIndex indexOfText( char *item ); // text index
- void *firstThat( ccTestFunc Test, void *arg ); // search
- void *firstTextThat( ccTestFunc Test, void *arg ); // search
- int getCount(); // returns number of items
- int getTextLength(); // returns maximum length of text
- int compare( void *, void * ); // function to compare to items
- All these virtual functions are designed to work as is with
- TStringCollection lists.
- The functions you need to overload to use another list mechanism are:
- getData(), getText(), getCount()
- the other ones use these three ones.
- default compare() is case-insensitive
- (also éàÅ,... are treated as normal letters).
-
-
- ComboBox:
- ========
-
- TComboBox: Pop-up box with a list viewer
- Must be linked with a TInputLine (or TStaticInputLine)
- ans a TGenCollection.
-
- When pressing characters, the first list item matching these
- characters is focused. If a non matching character is pressed,
- a buzzer sound is output.
-
- Enter or double-click is used to select an item.
- The corresponding data will so be given to the TInputLine.
-
- TComboBox( const TRect&, TInputLine *, TGenCollection * );
- TComboBox( TInputLine *, TGenCollection * ); // Right of line
-
-
- New Input fields:
- ================
-
- TInput1Line( x, y, len )
-
- T1StaticText( x, y, string ): same as TStaticText
-
- TStaticTextf( const TRect& bounds, const char *fmt, ... )
- TStaticTextf( const ushort x, const ushort y, const char *fmt, ... )
- same as TStaticText but allows same syntax as printf()
-
- T1Label( x, y, string, link )
-
-
- TInputKey: Same as TInputLine, except invalid if empty
- TInputKey( const TRect&, int len );
- TInputKey( int x, int y, int len );
-
-
- TInputPasswd: Same as TInputLine, but display only '*'
- TInputPasswd( const TRect&, int len );
- TInputPasswd( int x, int y, int len );
-
-
- TInputRegExp: Same as TInputLine, but filter input to be in a 'set'
- and check result to match the regular expression 'regexp'.
- If UPPER or LOWER is given as last parameter, all characters
- are translate into upper/lowercase (also éàÅ,...).
-
- If an invalid character is pressed, a buzzer sound is output.
- If input does not match the regular expression, a messageBox
- is output at valid() time. This message may be replaced
- or disabled (0).
- char *invMsg = " \n\03Invalid entry !";
-
- 'set' and 'regexp' comply with UNIX-grep regular expressions;
- ex: set = "0-9a-z+-*/" or "^0-9"
- regexp = "[0-9]*.[a-zA-Z]*..*"
- 'set' and 'regexp' can be nul (0 or not given).
-
- TInputRegExp( const TRect&, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
- TInputRegExp( int x, int y, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
-
-
- TInputInt: Accepts only valid numeric input (int) between Min and Max
- If a wrong character is pressed, a buzzer sound is output.
- TInputInt( const TRect&, int len = 7, int min = -MAXINT, int max = MAXINT );
- TInputInt( int x, int y , int len = 7, int min = -MAXINT, int max = MAXINT );
-
-
- TInputLong: Accepts only valid numeric input (long) between Min and Max
- If a wrong character is pressed, a buzzer sound is output.
- TInputLong( const TRect&, int len = 12, long min = -MAXLONG, long max = MAXLONG );
- TInputLong( int x, int y , int len = 12, long min = -MAXLONG, long max = MAXLONG );
-
-
- TInputDouble: Accepts only valid numeric input between Min and Max
- If a wrong character is pressed, a buzzer sound is output.
- TInputDouble( const TRect&, int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
- TInputDouble( int x, int y , int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
-
-
- TInputHexa: Accepts only valid hexadecimal string input
- If a wrong character is pressed, a buzzer sound is output.
- TInputHexa( const TRect&, int len );
- TInputHexa( int x, int y , int len );
-
-
- TInputDate: Accepts only valid date input (or empty line)
- If a wrong character is pressed, a buzzer sound is output.
- TInputDate( const TRect& );
- TInputDate( int x, int y );
-
-
- TInputCalcul: Accepts a calculation string
- If a wrong character is pressed, a buzzer sound is output.
- TInputCalcul( const TRect&, int len );
- TInputCalcul( int x, int y, int len );
-
-
- TStaticInputLine:
- Same as TInputLine, but input must match a TGenCollection list.
-
- When pressing characters, the first list item matching these
- characters is displayed. If a non matching character is pressed,
- a buzzer sound is output.
- The left and right arrows are used to cycle through items,
- Home & End to go to first & last item
- (and the matching buffer is reset).
-
- TStaticInputLine( TRect&, int len, TGenCollection *list );
- TStaticInputLine( int x, int y, int len, TGenCollection *list );
-
-
- New InputBox:
- ============
-
- ushort inputPasswdBox( const char *Title, const char *aLabel, char *s, uchar limit );
- ushort inputPasswdBoxRect( const TRect &bounds,
- const char *Title,
- const char *aLabel,
- char *s,
- uchar limit );
-
-
- Misc:
- ====
-
- ushort execDialog( TWindow *d, void *data );
-
- Execute a dialog box and returns entered values.
- Fields are pre-loaded with data values.
- If data is NULL, nothing is pre-loaded nor returned.
- If the dialog is cancelled, data is not modified.
- Dialog is destroyed before exiting.
- Return: command (cmCancel, cmYes,...)
-
-
- void putCommand( ushort What, ushort Command );
-
- Put an event containing {What, Command}
-
-
- appSystem( command );
-
- Suspend critical error handler,
- clears screen,
- perform a system call,
- resume critical error handler,
- redraws screen.
-
- If current drive is A: or B: and is not ready
- (not inserted or not formatted), ask to insert
- a formatted floppy (or Cancel).
-
- Return: 0 if OK, -1 if spawn error, cmCancel if Cancel.
-
- dosShell();
-
- Same as appSystem() but spawns a new shell interpreter.
-
-
- StatusBox:
- ---------
-
- void StatusBox( char *message );
- void StatusBoxf( char *format-string, ... );
-
- Puts a dialog box on screen to tell the user what the program is
- doing while some long calculation is being done.
- If a StatusBox is already on the screen it will be removed before
- displaying the new StatusBox.
- Strings are limited to 255 characters (like TStaticText).
-
- void RemoveStatusBox( void );
-
- Remove a StatusBox (if one is displayed).
-
- Boolean existStatusBox( void );
- Tests if a StatusBox is on the screen
-
-
- Standard Buttons:
- ----------------
-
- void OKCancelButtons( TWindow *window );
-
- Insert a OK and a Cancel button in a window.
- Insertion in the middle of the bottom of the window.
- OK button is default one.
-
-
- void YesNoCancelButtons( TWindow *window );
-
- Insert a Yes and a No button in a window.
- Insertion in the middle of the bottom of the window.
- Yes button is default one.
-
-
- TFileWindow::TFileWindow( char *fileName );
-
- Open a file viewer Window.
-
-
-
-
- Gadgets:
- =======
-
- Clock: Display a clock on screen
-
- TClockView::TClockView( TRect& r );
- r is optional (default is upper right corner).
- TClockView::update(); must be called in 'idle()'.
-
-
- Heap viewer: Display the heap size on screen
- and check for heap correctness.
-
- THeapView::THeapView( TRect& r );
- r is optional (default is lower right corner).
- THeapView::update(); must be called in 'idle()'.
-
- If an error occurs in the heap, a messageBox display
- an error message and ask if you want to display the
- message again (that means each time it is checked
- before it is solved - if it is).
-
-
- DeskTop Calendar: TCalendarView( TRect & r );
- r is optional
- TCalendarView( StreamableInit );
-
-
- DeskTop Calculator: TCalcDisplay( TRect& r );
- r is optional
- TCalcDisplay( StreamableInit );
-
-
-
- DeskTop ASCII table: TAsciiChart( TRect& r );
- r is optional
- TAsciiChart( StreamableInit );
-
-
- Other:
- =====
-
- ushort formatFloppy( int floppy );
-
- Format a floppy if needed.
- - Calls the DOS command FORMAT x: [/T:nn /N:nn] /V:""
- - A check is performed after the format.
- - If DOS version >= 4.0 use the /AUTOTEST switch
- (undocumented) to skip prompt.
- - If DOS version >= 5.0 use the /U switch to speed up format.
-
- Parameters : in int floppy ( 0 = A:, 1 = B: )
-
- Return : cmOK or cmCancel
-
- ***/