Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OGET.H Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OGET.H

Go to the documentation of this file.
00001 //Filename    : OGET.H
00002 //Description : Header file of OGET.CPP
00003 
00004 #ifndef __OGET_H
00005 #define __OGET_H
00006 
00007 //-------- Define macros -------------//
00008 
00009 enum { MAX_GET_WIDTH = 258 };
00010 
00011 //---------- Define data structure ----------//
00012 
00015 struct GetFld {
00016     short x;
00017     short y;
00018     short x2;
00019 
00020     void* data;
00021     char  type;
00022 
00023     short width_data;
00024     short width_scr;
00025     short dec_num;
00026 
00027     char* picture;
00028     char  upper_convert;
00029 
00030     char  (*valid_ptr)() ;
00031     char  (*call_ptr) (GetFld*, char*, int);
00032     int   call_data;                                // parameter used in calling (*call_ptr)()
00033 };
00034 
00035 typedef char GetCall( GetFld *, char *, int ) ;
00036 
00037 //--------- Define Class Structure ------------//
00038 
00039 class Font;
00040 
00042 class Get {
00043 public:
00044     char   mask_flag;                             // whether mask the display (e.g. for displaying password)
00045 
00046 private:
00047 
00048     //--------- Calling parameters ---------//
00049 
00050     short  get_num;                               // the total no. of gets
00051     short  max_get_num;                           // maximum no. of gets, allocated memory
00052 
00053     Font*  font_ptr;
00054 
00055     char   up_down_exit;                          // exit when UP is press at the first field or DOWN is press at the last field
00056 
00057     short  fld_x1;                                // for field() and detect() only
00058     short  fld_y1;
00059     short  fld_x2;
00060     short  fld_y2;
00061 
00062     //--------- Internal variables ----------//
00063 
00064     GetFld *fld_array;
00065     GetFld *fld_ptr;
00066 
00067     char   insert_flag;                           // insert flag
00068 
00069 public:
00070 
00071     Get();
00072     ~Get()         { deinit(); }
00073 
00074     void init(int,int);
00075     void deinit();
00076 
00077     void set_font(Font*);
00078 
00079     void add(int,int,void*,char,int);
00080     void picture(char*,int=0);
00081 
00082     void call(GetCall*,int);
00083     void valid( char(*)()) ;
00084     void width(int,int);
00085 
00086     char select(int,char **sel_opt);
00087 
00088     void display();
00089     int  read(int=1);
00090 
00091     //--- high level function for creating & detecting field ---//
00092 
00093     void field(int,int,char*,int,char*,int,int);
00094     void field(int x1, int y1, char* dataPtr, int dataWidth, int x2);
00095 
00096     int  detect();
00097 
00098 private:
00099     void check_data(GetFld*);
00100     void display_get(GetFld*,int);
00101     int  load_data(GetFld*,char*);
00102     void store_data( GetFld *, char *, char * ) ;
00103     int  right_pos( int, int, char * ) ;
00104     int  num_pos( int, int, char * ) ;
00105     void cursor_type(int);
00106 
00107     //-------- called by read() only ----------//
00108 
00109     int process_field_key( int keyCode, GetFld* getPtr, char* dataBuf,
00110                            char* pictBuf, int& curPos, int& bufPos);
00111 
00112     int valid_pict( int keyCode, GetFld* getPtr, char* dataBuf,
00113                     char* pictBuf, int& bufPos );
00114 
00115     int process_inter_field_key( int keyCode, GetFld* getPtr, int& firstFlag,
00116                                  int& firstKey, int& fieldId, int& bufPos );
00117 
00118     void init_field(char* dataBuf, char* pictBuf  , GetFld* getPtr,
00119                     int&  bufPos , int&  bufOffset, int &bufWidth );
00120 
00121     int get_next_key( char* dataBuf, char* pictBuf, GetFld* getPtr,
00122                       int&  bufPos , int&  bufOffset, int &bufWidth );
00123 
00124     int store_and_valid( int keyCode, char* dataBuf, char* pictBuf, GetFld* getPtr,
00125                          int& firstFlag );
00126 };
00127 
00128 //---------------------------------------------------//
00129 #endif

Generated on Fri Aug 23 01:37:45 2002 for VirtualU by doxygen1.2.17