home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / eclps.hpp < prev    next >
C/C++ Source or Header  |  2002-02-28  |  14KB  |  251 lines

  1. //-------------------------------------------------------------------------------
  2. // Module:  eclps.hpp
  3. //-------------------------------------------------------------------------------
  4. //
  5. // Description:  ECLPS class header file
  6. //
  7. //-------------------------------------------------------------------------------
  8. // Copyright Notice: IBM Personal Communication/3270 Version 4.3
  9. //                   (C) COPYRIGHT IBM CORP. 1989,1998 - PROGRAM PROPERTY
  10. //                   OF IBM ALL RIGHTS RESERVED
  11. //-------------------------------------------------------------------------------
  12.  
  13. #include "eclall.hpp"                                                  
  14. #ifndef _CHOSTPS_HPP_
  15. #define _CHOSTPS_HPP_
  16.  
  17.  
  18. #define  PS_WAIT_FOR_STRING           0x00000000                          
  19. #define  PS_WAIT_WHILE_STRING         0x00000001                          
  20. #define  PS_WAIT_FOR_FATTR            0x00000002                          
  21. #define  PS_WAIT_WHILE_FATTR          0x00000003                          
  22. #define  PS_WAIT_FOR_CURSOR           0x00000004                          
  23. #define  PS_WAIT_WHILE_CURSOR         0x00000005                          
  24. #define  PS_WAIT_FOR_STRING_IN_RECT   0x00000006                          
  25. #define  PS_WAIT_WHILE_STRING_IN_RECT 0x00000007                          
  26. #define  PS_WAIT_FOR_SCRDSC           0x00000008                          
  27. #define  PS_WAIT_WHILE_SCRDSC         0x00000009                          
  28.  
  29. #define  FATTR_MDT                0x01                                   
  30. #define  FATTR_PEN_MASK           0x0C                                   
  31. #define  FATTR_BRIGHT             0x08                                   
  32. #define  FATTR_DISPLAY            0x0C                                   
  33. #define  FATTR_ALPHA              0x10                                   
  34. #define  FATTR_NUMERIC            0x10                                   
  35. #define  FATTR_PROTECTED          0x20                                   
  36. #define  FATTR_PRESENT            0x80                                   
  37.  
  38. #define  FATTR_52_BRIGHT          0x10                                   
  39. #define  FATTR_52_DISP            0x40                                   
  40.  
  41. #define  FATTR_52_MASK            0x0E                                   
  42.                                             // 5250 Field attribute format:
  43.                                             // 0000 xxx0  bit 4-6
  44.                                             //
  45.                                             // 000 = 0 = alpha shift
  46.                                             // 001 = 1 = alpha only
  47.                                             // 010 = 2 = numeric shift
  48.                                             // 011 = 3 = numeric only
  49.                                             // 100 = 4 = katakana shift
  50.                                             // 101 = 5 = digits only
  51.                                             // 110 = 6 = i/o - mag stripe
  52.                                             // 111 = 7 = signed numeric
  53. #define  DBCS_SO                  0x0E      
  54.  
  55. //------------------- Enumerations
  56. enum PS_PLANE {                             // Presentation Space data planes
  57.   NoPlane      = 0x00,                      // No data
  58.   TextPlane    = 0x01,                      // Text plane (NULL terminated)
  59.   ColorPlane   = 0x02,                      // Color plane
  60.   FieldPlane   = 0x04,                      // Field attribute plane
  61.   ExfieldPlane = 0x08,                      // Extended field (character) attribute plane
  62.   DBCSPlane    = 0x10,                      // DBCS character plane
  63.   GridPlane    = 0x20,                      // DBCS grid line plane
  64.   AllPlanes    = 0x3F,                      // All planes
  65.   HostPlane    = 0x80                       // Raw EBCDIC Data. Host Plane has specific usage and is not included in All Planes
  66. };                                                                               
  67.  
  68. typedef struct tagRect
  69. {
  70.    ULONG Left;
  71.    ULONG Top;
  72.    ULONG Right;
  73.    ULONG Bottom;
  74. }ECLRECT;
  75.  
  76. enum PS_DIR {                               // Search direction                  
  77.   SrchForward,                              // Search forward                    
  78.   SrchBackward                              // Search backward                   
  79. };
  80. class ECLPSData;                            // Foreward declaration 
  81. class DllExport ECLPS: public ECLConnection
  82. {
  83.   private: // Class private data
  84.     ECLPSData   *pd;                            
  85.  
  86.   private: // Constructors and operators not allowed on this object
  87.     ECLPS();
  88.     ECLPS(const ECLPS &From);
  89.     ECLPS& operator= (const ECLPS &From);
  90.  
  91.   public:
  92.  
  93.     // Constructor/destructor
  94.     ECLPS(char ConnName);
  95.     ECLPS(long ConnHandle);
  96.     ECLPS& operator= (const char * const String);  // String assignment
  97.     ECLPS& operator= (const LONG Value);           // Numeric assignment
  98.     ~ECLPS();
  99.  
  100.     ULONG GetSize() const;
  101.     ULONG GetSizeRows() const;
  102.     ULONG GetSizeCols() const;
  103.     void  GetSize(ULONG * Row, ULONG * Col) const;
  104.  
  105.     ULONG GetCursorPos() const;
  106.     ULONG GetCursorPosRow() const;
  107.     ULONG GetCursorPosCol() const;
  108.     void  GetCursorPos(ULONG * Row, ULONG * Col) const;
  109.  
  110.     void  SetCursorPos(ULONG Pos);
  111.     int   SetBIDICursorPos(ULONG Pos, int flag);             
  112.     void  SetCursorPos(ULONG Row, ULONG Col);
  113.  
  114.     void  SendKeys(const char * const text);
  115.     void  SendKeys(const WCHAR* const text);                          
  116.     void  SendKeys(const char * const text, ULONG AtPos);
  117.     void  SendKeys(const WCHAR* const text, ULONG AtPos);             
  118.     void  SendKeys(const char * const text, ULONG AtRow, ULONG AtCol);
  119.     void  SendKeys(const WCHAR* const text, ULONG AtRow, ULONG AtCol);
  120.     void  StartMacro(const char * const MacroName);
  121.  
  122.     ULONG SearchText(const char * const text, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;
  123.     ULONG SearchText(const WCHAR* const text, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;                                  
  124.     ULONG SearchText(const char * const text, ULONG StartPos, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;
  125.     ULONG SearchText(const WCHAR* const text, ULONG StartPos, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;                  
  126.     ULONG SearchTextLength(const char * const text, ULONG StartPos, ULONG length, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const; 
  127.     ULONG SearchTextLength(const char * const text, ULONG StartRow, ULONG StartCol, ULONG length, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const; 
  128.     ULONG SearchText(const char * const text, ULONG StartRow, ULONG StartCol, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;
  129.     ULONG SearchText(const WCHAR * const text, ULONG StartRow, ULONG StartCol, PS_DIR Dir=SrchForward, BOOL FoldCase=FALSE) const;  
  130.  
  131.     ULONG GetScreen(char * Buff, ULONG BuffLen, PS_PLANE Plane=TextPlane) const;
  132.     ULONG GetScreen(WCHAR* Buff, ULONG BuffLen, PS_PLANE Plane=TextPlane) const;                                                   
  133.     ULONG GetScreen(char * Buff, ULONG BuffLen, ULONG StartPos, ULONG Length, PS_PLANE Plane=TextPlane) const;
  134.     ULONG GetScreen(WCHAR* Buff, ULONG BuffLen, ULONG StartPos, ULONG Length, PS_PLANE Plane=TextPlane) const;                     
  135.     ULONG GetScreen(char * Buff, ULONG BuffLen, ULONG StartRow, ULONG StartCol, ULONG Length, PS_PLANE Plane=TextPlane) const;
  136.     ULONG GetScreen(WCHAR* Buff, ULONG BuffLen, ULONG StartRow, ULONG StartCol, ULONG Length, PS_PLANE Plane=TextPlane) const;     
  137.     ULONG GetScreenRect(char * Buff, ULONG BuffLen, ULONG StartPos, ULONG EndPos, PS_PLANE Plane=TextPlane) const;
  138.     ULONG GetScreenRect(char * Buff, ULONG BuffLen, ULONG StartRow, ULONG StartCol, ULONG EndRow, ULONG EndCol, PS_PLANE Plane=TextPlane) const;
  139.  
  140.     // Implementation Not for documentation
  141.     BOOL IsDataInPosition(const unsigned char* pTestData, ULONG nPos, PS_PLANE Plane=TextPlane, BOOL bString=TRUE, BOOL bCaseSensitive = TRUE,
  142.         unsigned char cMask = 0xFF);                                    
  143.     // Implementation Not for documentation
  144.     BOOL IsDataInRect(const unsigned char* pTestData, ECLRECT Rect, PS_PLANE Plane, BOOL bString, BOOL bCaseSensitive); 
  145.  
  146.     void  SetText(const char * const text);                            
  147.     void  SetText(const WCHAR* const text);                            
  148.     void  SetText(const char * const text, ULONG AtPos);               
  149.     void  SetText(const WCHAR* const text, ULONG AtPos);               
  150.     void  SetText(const char * const text, ULONG AtRow, ULONG AtCol);  
  151.     void  SetText(const WCHAR* const text, ULONG AtRow, ULONG AtCol);  
  152.  
  153.     ULONG ConvertPosToRow(ULONG Pos) const;
  154.     ULONG ConvertPosToCol(ULONG Pos) const;
  155.     void  ConvertPosToRowCol(ULONG Pos, ULONG * Row, ULONG * Col) const;
  156.     ULONG ConvertRowColToPos(ULONG Row, ULONG Col) const;
  157.     // Implementation Not for documentation
  158.     ULONG ConvertRowColToPos(int Row, int Col) const;                   
  159.  
  160.     ECLFieldList *   GetFieldList() const;
  161.  
  162.     // Functions to register interest in various events
  163.     void RegisterKeyEvent(ECLKeyNotify *NotifyObject);
  164.     void UnregisterKeyEvent(ECLKeyNotify *NotifyObject);
  165.  
  166.     // New functions for PComm Version 4.3
  167.     void RegisterPSEvent(ECLPSNotify *Observer, BOOL InitEvent=FALSE);  
  168.     void UnregisterPSEvent(ECLPSNotify *Observer);                      
  169.     void RegisterPSEvent(ECLPSListener *Listener, int Type = ALL_EVENTS, BOOL InitEvent=FALSE);
  170.     BOOL UnregisterPSEvent(ECLPSListener *Listener, int Type = ALL_EVENTS);      
  171.  
  172.     BOOL WaitWhileCursor(int nRow, int nCol, long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE);
  173.     BOOL WaitForCursor(int nRow, int nCol, long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE);
  174.     BOOL WaitWhileString(const char* szWaitString, int nRow = 0, int nCol = 0, 
  175.         long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE, BOOL bCaseSensitive = TRUE);
  176.     BOOL WaitForString(const char* szWaitString, int nRow = 0, int nCol = 0, 
  177.         long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE, BOOL bCaseSensitive = TRUE);
  178.     BOOL WaitWhileAttrib(int nRow, int nCol, unsigned char cWaitData, unsigned char cMask = 0xFF, PS_PLANE Plane = FieldPlane, 
  179.         long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE);           
  180.     BOOL WaitForAttrib(int nRow, int nCol, unsigned char cWaitData, unsigned char cMask = 0xFF, PS_PLANE Plane = FieldPlane, 
  181.         long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE);            
  182.     BOOL WaitForStringInRect(const char* szWaitString, ULONG nTop, ULONG nLeft, 
  183.                ULONG nBottom, ULONG nRight, long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE, 
  184.                BOOL bCaseSensitive = TRUE);                              
  185.     BOOL WaitWhileStringInRect(const char* szWaitString, ULONG nTop, ULONG nLeft, 
  186.                ULONG nBottom, ULONG nRight, long nTimeOut = INFINITE, BOOL bWaitForInput = TRUE, 
  187.                BOOL bCaseSensitive = TRUE);                             
  188.     BOOL WaitForScreen(ECLScreenDesc* pScrDesc, long nTimeOut);         
  189.     BOOL WaitWhileScreen(ECLScreenDesc* pScrDesc, long nTimeOut);       
  190.  
  191.     void CancelWait();                                                  
  192.     ECLFieldList *   CreateFieldList(PS_PLANE Plane) const;  // Create new ECLFieldList object 
  193.     int  GetPCCodePage();                                               
  194.     int  GetHostCodePage();                                             
  195.     int  GetOSCodePage();                                               
  196.     BOOL IsDBCS();                                                      
  197.     ULONG  GetFieldText(ULONG pos, char *Buff, ULONG length) const;     
  198.  
  199.  
  200.   protected:
  201.     // Implementation Not for documentation
  202.     HANDLE m_hWaitEvent;                                                
  203.     // Implementation Not for documentation
  204.     BOOL DoWait(ULONG nTrigger, int nRow1, int nCol1, const unsigned char* pWaitData1 = NULL, BOOL bCaseSensitive = TRUE, 
  205.         BOOL bWaitForInput = TRUE, long nTimeOut = 0xFFFFFFFF, PS_PLANE Plane = TextPlane, unsigned char cMask = 0xFF);
  206.     // Implementation Not for documentation
  207.     BOOL DoWait(ULONG nTrigger, ECLRECT Rect, const unsigned char* pWaitData, BOOL bCaseSensitive, 
  208.         BOOL bWaitForInput = TRUE, long nTimeOut = 0xFFFFFFFF, PS_PLANE Plane = TextPlane);
  209.     // Implementation Not for documentation
  210.     BOOL DoWait(ULONG nTrigger, ECLScreenDesc* pSD, long nTimeOut);     
  211.     // Implementation Not for documentation
  212. };
  213.  
  214. typedef ECLPS * PECLPS;
  215.  
  216. // Implementation Not for documentation
  217. class PSWaitNotify:public ECLPSNotify                                   
  218. {
  219. protected:
  220.     ECLPS* m_pPS;
  221.     BOOL m_bCondMet;
  222.     ULONG m_nTrigger;
  223.     ULONG m_nWatchPos1;
  224.     ECLRECT m_Rect;
  225.     const unsigned char* m_pWatchData1;
  226.     PS_PLANE m_Plane;
  227.     BOOL m_bCaseSensitive;
  228.     unsigned char m_cMask;                                              
  229.     ECLScreenDesc* m_pSD;                                               
  230.  
  231.     HANDLE m_hEvent;
  232.  
  233. public:
  234.     PSWaitNotify(ECLPS* pPSObj, ULONG nTrigger, ULONG nPos1, 
  235.         const unsigned char* pWatchData, PS_PLANE Plane, BOOL m_bCaseSensitive, 
  236.         unsigned char cMask = 0xFF);
  237.     PSWaitNotify(ECLPS* pPSObj, ULONG nTrigger, ECLRECT Rect, 
  238.         const unsigned char* pWatchData, PS_PLANE Plane, BOOL m_bCaseSensitive);
  239.  
  240.     PSWaitNotify(ECLPS* pPSObj, ULONG nTrigger, ECLScreenDesc* pSD);    
  241.  
  242.     ~PSWaitNotify();                                                    
  243.  
  244.     void NotifyEvent(ECLPS* PSObj);
  245.  
  246.     HANDLE GetEvent(){return m_hEvent;}
  247.     BOOL   IsCondMet(){return m_bCondMet;}
  248. };
  249.  
  250. #endif //_CHOSTPS_HPP_
  251.