home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / WPPRG15.ZIP / WPPRGEXT.CSC < prev    next >
Text File  |  1993-12-17  |  9KB  |  305 lines

  1.  
  2. /******************************************************************************
  3. *
  4. *  Module Name : WPPRGEXT
  5. *
  6. *  Description : OS/2 Workplace Shell WPProgram Object Extension.
  7. *                This extension adds the option to close the folder
  8. *                to which the launching program belongs.
  9. *
  10. *  Programmer  : Yong D. Lee
  11. *  Date        : Nov 21, 1993
  12. *
  13. *  Disclaimer of warranties:
  14. *      The code is provided "AS IS", without warranty of any kind.  I shall 
  15. *      not be liable for any damages arising out of your use of this code.
  16. *
  17. ******************************************************************************/
  18.  
  19. #******************************************************************************
  20. #   Include the class definition file for the parent class
  21. #******************************************************************************
  22.  
  23. include <wppgm.sc>
  24.  
  25. #******************************************************************************
  26. #   Define the new class
  27. #******************************************************************************
  28.  
  29. class: WPPrgExt,
  30.        external stem   = wpprgext,
  31.        local,
  32.        external prefix = wpprgext_,
  33.        classprefix     = wpprgextM_,
  34.        major version   = 1,
  35.        minor version   = 5;
  36.  
  37. --
  38. -- CLASS: WPPrgExt
  39. --
  40. -- DESCRIPTION:
  41. --
  42. --    This is a descendent object class for WPProgram object class. It can be
  43. --    replaced for WPProgram object class.
  44. --
  45.  
  46. #******************************************************************************
  47. #   Specify the parent class
  48. #******************************************************************************
  49.  
  50. parent: WPProgram;
  51.  
  52. #******************************************************************************
  53. #   Specify the release order of new methods.  
  54. #******************************************************************************
  55.  
  56. release order:
  57.               QueryFolderClose,
  58.               SetFolderClose,
  59.               AddFolderPage,
  60.               clsQueryModuleHandle;
  61.  
  62. #******************************************************************************
  63. #   Passthru PRIVATE definitions to the .ph file
  64. #******************************************************************************
  65.  
  66. passthru: C.ph;
  67.  
  68.    /*
  69.     *   Window data for the Folder dialog (settings page)
  70.     */
  71.    typedef struct _FOLDER
  72.    {
  73.       USHORT   cb;            /* size of this structure                   */
  74.       WPPrgExt *somSelf;      /* pointer to this instance                 */
  75.       ULONG    closeFolder;   /* indicates whether to close folder or not */
  76.    } FOLDER;
  77.  
  78.    typedef FOLDER *PFOLDER;
  79.  
  80. endpassthru;   /* C.ph */
  81.  
  82. #******************************************************************************
  83. #   Passthru IMPLEMENTATION definitions to the .ih file
  84. #******************************************************************************
  85.  
  86. passthru: C.ih;
  87.  
  88.    #define INCL_WIN
  89.    #define INCL_DOS
  90.    #define INCL_GPIBITMAPS
  91.    #include <os2.h>
  92.  
  93.    #define INCL_WPFOLDER
  94.    #define INCL_WINWORKPLACE
  95.    #define WPCLASS
  96.  
  97.    #include <pmwp.h>
  98.  
  99.    #define ID_TITLE 100
  100.  
  101. /*
  102.  * IDs of dialog items in WPPRGEXT.RC
  103.  */
  104.    #define IDD_FOLDER                  200
  105.    #define IDGROUP_FOLDERCLOSE         201
  106.    #define IDCHECK_CLOSENOTEBOOK       202
  107.    #define IDCHECK_CLOSEPROGRAM        203
  108.  
  109. /*
  110.  * IDs for folderClose
  111.  */
  112.    #define DONOTCLOSE           0x00
  113.    #define CLOSENOTEBOOK        0x01
  114.    #define CLOSEPROGRAM         0x02
  115.  
  116. /*
  117.  * Key for save-restore method
  118.  */
  119.     #define IDKEY_FOLDER 1
  120.  
  121. endpassthru;   /* .ih */
  122.  
  123. #******************************************************************************
  124. #   Passthru PUBLIC definitions to the .h file
  125. #******************************************************************************
  126.  
  127. passthru: C.h, after;
  128.  
  129.  
  130. endpassthru;   /* C.h */
  131.  
  132. #******************************************************************************
  133. #   Define instance data
  134. #******************************************************************************
  135.  
  136. data:
  137.  
  138.    ULONG folderClose;                     /* indicates if to close folder */
  139.  
  140. #******************************************************************************
  141. #   Define methods
  142. #******************************************************************************
  143.  
  144. methods:
  145.  
  146. ULONG QueryFolderClose();
  147. --
  148. -- METHOD: QueryFolderClose                               ( ) PRIVATE
  149. --                                                        (X) PUBLIC
  150. -- DESCRIPTION:
  151. --
  152. --   Query state of folder close flag
  153. --
  154. -- RETURN:
  155. --
  156. --   ULONG - folder closing option
  157. --
  158.  
  159. VOID SetFolderClose(ULONG flag);
  160. --
  161. -- METHOD: SetFolderClose                                 ( ) PRIVATE
  162. --                                                        (X) PUBLIC
  163. -- DESCRIPTION:
  164. --
  165. --   Set state of folder close flag
  166. --
  167. --
  168.  
  169. ULONG AddFolderPage(HWND hwndNotebook);
  170. --
  171. -- METHOD: AddFolderPage                                  ( ) PRIVATE
  172. --                                                        (X) PUBLIC
  173. -- DESCRIPTION:
  174. --
  175. --   Add the folder page to the settings notebook
  176. --
  177. -- RETURN:
  178. --
  179. --   0              Unsuccessful
  180. --   ulPageId       Identifier for the inserted page
  181. --
  182.  
  183. #******************************************************************************
  184. #   Specify methods being overridden
  185. #******************************************************************************
  186.  
  187. -----------------------------------------------------------------------------
  188. --   Methods from the WPObject class
  189. -----------------------------------------------------------------------------
  190.  
  191. override wpInitData;
  192. --
  193. -- OVERRIDE: wpInitData                                   ( ) PRIVATE
  194. --                                                        (X) PUBLIC
  195. -- DESCRIPTION:
  196. --
  197. --   Initialize the state variables and allocate any extra memory
  198. --   that might be needed
  199. --
  200.  
  201. override wpUnInitData;
  202. --
  203. -- OVERRIDE: wpUnInitData                                 ( ) PRIVATE
  204. --                                                        (X) PUBLIC
  205. -- DESCRIPTION:
  206. --
  207. --   Clear up memory that was allocated on wpInitData
  208. --
  209.  
  210. override wpSaveState;
  211. --
  212. -- OVERRIDE: wpSaveState                                  ( ) PRIVATE
  213. --                                                        (X) PUBLIC
  214. -- DESCRIPTION:
  215. --
  216. --   Save state variable (folder close flag)
  217. --
  218.  
  219. override wpRestoreState;
  220. --
  221. -- OVERRIDE: wpRestoreState                               ( ) PRIVATE
  222. --                                                        (X) PUBLIC
  223. -- DESCRIPTION:
  224. --
  225. --   Restore saved state variable
  226. --
  227.  
  228. override wpAddSettingsPages;
  229. --
  230. -- OVERRIDE: wpAddSettingsPages                           ( ) PRIVATE
  231. --                                                        (X) PUBLIC
  232. -- DESCRIPTION:
  233. --
  234. --   Add folder settings page to let the user alter the flag
  235. --
  236.  
  237. override wpOpen;
  238. --
  239. --  METHOD: wpOpen                                        ( ) PRIVATE
  240. --                                                        (X) PUBLIC
  241. --  DESCRIPTION:
  242. --
  243. --    Opens the program object window. Close folder upon openning 
  244. --    according to folderClose flag
  245. --
  246.  
  247. override wpSetup;
  248. --
  249. -- OVERRIDE: wpSetup                                      ( ) PRIVATE
  250. --                                                        (X) PUBLIC
  251. -- DESCRIPTION:
  252. --
  253. --   Specift setup strings and do some initialization
  254. --
  255.  
  256. #******************************************************************************
  257. #   Define class methods
  258. #******************************************************************************
  259.  
  260. HMODULE clsQueryModuleHandle (), class;
  261. --
  262. -- METHOD: clsQueryModuleHandle                           ( ) PRIVATE
  263. --                                                        (X) PUBLIC
  264. -- DESCRIPTION:
  265. --
  266. --   This method returns the module handle of this class.
  267. --
  268. -- RETURN:
  269. --
  270. --   0          Unsuccessful
  271. --   non-zero   Module handle
  272. --
  273.  
  274. #******************************************************************************
  275. #   Specify class methods being overridden
  276. #******************************************************************************
  277.  
  278. override wpclsInitData, class;
  279. --
  280. -- METHOD: wpclsInitData                                  ( ) PRIVATE
  281. --                                                        (X) PUBLIC
  282. -- DESCRIPTION:
  283. --
  284. --   Initialize the class data
  285. --
  286.  
  287. override wpclsUnInitData, class;
  288. --
  289. -- METHOD: wpclsUnInitData                                ( ) PRIVATE
  290. --                                                        (X) PUBLIC
  291. -- DESCRIPTION:
  292. --
  293. --   Free any class data
  294. --
  295.  
  296. override wpclsQueryTitle, class;
  297. --
  298. -- METHOD: wpclsQueryTitle                                ( ) PRIVATE
  299. --                                                        (X) PUBLIC
  300. -- DESCRIPTION:
  301. --
  302. --   Return the string "Extended Program".
  303. --
  304.  
  305.