home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / pm / dragdrop / dragdrop.h < prev    next >
Text File  |  1999-05-11  |  9KB  |  259 lines

  1. /**************************************************************************
  2.  *  File name  :  dragdrop.h
  3.  *
  4.  *  Description:  The DRAGDROP include file defines symbolic constants
  5.  *                used in the following files:
  6.  *                      DRAGDROP.C  DRAGHEAP.C  DRAGDRAG.C  DRAGHELP.C
  7.  *                Local procedure declarations appear in this file to
  8.  *                ensure they have been declared before being used.
  9.  *
  10.  *  Concepts   :  [none]
  11.  *
  12.  *  API's      :  [none]
  13.  *
  14.  *  Copyright (C) 1991 IBM Corporation
  15.  *
  16.  *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  17.  *      sample code created by IBM Corporation. This sample code is not
  18.  *      part of any standard or IBM product and is provided to you solely
  19.  *      for  the purpose of assisting you in the development of your
  20.  *      applications.  The code is provided "AS IS", without
  21.  *      warranty of any kind.  IBM shall not be liable for any damages
  22.  *      arising out of your use of the sample code, even if they have been
  23.  *      advised of the possibility of such damages.                                                    *
  24.  *************************************************************************/
  25.  
  26. #define STACKSIZE            11228
  27. #define MESSAGELEN          50    /* maximum length for messages */
  28.  
  29. #define ID_RESOURCE             1
  30. #define ID_BUSY                 260
  31.  
  32. #define IDD_OPEN                300
  33. #define IDD_STATICTEXT          301
  34. #define IDD_EDIT                302
  35.  
  36. #define IDM_MENU                10
  37. #define IDM_FILE                20
  38. #define IDM_FILEOPEN            21
  39. #define IDM_EXIT                22
  40. #define IDM_WINDOW              30
  41. #define IDM_WINDOWREFRESH       31
  42. #define IDM_WINDOWSELECTALL     32
  43. #define IDM_WINDOWDESELECTALL   33
  44. #define IDM_RENDER              40
  45. #define IDM_TARGET              41
  46. #define IDM_NOTARGET            42
  47. #define IDM_FILENATIVE          43
  48. #define IDM_DDENATIVE           44
  49. #define IDM_DRAGFILES           50
  50. #define IDM_DROPFILES           51
  51. #define IDM_SRCRENDER           52
  52. #define IDM_HELP                60
  53. #define IDM_HELPINDEX           61
  54. #define IDM_HELPGENERAL         62
  55. #define IDM_HELPUSINGHELP       63
  56. #define IDM_HELPPRODUCTINFO     64
  57.  
  58. #define IDS_APPNAME             16
  59. #define IDS_CLIENTCLASS         17
  60. #define IDS_HELPLIBRARYNAME     18
  61.  
  62. #define IDD_PRODUCTINFO     1001
  63.  
  64. #define IDC_OK              1
  65. #define IDC_CANCEL          2
  66. #define IDC_HELP            3
  67. #define IDC_ICON            4
  68. #define IDC_BITMAP          5
  69. #define IDR_BITMAP          6
  70.  
  71. #define INITIAL_SEGSIZE         4096
  72. #define INCREMENT_SEGSIZE       1024
  73.  
  74. #define MAX_RETRIES             10
  75.  
  76. #define LIST_ID                 256
  77. #define MSGBOXID                1002
  78.  
  79. #define IDMSG_INITFAILED                1
  80. #define IDMSG_MAINWINCREATEFAILED       2
  81. #define IDMSG_CANTCREATELIST            3
  82. #define IDMSG_NOTSUBDIRECTORY           4
  83. #define IDMSG_MUSTBESELECTED            5
  84. #define IDMSG_BADDIRECTORY              6
  85. #define IDMSG_ATLEASTONE                7
  86. #define IDMSG_CANTLOCATE                8
  87. #define IDMSG_CANTCREATESTACK           9
  88. #define IDMSG_HEAPERROR                10
  89. #define IDMSG_HEAPALLOCERROR           11
  90. #define IDMSG_ALLOCDRAGINFO            12
  91. #define IDMSG_CANNOTLOADSTRING         13
  92. #define IDMSG_HELPNOTAVAILABLE         14
  93. #define IDMSG_HELPCREATEERROR          15
  94. #define IDMSG_HELPASSOCIATEERROR       16
  95. #define IDMSG_HELPDISPLAYERROR         17
  96. #define IDMSG_CANTSTARTDIALOG          18
  97. #define IDMSG_DRAGERROR                19
  98. #define IDMSG_DRAGACCESSERROR          20
  99. #define IDMSG_DRAGFREEERROR            21
  100. #define IDMSG_DRAGSETITEMERROR         22
  101. #define IDMSG_DRAGQUERYSTRINGERROR     23
  102. #define IDMSG_DRAGQUERYITEMERROR       24
  103. #define IDMSG_FINDAPPDRAGINFO          25
  104. #define IDMSG_MEMFREEERROR             26
  105. #define IDMSG_TARGETRENDER             27
  106.  
  107. /* return values for initialization routines */
  108. #define RETURN_SUCCESS      0   /* successful return in DosExit */
  109. #define RETURN_ERROR        1   /* error return in DosExit */
  110. #define BEEP_WARN_FREQ      60  /* frequency of warning beep */
  111. #define BEEP_WARN_DUR      100  /* duration of warning beep */
  112.  
  113. /*
  114.  * User defined commands
  115.  */
  116.  
  117. #define WM_REFRESH              WM_USER+1
  118. #define WM_CREATELIST           WM_USER+2
  119. #define LN_INITDRAG             WM_USER+3
  120. #define LN_DRAGOVER             WM_USER+4
  121. #define LN_DRAGLEAVE            WM_USER+5
  122. #define LN_DROPHELP             WM_USER+6
  123. #define LN_DROP                 WM_USER+7
  124. #define WM_TARGETCOMPLETE       WM_USER+8
  125.  
  126.  
  127. /*
  128.  * type definitions
  129.  */
  130.  
  131. typedef struct _PUBFILEFINDBUF
  132.         {
  133.         struct _PUBFILEFINDBUF FAR *pNext;
  134.         FDATE   fdateLastWrite;
  135.         FTIME   ftimeLastWrite;
  136.         ULONG   cbFileAlloc;
  137.         ULONG   attrFile;
  138.         CHAR    achName[64];
  139.         } PUBFILEFINDBUF;
  140. typedef PUBFILEFINDBUF FAR      *PPUBFILEFINDBUF;
  141.  
  142.  
  143. typedef struct _DRAGTARGETTHREAD
  144.         {
  145.         PDRAGINFO       pDraginfo;
  146.         HWND            hwndClient;
  147.         USHORT          usOperation;
  148.         CHAR            szTargetDir [CCHMAXPATH];
  149.         } DRAGTARGETTHREAD;
  150. typedef DRAGTARGETTHREAD FAR *PDRAGTARGETTHREAD;
  151.  
  152. typedef struct _APPDRAGINFO
  153.         {
  154.         struct _APPDRAGINFO FAR *pNextAppDraginfo;
  155.         PDRAGINFO       pDraginfo;
  156.         HWND            hwndClient;
  157.         USHORT          usItemsDragged;
  158.         } APPDRAGINFO;
  159. typedef APPDRAGINFO FAR *PAPPDRAGINFO;
  160.  
  161.  
  162. typedef struct _APPDRAGITEM
  163.         {
  164.         PDRAGINFO       pDraginfo;
  165.         PPUBFILEFINDBUF pFile;
  166.         } APPDRAGITEM;
  167. typedef APPDRAGITEM FAR *PAPPDRAGITEM;
  168.  
  169.  
  170. /*
  171.  * Function models - DRAGDROP.C
  172.  */
  173. MRESULT EXPENTRY ClientWndProc    (HWND, ULONG, MPARAM, MPARAM);
  174. MRESULT EXPENTRY OpenDlgProc      (HWND, ULONG, MPARAM, MPARAM);
  175. MRESULT EXPENTRY ListSubclassProc (HWND, ULONG, MPARAM, MPARAM);
  176. BOOL    ChangeDir     (PSZ);
  177. BOOL    PopulateList  (HWND, PSZ);
  178. VOID    Message (PSZ pszMsg);
  179. SHORT   MessageBox(HWND hwndOwner, SHORT idMsg, SHORT fsStyle, BOOL fBeep);
  180.  
  181.  
  182. /*
  183.  * Function models - DRAGHEAP.C
  184.  */
  185. BOOL            FindFilePurge (VOID);
  186. PPUBFILEFINDBUF FindFileFirst (PSZ, ULONG);
  187. PPUBFILEFINDBUF FindFileNext  (PPUBFILEFINDBUF);
  188. PPUBFILEFINDBUF FindFileName  (PSZ);
  189.  
  190. PAPPDRAGINFO    AllocAppDraginfo (HWND, PDRAGINFO);
  191. PAPPDRAGITEM    AllocAppDragitem (PDRAGINFO, PPUBFILEFINDBUF);
  192. BOOL            FreeAppDraginfo  (PAPPDRAGINFO);
  193. BOOL            FreeAppDragitem  (PAPPDRAGITEM);
  194. PDRAGINFO       FindDraginfo     (PAPPDRAGITEM);
  195. PAPPDRAGINFO    FindAppDraginfo  (PDRAGINFO);
  196. PPUBFILEFINDBUF FindDragitemFile (PAPPDRAGITEM);
  197.  
  198.  
  199. /*
  200.  * Function models - DRAGDRAG.C
  201.  */
  202. BOOL    InitDrag        (HAB, HWND, HWND, HPOINTER, HPOINTER, HPOINTER, PSZ);
  203. MRESULT Drop            (HAB, HWND, PDRAGINFO, PSZ);
  204. MRESULT DragLeave       (VOID);
  205. MRESULT DragOver        (HAB, PDRAGINFO, PSZ);
  206. MRESULT DropHelp        (HWND, PDRAGINFO);
  207. MRESULT EndConversation (HAB, HWND, MPARAM, MPARAM);
  208. MRESULT EndTarget       (HWND, PDRAGTARGETTHREAD);
  209. MRESULT CheckClose      (HWND);
  210. BOOL CheckBusy          (VOID);
  211. VOID    PreventClose    (HWND hwndClient, ULONG cDrag);
  212. VOID    RemoveFinalBackslash (PSZ);
  213. VOID FAR TargetThread   (VOID);
  214.  
  215. /*
  216.  * Function models - DRAGHELP.C
  217.  */
  218. VOID InitHelp(HAB hab, HWND hwnd);
  219. VOID HelpIndex(HWND hwnd);
  220. VOID HelpGeneral(HWND hwnd);
  221. VOID HelpUsingHelp(HWND hwnd);
  222. VOID HelpProductInfo(HWND hwnd);
  223. VOID DestroyHelpInstance(VOID);
  224. VOID SetSysMenu(HWND hwnd);
  225.  
  226. /*
  227.  * Helper Macros
  228.  */
  229. #define WinDeleteLboxAll(hwndLbox) \
  230.     ((BOOL)WinSendMsg((hwndLbox), LM_DELETEALL, NULL, NULL))
  231.  
  232. #define WinQueryLboxSelItemFirst(hwndLbox) \
  233.     ((SHORT)WinSendMsg((hwndLbox), LM_QUERYSELECTION, \
  234.             MPFROMSHORT (LIT_FIRST), NULL))
  235.  
  236. #define WinQueryLboxSelItemNext(hwndLbox, index) \
  237.     ((SHORT)WinSendMsg((hwndLbox), LM_QUERYSELECTION, \
  238.             MPFROMSHORT (index), NULL))
  239.  
  240. #define WinScrollLboxItemToTop(hwndLbox, index) \
  241.     ((BOOL)WinSendMsg((hwndLbox), LM_SETTOPINDEX, MPFROMSHORT (index), \
  242.            NULL))
  243.  
  244. #define WinFindLboxItem(hwndLbox, psz) \
  245.     ((USHORT)WinSendMsg((hwndLbox), LM_SEARCHSTRING, \
  246.              MPFROM2SHORT (0, LIT_FIRST), (MPARAM) psz))
  247.  
  248. #define WinSelectLboxItem(hwndLbox, index, fSelect) \
  249.     ((USHORT)WinSendMsg((hwndLbox), LM_SELECTITEM, \
  250.              (MPARAM) (index), (MPARAM) (fSelect)))
  251.  
  252. #define ParentOf(hwnd)              WinQueryWindow ((hwnd), QW_PARENT)
  253. #define OwnerOf(hwnd)               WinQueryWindow ((hwnd), QW_OWNER)
  254.  
  255. #define SendOwner(hwnd,msg,mp2,id)  \
  256.            (WinSendMsg (OwnerOf (hwnd), WM_CONTROL, \
  257.                         MPFROM2SHORT (id,msg), mp2))
  258. /***************************  End of dragdrop.h  *************************/
  259.