home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / SAMPLES / WPS / WSFILE / WSFILE.IDL < prev    next >
Text File  |  1995-08-24  |  18KB  |  608 lines

  1.  
  2. //# This file was generated by the SOM Compiler.
  3. //# FileName: wsfile.id2.
  4. //# Generated using:
  5. //#     SOM Precompiler somopc: 2.29.1.2
  6. //#     SOM Emitter emitidl: 2.41
  7.  
  8. //
  9. //
  10. //   Module Name: WSFILE
  11. //
  12. //   OS/2 Work Place Shell Sample Program
  13. //
  14. //   Copyright (C) 1994 IBM Corporation
  15. //
  16. //       DISCLAIMER OF WARRANTIES.  The following 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. #ifndef wsfile_idl
  27. #define wsfile_idl
  28.  
  29. #include "wpdataf.idl"
  30. #include <somcls.idl>
  31.  
  32. interface M_WSFILE;
  33.  
  34. interface WSFILE : WPDataFile
  35. //# Comment for parent WPDataFile:
  36.  
  37. //---Symbol parentComment is undefined---
  38.  
  39. //
  40. // CLASS: WSFILE
  41. //
  42. // CLASS HIERARCHY:
  43. //
  44. //     SOMObject
  45. //       └── WPObject
  46. //             └── WPFileSystem
  47. //                   └── WPDataFile
  48. //                         └──  WSFILE
  49. //
  50. // DESCRIPTION:
  51. //
  52. //    This is the sample WSFILE object class.
  53. //
  54. //    An instance of this class can be created as a Workplace object.
  55. //
  56.  
  57. {
  58.   PSZ queryLastWorker();
  59.  
  60.   //
  61.   // METHOD: queryLastWorker                                ( ) PRIVATE
  62.   //                                                        (X) PUBLIC
  63.   // DESCRIPTION:
  64.   //
  65.   //   Query name of last person to work with wsfile
  66.   //
  67.   // RETURN:
  68.   //
  69.   //   PSZ            name of last person to work on file
  70.   //
  71.  
  72.   BOOL setLastWorker(in PSZ pszWorkerName);
  73.  
  74.   //
  75.   // METHOD: setLastWorker                                  ( ) PRIVATE
  76.   //                                                        (X) PUBLIC
  77.   // DESCRIPTION:
  78.   //
  79.   //   Set name of last person to work with wsfile
  80.   //
  81.   // RETURN:
  82.   //
  83.   //   TRUE           Brake is on
  84.   //   FALSE          Brake is off
  85.   //
  86.  
  87.   BOOL soundAlarm();
  88.  
  89.   //
  90.   // METHOD: soundAlarm                                     ( ) PRIVATE
  91.   //                                                        (X) PUBLIC
  92.   // DESCRIPTION:
  93.   //
  94.   //   Sound an alarm
  95.   //
  96.   // RETURN:
  97.   //
  98.   //   TRUE           Successful
  99.   //   FALSE          Unsuccessful
  100.   //
  101.  
  102.   ULONG AddLastWorkerPage(in HWND hwndNotebook);
  103.  
  104.   //
  105.   // METHOD: AddLastWorkerPage                              ( ) PRIVATE
  106.   //                                                        (X) PUBLIC
  107.   // DESCRIPTION:
  108.   //
  109.   //   This method adds the Last Worker page to the settings notebook.
  110.   //
  111.   // RETURN:
  112.   //
  113.   //   0              Unsuccessful
  114.   //   ulPageId       Identifier for the inserted page
  115.   //
  116.   // HOW TO OVERRIDE:
  117.   //
  118.   //   Method should always be overridden in order to replace or remove
  119.   //   the last worker page from an object which is a descendent of wsfile.
  120.   //   In most cases, an override of this method will not call the parent.
  121.   //
  122.  
  123.  
  124.  
  125. #ifdef __SOMIDL__
  126.   implementation {
  127.  
  128.     releaseorder: queryLastWorker,setLastWorker,soundAlarm,AddLastWorkerPage;
  129.  
  130.     //# Class Modifiers
  131.     externalstem = wsfile;
  132.     local;
  133.     externalprefix = wsf_;
  134.     majorversion = 1;
  135.     minorversion = 2;
  136.     filestem = wsfile;
  137.     metaclass = M_WSFILE;
  138.     callstyle = oidl;
  139.  
  140. /* CSC2IDL:  CHANGED ph passthru to a private h passthru */
  141.  
  142.     passthru C_h_after =  ""
  143. #ifdef __PRIVATE__
  144. "   /*"
  145. "    *   The following structures will be used to store window specific data"
  146. "    *   and a pointer to the object that created the window/dialog."
  147. "    *"
  148. "    *   They're allocated when the Client window is created.  This"
  149. "    *   allows us to pass the *somSelf pointer and use it in our"
  150. "    *   window and dialog procedures (the system only passes this"
  151. "    *   pointer to methods)."
  152. "    */"
  153. ""
  154. "   typedef struct _WINDOWDATA"
  155. "   {"
  156. "      USHORT   cb;            /* size of this structure */"
  157. "      WSFILE  *somSelf;       /* pointer to this instance */"
  158. "      USEITEM  UseItem;       /* global class usage information */"
  159. "      VIEWITEM ViewItem;      /* global class view information */"
  160. "   } WINDOWDATA;"
  161. "   typedef WINDOWDATA *PWINDOWDATA;"
  162. ""
  163. "   /*"
  164. "    *   Window data for the Worker dialog (settings page)"
  165. "    */"
  166. "   typedef struct _LASTWORKERDLGDATA"
  167. "   {"
  168. "      USHORT   cb;            /* size of this structure */"
  169. "      WSFILE  *somSelf;     /* pointer to this instance    */"
  170. "      PSZ     PrevWorker;     /* indicates name of person to last work */"
  171. "                              /*  with this file */"
  172. "      PSZ     restorePrevWorker; /* used for UNDO */"
  173. "   } LASTWORKERDLGDATA;"
  174. "   typedef LASTWORKERDLGDATA *PLASTWORKERDLGDATA;"
  175. ""
  176. "   /*"
  177. "    *   Private Debug helpers go here.  They can be enabled/disabled by"
  178. "    *   defining DEBUG as a compiler directive."
  179. "    */"
  180. "   #if defined(DEBUG)"
  181. ""
  182. "      #define DebugBox(title, text) \ "
  183. "                                    \ "
  184. "                 WinMessageBox(     \ "
  185. "                    HWND_DESKTOP,   \ "
  186. "                    HWND_DESKTOP,   \ "
  187. "                    (PSZ) text,     \ "
  188. "                    (PSZ) title,    \ "
  189. "                    20,             \ "
  190. "                    MB_OK | MB_INFORMATION | MB_MOVEABLE)"
  191. "   #else"
  192. "      #define DebugBox(title, text)   /* do nothing if not debugging */"
  193. "   #endif"
  194. #endif /* __PRIVATE__ */
  195. "";
  196.     passthru C_ih =  ""
  197. "   #define INCL_WIN"
  198. "   #define INCL_DOS"
  199. "   #define INCL_GPIBITMAPS"
  200. "   #define INCL_DOSERRORS"
  201. "   #include <os2.h>"
  202. ""
  203. "   #define INCL_WPCLASS"
  204. "   #define INCL_WPFOLDER"
  205. ""
  206. "   #include <pmwp.h>"
  207. ""
  208. "   #define ID_TITLE           100"
  209. "   #define ID_ICON            101"
  210. ""
  211. "   #define IDD_LASTWORKER     200                  /* settings page (dialog) */"
  212. "   #define IDC_LASTWORKER     300"
  213. ""
  214. ""
  215. "   /*"
  216. "    *   The following user-defined Popup menu items (ID_xxx) should be higher"
  217. "    *   than WPMENUID_USER."
  218. "    *"
  219. "    *   The ID_OPENMENU will become a submenu of the system's popup open menu"
  220. "    *   id, WPMENUID_OPEN."
  221. "    */"
  222. "   #define ID_ALARMMENU       (WPMENUID_USER+1) /* menus added to popup menu */"
  223. "   #define ID_OPENMENU        (WPMENUID_USER+2)"
  224. ""
  225. "   #define IDM_OPENWSFILE        (WPMENUID_USER+3) /* submenus of added menus */"
  226. "   #define IDM_SOUNDALARM        (WPMENUID_USER+4)"
  227. ""
  228. "   #define ID_FRAME           3000                       /* frame window id */"
  229. "   #define ID_CLIENT          3001                       /* client window id */"
  230. ""
  231. "   /*"
  232. "    *   Set unique view ids, in order for the default view checkmark"
  233. "    *   to be set correctly, on the Open submenu, this OPEN view id must"
  234. "    *   be the same value as the corresponding menu id."
  235. "    */"
  236. "   #define OPEN_WSFILE           IDM_OPENWSFILE"
  237. ""
  238. "   /*"
  239. "    *   IDs of dialog items in WSFILE.RC"
  240. "    */"
  241. "   #define ID_UNDO            801"
  242. "   #define ID_DEFAULT         802"
  243. "   #define ID_HELP            803"
  244. ""
  245. "   /*"
  246. "    *  Keys for save-restore methods"
  247. "    */"
  248. "   #define IDKEY_LASTWORKER   1"
  249. ""
  250. "   /*"
  251. "    *   Default values of instance data items"
  252. "    */"
  253. "   #define DEFAULT_LASTWORKER \"Anonymous\""
  254. ""
  255. "   /*"
  256. "    *   Help IDs"
  257. "    *"
  258. "    *   NOTE:  See wsfile.ipf for the source of this class's help,"
  259. "    *   from which wsfile.hlp is built"
  260. "    */"
  261. "   #define ID_HELP_DEFAULT    256"
  262. "   #define ID_HELP_OPENWSFILE 257"
  263. "   #define ID_HELP_LASTWORKER 258"
  264. "   #define ID_HELP_SOUNDALARM 259"
  265. ""
  266. "   /*"
  267. "    *   Indexes into WSFILEDETAILS array"
  268. "    */"
  269. "   #define  INDEX_LASTWORKER   0"
  270. ""
  271. "   /*"
  272. "    *   WSFILEDETAILS:  Structure used for details view"
  273. "    */"
  274. "   typedef struct _WSFILEDETAILS"
  275. "   {"
  276. "      PSZ     pszLastWorker; /* Last person to work with wsfile */"
  277. "   } WSFILEDETAILS;"
  278. "   typedef WSFILEDETAILS *PWSFILEDETAILS;"
  279. "";
  280.  
  281.  
  282.     //# Internal Instance Variables
  283.     PSZ pszLastWorker;            // name of last person to work with this file
  284.  
  285.     //# Method Modifiers
  286.     wpInitData: override;
  287.  
  288.     //
  289.     // OVERRIDE: wpInitData                                   ( ) PRIVATE
  290.     //                                                        (X) PUBLIC
  291.     // DESCRIPTION:
  292.     //
  293.     //   Initialize our state variables. Allocate any extra memory that
  294.     //   we might need.
  295.     //
  296.     wpUnInitData: override;
  297.  
  298.     //
  299.     // OVERRIDE: wpUnInitData                                 ( ) PRIVATE
  300.     //                                                        (X) PUBLIC
  301.     // DESCRIPTION:
  302.     //
  303.     //   Clear up memory that was allocated on wpInitData.
  304.     //
  305.     wpSaveState: override;
  306.  
  307.     //
  308.     // METHOD: wpSaveState                                    ( ) PRIVATE
  309.     //                                                        (X) PUBLIC
  310.     // DESCRIPTION:
  311.     //
  312.     //   Save our state variables (pitch and duration).
  313.     //
  314.     wpRestoreState: override;
  315.  
  316.     //
  317.     // METHOD: wpRestoreState                                 ( ) PRIVATE
  318.     //                                                        (X) PUBLIC
  319.     // DESCRIPTION:
  320.     //
  321.     //   Retrieve our saved state variables (pitch and duration).
  322.     //
  323.     wpAddSettingsPages: override;
  324.  
  325.     //
  326.     // METHOD: wpAddSettingsPages                             ( ) PRIVATE
  327.     //                                                        (X) PUBLIC
  328.     // DESCRIPTION:
  329.     //
  330.     //   Add our own settings page to let the user alter the pitch
  331.     //   and duration of the wsfile's beep.
  332.     //
  333.     wpFilterPopupMenu: override;
  334.  
  335.     //
  336.     // METHOD: wpFilterPopupMenu                              ( ) PRIVATE
  337.     //                                                        (X) PUBLIC
  338.     // DESCRIPTION:
  339.     //
  340.     //   Filter out any options from the context that don't apply.
  341.     //
  342.     // HOW TO OVERRIDE:
  343.     //
  344.     //   No restrictions.
  345.     //
  346.     wpModifyPopupMenu: override;
  347.  
  348.     //
  349.     // METHOD: wpModifyPopupMenu                              ( ) PRIVATE
  350.     //                                                        (X) PUBLIC
  351.     // DESCRIPTION:
  352.     //
  353.     //   Add our extra option to the context menu to beep the horn
  354.     //
  355.     wpMenuItemSelected: override;
  356.  
  357.     //
  358.     // METHOD: wpMenuItemSelected                             ( ) PRIVATE
  359.     //                                                        (X) PUBLIC
  360.     // DESCRIPTION:
  361.     //
  362.     //   Process input from the extra menu option that we added.
  363.     //
  364.     wpMenuItemHelpSelected: override;
  365.  
  366.     //
  367.     // METHOD: wpMenuItemHelpSelected                         ( ) PRIVATE
  368.     //                                                        (X) PUBLIC
  369.     // DESCRIPTION:
  370.     //
  371.     //   Process input from the extra menu option that we added.
  372.     //
  373.     wpQueryDetailsData: override;
  374.  
  375.     //
  376.     // METHOD: wpQueryDetailsData                             ( ) PRIVATE
  377.     //                                                        (X) PUBLIC
  378.     // DESCRIPTION:
  379.     //
  380.     //   Returns the wsfile specific data for the details view of this object.
  381.     //   Sets the pointer (*ppDetailsData) to the beginning of the buffer
  382.     //   into which the data is written.
  383.     //
  384.     wpOpen: override;
  385.  
  386.     //
  387.     //  METHOD: wpOpen                                         ( ) PRIVATE
  388.     //                                                         (X) PUBLIC
  389.     //  DESCRIPTION:
  390.     //
  391.     //    Opens the wsfile window.
  392.     //
  393.     wpSetupOnce: override;
  394.     //
  395.     //
  396.     //  METHOD: wpSetupOnce                                    ( ) PRIVATE
  397.     //                                                         (X) PUBLIC
  398.     //  DESCRIPTION:
  399.     //
  400.     //    Specify ONE TIME initialization.  This method is
  401.     //    invoked once on an object when it is initially created.
  402.     //
  403.     //    The one time initialization we're doing is to write
  404.     //    some default data to the file
  405.     wpSetup: override;
  406.  
  407.     //
  408.     // METHOD: wpSetup                                        ( ) PRIVATE
  409.     //                                                        (X) PUBLIC
  410.     // DESCRIPTION:
  411.     //
  412.     //   Specify Setup strings to do special setup string processing
  413.     //
  414.     //   New Key/Value to be parsed and processed by this override:
  415.     //
  416.     //             SOUND=(YES/NO)   YES will invoke _soundAlarm method
  417.     //                              NO  will do nothing
  418.         wpFormatDragItem: override;
  419.  
  420.     //
  421.     // METHOD: wpFormatDragItem                               ( ) PRIVATE
  422.     //                                                        (X) PUBLIC
  423.     // DESCRIPTION:
  424.     //
  425.     //   Specify a unique RMF that will only be understood by instances
  426.     //   of class WSFOLDER.  (see _wpDragOver and _wpDrop overrides in
  427.     //   wsfolder.c).
  428.     //
  429.  
  430.     //# Data Modifiers
  431.  
  432.   };
  433. #endif /* __SOMIDL__ */
  434. };
  435.  
  436. interface M_WSFILE
  437. //# Comment for parent WPDataFile:
  438.  
  439. {
  440.   HMODULE clsQueryModuleHandle();
  441.  
  442.   //
  443.   // METHOD: clsQueryModuleHandle                           ( ) PRIVATE
  444.   //                                                        (X) PUBLIC
  445.   // DESCRIPTION:
  446.   //
  447.   //   This method returns the module handle of this class.  If this is the
  448.   //   first invocation, DosQueryModuleHandle is called to save the handle
  449.   //   for future invocations.
  450.   //
  451.   // RETURN:
  452.   //
  453.   //   0              Unsuccessful
  454.   //   non-zero       module handle
  455.   //
  456.  
  457.   PSZ clsQueryDefaultFileText();
  458.  
  459.   //
  460.   // METHOD: clsQueryDefaultFileText                        ( ) PRIVATE
  461.   //                                                        (X) PUBLIC
  462.   // DESCRIPTION:
  463.   //
  464.   //   This method returns some default text to stuff in an empty WSFILE.
  465.   //
  466.   // RETURN:
  467.   //
  468.   //   PSZ
  469.   //
  470.  
  471.  
  472.  
  473. #ifdef __SOMIDL__
  474.   implementation {
  475.  
  476.     releaseorder: clsQueryModuleHandle,clsQueryDefaultFileText;
  477.  
  478.     //# Class Modifiers
  479.     externalstem = wsfile;
  480.     local;
  481.     externalprefix = wsfM_;     /* CSC2IDL: CHANGED from wsf_ after ctoi step */
  482.     functionprefix = wsfM_;
  483.     majorversion = 1;
  484.     minorversion = 2;
  485.     filestem = wsfile;
  486.     callstyle = oidl;
  487.  
  488.     //# Method Modifiers
  489.     wpclsInitData: override;
  490.  
  491.     //
  492.     // METHOD: wpclsInitData
  493.     //
  494.     // DESCRIPTION:
  495.     //
  496.     //   Initalize the class data
  497.     //
  498.     wpclsUnInitData: override;
  499.  
  500.     //
  501.     // METHOD: wpclsUnInitData
  502.     //
  503.     // DESCRIPTION:
  504.     //
  505.     //   Free any class data
  506.     //
  507.     wpclsQueryTitle: override;
  508.  
  509.     //
  510.     // METHOD: wpclsQueryTitle                                ( ) PRIVATE
  511.     //                                                        (X) PUBLIC
  512.     // DESCRIPTION:
  513.     //
  514.     //   Return the string "New MyFile".
  515.     //
  516.     wpclsQueryIconData: override;
  517.  
  518.     //
  519.     // METHOD: wpclsQueryIconDdata                            ( ) PRIVATE
  520.     //                                                        (X) PUBLIC
  521.     // DESCRIPTION:
  522.     //
  523.     //   Return the class icon
  524.     //
  525.     wpclsQueryDefaultHelp: override;
  526.  
  527.     //
  528.     // METHOD: wpclsQueryDefaultHelp                          ( ) PRIVATE
  529.     //                                                        (X) PUBLIC
  530.     // DESCRIPTION:
  531.     //
  532.     //   Process input from the extra menu option that we added.
  533.     //
  534.     wpclsQueryDefaultView: override;
  535.  
  536.     //
  537.     // METHOD: wpclsQueryDefaultView                          ( ) PRIVATE
  538.     //                                                        (X) PUBLIC
  539.     // DESCRIPTION:
  540.     //
  541.     //   Returns the default view for a new instance of this object.
  542.     //
  543.     // REMARKS:
  544.     //
  545.     //   Tell the system what our default open view is...
  546.     //
  547.     wpclsQueryDetailsInfo: override;
  548.  
  549.     //
  550.     // METHOD: wpclsQueryDetailsInfo                          ( ) PRIVATE
  551.     //                                                        (X) PUBLIC
  552.     // DESCRIPTION:
  553.     //
  554.     //   Appends the wsfile specific chain of FIELDINFO structures describing the
  555.     //   details data of this object to *ppDetailsData (if ppDetailsData
  556.     //   is NON-NULL).  In this case it also sets *ppDetailsData to the
  557.     //   head of the linked list.
  558.     //
  559.     //   Adds the number of bytes required by the details data for wsfile to *pSize
  560.     //   (if pSize is NON-NULL).
  561.     //
  562.     // REMARKS:
  563.     //
  564.     //   Add details data for this object.
  565.     //
  566.     // From WPFileSystem
  567.     wpclsQueryInstanceFilter: override;
  568.  
  569.     //
  570.     // METHOD: wpclsQueryInstanceFilter                       ( ) PRIVATE
  571.     //                                                        (X) PUBLIC
  572.     // DESCRIPTION:
  573.     //
  574.     //    The wpclsQueryInstanceFilter method is called to allow the class
  575.     //    object to specify the file title filters for instances of its
  576.     //    class.
  577.     //
  578.     // REMARKS:
  579.     //
  580.     //    A pointer to a string containing file title filter(s).  This
  581.     //    string can contain several file title filters separated by a
  582.     //    comma.  Example: "*.TXT, *.DOC"
  583.     //
  584.     wpclsQueryStyle: override;
  585.  
  586.     //
  587.     // METHOD: wpclsQueryStyle                                ( ) PRIVATE
  588.     //                                                        (X) PUBLIC
  589.     // DESCRIPTION:
  590.     //
  591.     //    The wpclsQueryStyle method is called to allow the class object
  592.     //    to specify the default object class style for its instances.
  593.     //
  594.     // REMARKS:
  595.     //
  596.     //    This method can be called at any time in order to determine the
  597.     //    default style for instances of this class.
  598.     //
  599.     //    This method should be overridden in order to modify the default
  600.     //    object style for instances of this class.
  601.     //
  602.  
  603.   };
  604. #endif /* __SOMIDL__ */
  605. };
  606.  
  607. #endif  /* wsfile_idl */
  608.