home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CNRMNU.ZIP / CNRMENU.H < prev    next >
Text File  |  1993-01-01  |  9KB  |  204 lines

  1. /*********************************************************************
  2.  *                                                                   *
  3.  * MODULE NAME :  cnrmenu.h              AUTHOR:  Rick Fishman       *
  4.  * DATE WRITTEN:  10-24-92                                           *
  5.  *                                                                   *
  6.  * DESCRIPTION:                                                      *
  7.  *                                                                   *
  8.  *  Common definitions and function prototypes for CNRMENU.EXE       *
  9.  *                                                                   *
  10.  * HISTORY:                                                          *
  11.  *                                                                   *
  12.  *  10-24-92 - File copied from CNRBASE.EXE sample.                  *
  13.  *             Added ctxtmenu.c definitions, function prototypes.    *
  14.  *             Changed CreateDirectoryWin proto - added 2 parms.     *
  15.  *             Changed CreateContainer proto - added 2 parms.        *
  16.  *             Added pciSelected to INSTANCE struct.                 *
  17.  *             Added WINCREATE struct.                               *
  18.  *             Added 2 variables to THREADPARMS struct.              *
  19.  *             Added edit.c definitions, function prototypes.        *
  20.  *             Added new submenus, menu items.                       *
  21.  *             Added iDirPosition to CNRITEM struct.                 *
  22.  *             Added OWNER macro.                                    *
  23.  *             Added CRA_SOURCE definition.                          *
  24.  *             Added fDirSelected to INSTANCE struct.                *
  25.  *             Added fSelected to CNRITEM struct.                    *
  26.  *             Added sort.c definitions, function prototypes.        *
  27.  *             Added hwndFrame array to INSTANCE struct.             *
  28.  *             Added FullyQualify to common.c function prototypes.   *
  29.  *             Added achWorkBuf to INSTANCE data structure.          *
  30.  *  01-01-93   Took out pszFileName and hptrIcon from CNRITEM -      *
  31.  *               will use the fields in the MINIRECORDCORE struct.   *
  32.  *             Added fTrue to satisfy new C Set/2++ compiler in      *
  33.  *               while( fTrue ) statements. The new compiler does    *
  34.  *               not allow while( TRUE ) or for( ; ; ) statements.   *
  35.  *                                                                   *
  36.  *  Rick Fishman                                                     *
  37.  *  Code Blazers, Inc.                                               *
  38.  *  4113 Apricot                                                     *
  39.  *  Irvine, CA. 92720                                                *
  40.  *  CIS ID: 72251,750                                                *
  41.  *                                                                   *
  42.  *********************************************************************/
  43.  
  44. /*********************************************************************/
  45. /*------------------- APPLICATION DEFINITIONS -----------------------*/
  46. /*********************************************************************/
  47.  
  48. #define ID_FIRST_DIRWINDOW   1         // Id of first Directory frame window
  49.  
  50. #define ID_RESOURCES         1         // Id of frame wnd resources in .RC file
  51.  
  52. #define CNR_DIRECTORY        30        // The start of our show
  53.  
  54. #define ID_CONTEXT_MENU      1000      // Id of the context menu
  55. #define IDM_VIEW_SUBMENU     1100      // View Submenu id
  56. #define IDM_VIEW_ICON        1101      // View Submenu item ids
  57. #define IDM_VIEW_NAME        1102
  58. #define IDM_VIEW_TREE        1103
  59. #define IDM_VIEW_DETAILS     1104
  60. #define IDM_VIEW_TEXT        1105
  61. #define IDM_SORT_SUBMENU     1200      // Sort Submenu id
  62. #define IDM_SORT_NAME        1201      // Sort Submenu item ids
  63. #define IDM_SORT_DATETIME    1202
  64. #define IDM_SORT_DIRORDER    1203
  65. #define IDM_OTHERWIN_SUBMENU 1300      // "Other Window" Submenu
  66. #define IDM_OTHERWIN_ITEM1   1301      // ID of first "Other Window" menu item
  67. #define IDM_OTHERWIN_LASTITEM 1399     // ID of last "Other Window" menu item
  68. #define IDM_CREATE_NEWWIN    1400      // CreateNewWindow menu item
  69. #define IDM_ARRANGE          1500      // Arrange menu item
  70.  
  71. #define UM_CONTAINER_FILLED  WM_USER   // Posted by Fill thread to primary thrd
  72.  
  73. #define DEBUG_FILENAME       "cnrmenu.dbg"
  74.  
  75. #define DIRECTORY_WINCLASS   "CnrMenuSample"
  76.  
  77. #define PROGRAM_TITLE        "CNRMENU"
  78.  
  79. #define HABERR( hab )        (ERRORIDERROR( WinGetLastError( hab ) ))
  80.  
  81. #define ANCHOR( hwnd )       (WinQueryAnchorBlock( hwnd ))
  82.  
  83. #define HWNDERR( hwnd )       \
  84.             (ERRORIDERROR( WinGetLastError( WinQueryAnchorBlock( hwnd ) ) ))
  85.  
  86. #define INSTDATA( hwnd )      (WinQueryWindowPtr( hwnd, 0 ))
  87.  
  88. #define PARENT( hwnd )        (WinQueryWindow( hwnd, QW_PARENT ))
  89.  
  90. #define OWNER( hwnd )         (WinQueryWindow( hwnd, QW_OWNER ))
  91.  
  92. #define GRANDPARENT( hwnd )   (WinQueryWindow( WinQueryWindow(hwnd, QW_PARENT)))
  93.  
  94. #ifndef CRA_SOURCE            // As of 10/30/92, CRA_SOURCE not in toolkit hdrs
  95. #  define CRA_SOURCE          0x00004000L
  96. #endif
  97.  
  98. /**********************************************************************/
  99. /*---------------------------- STRUCTURES ----------------------------*/
  100. /**********************************************************************/
  101.  
  102. typedef struct _CNRITEM               // CONTAINER RECORD STRUCTURE
  103. {
  104.   MINIRECORDCORE rc;                  // Base information
  105.   CDATE          date;                // Date of file
  106.   CTIME          time;                // Time of file
  107.   ULONG          cbFile;              // File size
  108.   ULONG          attrFile;            // Attributes of this file
  109.   INT            iDirPosition;        // Relative position in directory
  110.   BOOL           fSelected;           // Does this record have source emphasis
  111.   CHAR           szFileName[CCHMAXPATH + 1]; // File name
  112.  
  113. } CNRITEM, *PCNRITEM;
  114.  
  115. #define EXTRA_RECORD_BYTES (sizeof( CNRITEM ) - sizeof( MINIRECORDCORE ))
  116.  
  117.  
  118. typedef struct _INSTANCE              // CONTAINER'S CLIENT WINDOW INSTANCE DATA
  119. {
  120.     BOOL fShutdown;                     // Main thread wants to shut down
  121.     BOOL fContainerFilled;              // Fill thread has completed
  122.     PCNRITEM pciSelected;               // Item selected under context menu
  123.     BOOL fDirSelected;                  // One of the selected recs is a dir
  124.  
  125.     // Used to keep track of frame windows associated with OtherWindow menuitems
  126.     HWND hwndFrame[ IDM_OTHERWIN_LASTITEM - IDM_OTHERWIN_ITEM1 + 1 ];
  127.  
  128.     CHAR szCnrTitle[ CCHMAXPATH + 20 ]; // Container title
  129.     CHAR szDirectory[ CCHMAXPATH + 1 ]; // Directory being displayed
  130.     CHAR achWorkBuf[ CCHMAXPATH + 1 ];  // Instance work buffer
  131.  
  132. } INSTANCE, *PINSTANCE;
  133.  
  134.  
  135. typedef struct _THREADPARMS          // PARAMETERS TO PASS TO SECONDARY THREAD
  136. {
  137.     HWND hwndClient;                 // Client window handle
  138.     HWND hwndCnrShare;               // Container hwnd whose recs will be shared
  139.     PCNRITEM pciParent;              // Ptr to parent CNRITEM if using shr recs
  140.  
  141. } THREADPARMS, *PTHREADPARMS;
  142.  
  143.  
  144. typedef struct _WINCREATE            // PARAMETERS TO PASS TO WINDOW ON CREATION
  145. {
  146.     PSZ szDirectory;                 // Pointer to directory name
  147.     HWND hwndCnrShare;               // Container hwnd whose recs will be shared
  148.     PCNRITEM pciParent;              // Ptr to parent CNRITEM if using shr recs
  149.  
  150. } WINCREATE, *PWINCREATE;
  151.  
  152. /**********************************************************************/
  153. /*----------------------- FUNCTION PROTOTYPES ------------------------*/
  154. /**********************************************************************/
  155.  
  156. // In common.c
  157.  
  158. VOID SetWindowTitle( HWND hwndClient, PSZ szFormat, ... );
  159. VOID Msg( PSZ szFormat, ... );
  160. VOID FullyQualify( PSZ szDirectory, HWND hwndCnr, PCNRITEM pci );
  161.  
  162. // In create.c
  163.  
  164. HWND CreateDirectoryWin( PSZ szDirectory, HWND hwndCnr, PCNRITEM pciFirst );
  165. HWND CreateContainer( HWND hwndClient, PSZ szDirectory, HWND hwndCnrShare,
  166.                       PCNRITEM pciFirst );
  167.  
  168. // In populate.c
  169.  
  170. VOID PopulateContainer( PVOID pThreadParms );
  171.  
  172. // In ctxtmenu.c
  173.  
  174. VOID CtxtmenuCreate( HWND hwndClient, PCNRITEM pciSelected );
  175. VOID CtxtmenuCommand( HWND hwndClient, ULONG idCommand, ULONG ulCmdSrc );
  176. VOID CtxtmenuSetView( HWND hwndClient, ULONG ulViewType );
  177. VOID CtxtmenuEnd( HWND hwndClient );
  178.  
  179. // In edit.c
  180.  
  181. VOID EditBegin( HWND hwndClient, PCNREDITDATA pced );
  182. VOID EditEnd( HWND hwndClient, PCNREDITDATA pced );
  183.  
  184. // In sort.c
  185.  
  186. VOID SortContainer( HWND hwndClient, ULONG ulSortType );
  187.  
  188. /**********************************************************************/
  189. /*------------------------ GLOBAL VARIABLES --------------------------*/
  190. /**********************************************************************/
  191.  
  192. #ifdef GLOBALS_DEFINED
  193. #  define DATADEF
  194. #else
  195. #  define DATADEF extern
  196. #endif
  197.  
  198. DATADEF INT iWinCount;           // Number of directory windows created
  199. DATADEF BOOL fTrue;              // Used for while( fTrue ) to satisfy CSet2++
  200.  
  201. /***********************************************************************
  202.  *                   E N D     O F     S O U R C E                     *
  203.  **********************************************************************/
  204.