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

  1. /*static char *SCCSID = "@(#)sort.h    6.15 92/02/27";*/
  2. /*==============================================================*\
  3.  *                                                              *
  4.  *  SORT.H - Sample PM application sort header file             *
  5.  *     (C) Copyright IBM Corporation 1992.                      *
  6.  *                                                              *
  7.  *--------------------------------------------------------------*
  8.  *                                                              *
  9.  *  This header file contains the application wide constants    *
  10.  *  and structure definitions.                                  *
  11.  *                                                              *
  12. \*==============================================================*/
  13.  
  14. /*--------------------------------------------------------------*\
  15.  * Resource IDs                                                 *
  16. \*--------------------------------------------------------------*/
  17. #define ID_NULL                               -1
  18. #define ID_RESOURCE                            1
  19. #define IDR_BITMAP                             2
  20. #define IDC_BITMAP                             3
  21.  
  22. /*--------------------------------------------------------------*\
  23.  *  Menu item IDs                                               *
  24. \*--------------------------------------------------------------*/
  25. #define IDM_START                              5
  26. #define IDM_STOP                               6
  27. #define IDM_SET                                7
  28. #define IDM_RANDOM                             8
  29. #define IDM_DONE        (WM_USER+0) /* Message posted when thread terminates */
  30.  
  31. #define IDM_GENERALHELP                     9100
  32. #define IDM_USINGHELP                       9200
  33. #define IDM_TUTORIAL                        9300
  34. #define IDM_HELPINDEX                       9400
  35. #define IDM_HELPPRODUCTINFO                 9500
  36.  
  37. /*--------------------------------------------------------------*\
  38.  *  Help table and subtables                                    *
  39. \*--------------------------------------------------------------*/
  40. #define SORT_HELP_TABLE                     1000
  41.  
  42. /*--------------------------------------------------------------*\
  43.  *  Main window help panels                                     *
  44. \*--------------------------------------------------------------*/
  45. #define SUBTABLE_MAIN                       2000
  46. #define PANEL_MAIN                          2100
  47. #define PANEL_HELP                          2910
  48. #define PANEL_GENERALHELP                   2920
  49. #define PANEL_USINGHELP                     2930
  50. #define PANEL_TUTORIAL                      2940
  51. #define PANEL_HELPINDEX                     2950
  52. #define PANEL_HELPPRODUCTINFO               2960
  53. #define PANEL_KEYSHELP                      2970
  54.  
  55. #define PANEL_HELPSTART                     2980
  56. #define PANEL_HELPSTOP                      2981
  57. #define PANEL_HELPSET                       2982
  58. #define PANEL_HELPRANDOM                    2983
  59.  
  60. /*--------------------------------------------------------------*\
  61.  *  Enter text dialog help subtable                             *
  62. \*--------------------------------------------------------------*/
  63. #define SUBTABLE_PRODUCTINFODLG             3000
  64. #define PANEL_PRODUCTINFODLG                3100
  65. #define PANEL_PRODUCTINFO_OK                3110
  66.  
  67. /*--------------------------------------------------------------*\
  68.  *  Message item IDs                                            *
  69. \*--------------------------------------------------------------*/
  70. #define IDD_SETCOUNT                          10
  71. #define IDD_ENTRYFLD                          11
  72. #define IDD_PRODUCTINFO                       12
  73. #define IDD_MSGBOX                            13
  74.  
  75. /*--------------------------------------------------------------*\
  76.  *  Stringtable ids
  77. \*--------------------------------------------------------------*/
  78. #define IDS_TITLE                            101
  79. #define IDS_UNTITLED                         102
  80. #define IDS_APPNAME                          103
  81. #define IDS_HELPLIBRARYNAME                  104
  82. #define IDS_HELPWINDOWTITLE                  105
  83.  
  84. /*--------------------------------------------------------------*\
  85.  *  Messagetable ids                                            *
  86. \*--------------------------------------------------------------*/
  87. #define IDMSG_INITFAILED                     301
  88. #define IDMSG_MAINWINCREATEFAILED            302
  89. #define IDMSG_CANNOTLOADEXITLIST             304
  90. #define IDMSG_CANNOTLOADSTRING               305
  91. #define IDMSG_HELPLOADERROR                  306
  92. #define IDMSG_HELPDISPLAYERROR               307
  93. #define IDMSG_ERRORSIZE                      308
  94.  
  95. /*--------------------------------------------------------------*\
  96.  *  Stringtable ids                                             *
  97. \*--------------------------------------------------------------*/
  98. #define IDS_HELPLIBRARYNAME                  104
  99. #define IDS_HELPWINDOWTITLE                  105
  100.  
  101. /* This structure is passed into various routines and contains various
  102.    information, often depending on who is passing the information.
  103.    hwnd holds the main window handle for routines that need to draw.
  104.    fContinueCalc is used by routines that have the ability to abort
  105.          when the calling routine sets this flag to FALSE.
  106.    usID is set to the offset number of a thread and is used to pass
  107.          a message back to the window proc when the thread terminates.
  108.    (*pFunc)() passes the function to be called to the generic thread
  109.          starting routine CalcThread.
  110.    Array points to the beginning of the data set to be used by the
  111.          various sorts.  This pointer is used in the Display thread
  112.          to point to the variable that is dynamically modified to
  113.          contain the current height of the client window.
  114.    cArray is the number of elements in Array.  It serves no purpose in
  115.          the Display thread.
  116.    pcSetSize is used only by the Display thread to point to a dynamically
  117.          modified variable which contains the user-modifiable data
  118.          set size.                                                    */
  119.  
  120. typedef struct _CalcParam
  121. {
  122.    HWND   hwnd;
  123.    BOOL   fContinueCalc;
  124.    BYTE   *pcThreadCnt;
  125.    USHORT usID;
  126.    VOID   (*pFunc)(struct _CalcParam *);
  127.    USHORT *Array;
  128.    USHORT cArray;
  129.    USHORT *pcSetSize;
  130. } CALCPARAM;
  131. typedef CALCPARAM FAR *PCALCPARAM;
  132.  
  133. #define STACKSIZE        16384    /* Arbitrary size for a stack     */
  134. #define LISTCNT              4    /* Number of data sets            */
  135.  
  136.  
  137. #define MAX_ELEMS       1024
  138. #define NELEMS          (rcl.xRight * rcl.yTop)/* Number of items in a data set  */
  139.  
  140.  
  141. #define XOFFSET             10    /* Pixel offset for axis in X dir */
  142. #define YOFFSET             40    /* Pixel offset for axis in Y dir */
  143.  
  144. #define COLUMNOFFSET       125    /* Column offset for sort names   */
  145. #define ROWOFFSET           18    /* Row offset for sort names      */
  146. #define COLUMNCNT            4    /* Max # of text columns          */
  147. #define ROWCNT               2    /* Max # of text rows             */
  148. #define HELPLIBRARYNAMELEN  20    /* The length of library name     */
  149. #define MESSAGELEN          50      /* maximum length for messages  */
  150. #define RETURN_ERROR         1      /* Error return from procedure  */
  151. #define RETURN_SUCCESS       0      /* Error return from procedure  */
  152.  
  153. /*--------------------------------------------------------------*\
  154.  *  Macro constants
  155. \*--------------------------------------------------------------*/
  156. /* Macro for drawing a rectangle.  Assumes hps and ptl structs are defined
  157.    in the calling module. */
  158.  
  159. #define DrawRect(x1,y1,x2,y2,color)  ptl.x = (LONG) (x1);             \
  160.                                      ptl.y = (LONG) (y1);             \
  161.                                      GpiSetCurrentPosition(hps,&ptl); \
  162.                                      ptl.x = (LONG) (x2);             \
  163.                                      ptl.y = (LONG) (y2);             \
  164.                                      GpiSetColor(hps,color);          \
  165.                                      GpiBox(hps,DRO_FILL,&ptl,0L,0L);
  166.  
  167. /* Macro for drawing a line.  Assumes hps and ptl structs are defined
  168.    in the calling module. */
  169.  
  170. #define DrawLine(x1,y1,x2,y2,color)  ptl.x = (LONG) (x1);             \
  171.                                      ptl.y = (LONG) (y1);             \
  172.                                      GpiSetCurrentPosition(hps,&ptl); \
  173.                                      ptl.x = (LONG) (x2);             \
  174.                                      ptl.y = (LONG) (y2);             \
  175.                                      GpiSetColor(hps,color);          \
  176.                                      GpiLine(hps,&ptl);
  177.  
  178. /* Macro for drawing a point.  Assumes hps and ptl structs are defined
  179.    in the calling module. */
  180.  
  181. #define Draw2Pel(x1,y1,color)        ptl.x = (LONG) (x1);             \
  182.                                      ptl.y = (LONG) (y1);             \
  183.                                      GpiSetColor(hps,color);          \
  184.                                      GpiSetPel(hps,&ptl);             \
  185.                                      ptl.y++;                         \
  186.                                      GpiSetPel(hps,&ptl);
  187.