home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / utility / QAP_Assist.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  8.9 KB  |  287 lines

  1. //    ============================================================================
  2. //    ÑÑÑ    QAP_Assist.h
  3. //    ============================================================================
  4. //        QA Partner/Macintosh Driver Assistance Hook Header 
  5. //        
  6. //        Copyright ⌐ 1993-1997 Segue Software, Inc.
  7. //        All Rights Reserved.
  8. //        
  9. //        QA PARTNER RELEASE VERSION 4.0 BETA 1
  10. //        THIS IS A BETA RELEASE.  THIS SOFTWARE MAY HAVE BUGS.  THIS SOFTWARE MAY CHANGE BEFORE FINAL RELEASE.
  11.  
  12.  
  13.  
  14.  
  15. #ifndef _MAC    //ÑNETSCAPE: added these lines
  16. #define _MAC
  17. #include <LTableView.h>
  18. #endif
  19.  
  20. #ifndef __QAP_ASSIST_H__
  21. #define __QAP_ASSIST_H__
  22.  
  23. #if !defined (WIN32) || defined (_MAC)
  24. #if defined (WIN32)
  25. #  include "windows.h"
  26. #  include "MacStubs.h"
  27. #  include "types.h"
  28.  
  29. #  include <macname1.h>
  30. #  include <controls.h>
  31. #  include <devices.h>
  32. #  include <files.h>
  33. #  include <mixedMode.h>
  34. #  include <processe.h>
  35. #  include <textEdit.h>
  36. #  include <macname2.h>
  37. #endif
  38.  
  39. //ÑNETSCAPE: added this definition
  40. #define QAP_BUILD            0
  41.  
  42. // The internal name of the QA Partner 4.0 driver
  43. #define QAP_DRIVER_NAME     "\p.QAP40"
  44.  
  45. // The PBControl code to send the driver to set the assist hook
  46. #define QAP_SET_ASSIST_HOOK 200
  47.  
  48. // The return value you can use if you're not ready to assist the driver
  49. #define QAP_CALL_ME_BACK    -1
  50.  
  51. // Special "index" values for kQAPGetListContents
  52. #define QAP_INDEX_ALL       -1
  53. #define QAP_INDEX_SELECTED  -2
  54.  
  55. //     Prototype for the assist hook function which you must supply
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59.     pascal short QAP_AssistHook (short selector, long handle, void *buffer, short val, long l_appA5);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63.  
  64. typedef pascal short (*QAPAssistHookPtr)(short, long, void *, short, long);
  65.  
  66. // Mixed-Mode junk for QAP_AssistHook
  67. #if GENERATINGPOWERPC || defined(powerc) || defined(__powerc) || defined (_MPPC_)
  68.     enum
  69.     {
  70.         uppQAPAssistHookInfo = kPascalStackBased
  71.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  72.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  73.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  74.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  75.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  76.         | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))            
  77.     };
  78.  
  79.     typedef UniversalProcPtr QAPAssistHookUPP;
  80.     #define CallQAPAssistHook(userRoutine, selector, handle, buffer, val, appA5)        \
  81.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppQAPAssistHookInfo, (short)(selector), (long)(handle), (void *)(buffer), (short)(val), (long)(appA5))
  82.     #define NewQAPAssistHook(userRoutine)        \
  83.         (QAPAssistHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppQAPAssistHookInfo, GetCurrentISA())
  84. #else
  85.     typedef QAPAssistHookPtr QAPAssistHookUPP;
  86.     #define CallQAPAssistHook(userRoutine, selector, handle, buffer, val, appA5)        \
  87.         (*(userRoutine))((short)(selector), (long)(handle), (void *)(buffer), (short)(val), (long)(appA5)) 
  88.     #define NewQAPAssistHook(userRoutine)        \
  89.         (QAPAssistHookUPP)(userRoutine)
  90. #endif
  91.  
  92. // The selectors for the assist hook callback function
  93. enum    
  94. {
  95. //     selector                        handle          buffer                      val                     return
  96. //     --------                        ------          ---                         ---                     ------
  97.     kQAPGetWindowContents,       // WindowPtr       wcinfo array ptr            max array elements      number of items returned
  98.     kQAPGetTextInfo,             // from wcinfo     textinfo struct ptr         1                       0 if no error
  99.     kQAPGetStaticText,           // from wcinfo     buffer ptr (Str255)         buffer size             0 if no erro
  100.     kQAPGetListInfo,             // from wcinfo     listinfo struct ptr         1                       0 if no erro
  101.     kQAPGetListContents,         // from wcinfo     buffer ptr                  index                   0 if no error
  102.     kQAPGetCustomItemName,       // from wcinfo        buffer ptr (Str255)         0                       0 if no error
  103.     kQAPGetCustomItemValue,         // from wcinfo        buffer ptr (long *)         0
  104.     kQAPAppToForeground,         // NULL            NULL                        0                       0 if no error
  105.     kQAPAppToBackground,         // NULL            NULL                        0                       0 if no error
  106.     kQAPGetScrollbarInfo,
  107.     kQAPWin32Service             // HWND            ptr to paramblock            win32 Service Selector
  108.  };
  109.  
  110.  // Selectors for win32 services
  111.  
  112. enum
  113. {
  114.     kQAP_CB_GetContents,
  115.     kQAP_CB_GetAttr,
  116.     kQAP_CB_GetInfo,
  117.     kQAP_CB_GetItemText,
  118.     kQAP_CB_GetText,
  119.     kQAP_CB_IsSelected,
  120.     kQAP_CB_SelectText,
  121.     
  122.     kQAP_LB_GetContents,
  123.     kQAP_LB_GetAtPoint,
  124.     kQAP_LB_GetAttr,
  125.     kQAP_LB_GetInfo,
  126.     kQAP_LB_GetItemInfo,
  127.     kQAP_LB_GetItemText,
  128.     kQAP_LB_IsSelected,
  129.  
  130.     kQAP_LV_GetContents,
  131.     kQAP_LV_GetAttr,
  132.     kQAP_LV_GetInfo,
  133.     kQAP_LV_GetItemInfo,
  134.     kQAP_LV_GetItemText,
  135.     kQAP_LV_IsSelected,
  136.     kQAP_LV_MakeVisible,
  137.     
  138.     kQAP_PGL_GetContents,
  139.     kQAP_PGL_GetInfo,
  140.     kQAP_PGL_GetItemRect,
  141.     kQAP_PGL_GetItemText,
  142.     kQAP_PGL_IsSelected,
  143.  
  144.     kQAP_SCL_GetLayout,
  145.     kQAP_SCL_GetValues,
  146.     
  147.     kQAP_TV_GetContents,
  148.     kQAP_TV_GetAtPoint,
  149.     kQAP_TV_GetAttr,
  150.     kQAP_TV_GetInfo,
  151.     kQAP_TV_GetItemInfo,
  152.     kQAP_TV_GetItemText,
  153.     kQAP_TV_IsSelected,
  154.     
  155.     kQAP_UD_GetLayout,
  156.     kQAP_UD_GetValues
  157. };
  158.  
  159. enum    
  160. {
  161.     // Window type codes for the WCINFO 'type' field
  162.     WT_COMPLETE = 0,    // marker for end of window item list (QAP will not add other items)
  163.     WT_INCOMPLETE,        // marker for end of assist item list (QAP will add other items too)
  164.     WT_CONTROL,            // Apple Control Manager control
  165.     WT_TEXT_FIELD,        // Apple TextEdit Manager Text Field
  166.     WT_LIST_BOX,        // Apple List Manager List Box
  167.     WT_ASSIST_ITEM,        // Custom control (type indicated in 'cls' field)
  168.     WT_IGNORE,            // Internal use
  169.     
  170.     // Window class codes for the WCINFO 'cls' field (only used for WT_ASSIST_ITEM items)
  171.     
  172.     WC_STATIC_TEXT = 256,
  173.     WC_TEXT_FIELD,
  174.     WC_LIST_BOX,
  175.     WC_POPUP_LIST,
  176.     WC_OWNER_DRAW,
  177.     WC_ICON,
  178.     WC_PICTURE,
  179.     WC_CUSTOM,
  180.     WC_PUSH_BUTTON,
  181.     WC_CHECK_BOX,
  182.     WC_RADIO_BUTTON,
  183.     WC_COMBO_BOX,
  184.     WC_LIST_VIEW,
  185.     WC_NULL,
  186.     WC_PAGE_LIST,
  187.     WC_TRACK_BAR,
  188.     WC_TREE_VIEW,
  189.     WC_UP_DOWN,
  190.     WC_SCROLL_BAR,
  191.     WC_WINDOW            // Internal use
  192. };
  193.  
  194. // Values for the 'flags' field of wcinfo 
  195. #define WCF_DISABLED    0x01
  196. #define WCF_NOCONTROL    0x02
  197.  
  198.  
  199. #if PRAGMA_ALIGN_SUPPORTED
  200. #   pragma options align = power
  201. #endif
  202.  
  203. // The structure to be filled in for each control when the assist hook
  204. // is called with the kQAPGetWindowContents selector
  205.  
  206. #define MAC_NAME_SIZE    32
  207.  
  208. typedef struct wcinfo
  209. {
  210.     Handle handle;
  211.     Rect rect;
  212.     short type;
  213.     short cls;
  214.     short flags;
  215.     short pad;        
  216.     char str[MAC_NAME_SIZE];
  217. } WCINFO, *PWCINFO, **PPWCINFO;
  218.  
  219. // The structure to be filled for the given item when the assist hook
  220. // is called with the kQAPGetTextInfo selector
  221.  
  222. typedef struct textinfo
  223. {
  224.     Handle handle;        // handle to the text if you want me to unlock it
  225.     TEHandle hTE;         // handle to the TE associated with the text (for dialog items)
  226.     Ptr ptr;              // pointer to the actual text (locked if a handle, please)
  227.     short len;            // length of the actual text
  228.     Boolean hasFocus;     // TRUE if typing right now would go to the text field
  229.     char state;           // value for HSetState if <handle> is not NULL
  230.     char buf[256];        // buffer to copy text into if you need a fixed place
  231. } TEXTINFO, *PTEXTINFO, **PPTEXTINFO;
  232.  
  233. // The structure to be filled for the given item when the assist hook
  234. // is called with the kQAPGetListInfo selector
  235.  
  236. typedef struct listinfo
  237. {
  238.     short itemCount;       // total number of items in the listbox
  239.     short topIndex;        // 1-based index of top visible item in list
  240.     short itemHeight;      // height of each list item, in pixels
  241.     short visibleCount;    // count of visible list items
  242.     ControlHandle vScroll; // ListBox's vertical scrollbar, or NULL
  243.     Boolean isMultiSel;    // TRUE if cmd-click selects multiple items
  244.     Boolean isExtendSel;   // TRUE if shift-click extends the selection range
  245.     Boolean hasText;       // TRUE if the list items are textual
  246.     Boolean reserved;       
  247. } QAPLISTINFO, *PQAPLISTINFO, **PPQAPLISTINFO;
  248.  
  249. typedef struct scrollbarinfo
  250. {
  251.     long lPos;
  252.     long lMin;
  253.     long lMax;
  254.     long lPageSize;
  255.     long lIncrement;
  256.     long lVertical;
  257.     long lHasThumb;
  258.     Point ptIncrArrow;
  259.     Point ptDecrArrow;
  260.     Point ptIncrPage;
  261.     Point ptDecrPage;
  262.     Point ptMinThumb;
  263.     Point ptMaxThumb;    
  264. } QAPSCROLLBARINFO, *PQAPSCROLLBARINFO, **PPQAPSCROLLBARINFO;
  265.  
  266. #if PRAGMA_ALIGN_SUPPORTED
  267. #   pragma options align = reset
  268. #endif
  269.  
  270. //ÑNETSCAPE --- begin
  271. class CQAPartnerTableMixin
  272. {
  273. public:
  274.                     CQAPartnerTableMixin(LTableView *);
  275.             virtual    ~CQAPartnerTableMixin();
  276.  
  277.     virtual void    QapGetListInfo (PQAPLISTINFO pInfo) = 0;
  278.     virtual Ptr        QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell) = 0;
  279.     virtual short    QapGetListContents(Ptr pBuf, short index);
  280.  
  281. protected:
  282.     LTableView *    mTableView;
  283. };
  284. //ÑNETSCAPE --- end
  285.  
  286. #endif // !defined (_VC) || defined (_MAC)
  287. #endif // __QAP_ASSIST_H__