home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / wps / wsfile / wsfile.idl < prev    next >
Text File  |  1999-05-11  |  18KB  |  592 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 IDD_LASTWORKER2    1200                 /* settings page (dialog) */"
  213. "   #define IDC_LASTWORKER     300"
  214. ""
  215. ""
  216. "   /*"
  217. "    *   The following user-defined Popup menu items (ID_xxx) should be higher"
  218. "    *   than WPMENUID_USER."
  219. "    *"
  220. "    *   The ID_OPENMENU will become a submenu of the system's popup open menu"
  221. "    *   id, WPMENUID_OPEN."
  222. "    */"
  223. "   #define ID_ALARMMENU       (WPMENUID_USER+1) /* menus added to popup menu */"
  224. "   #define ID_OPENMENU        (WPMENUID_USER+2)"
  225. ""
  226. "   #define IDM_OPENWSFILE        (WPMENUID_USER+3) /* submenus of added menus */"
  227. "   #define IDM_SOUNDALARM        (WPMENUID_USER+4)"
  228. ""
  229. "   #define ID_FRAME           3000                       /* frame window id */"
  230. "   #define ID_CLIENT          3001                       /* client window id */"
  231. ""
  232. "   /*"
  233. "    *   Set unique view ids, in order for the default view checkmark"
  234. "    *   to be set correctly, on the Open submenu, this OPEN view id must"
  235. "    *   be the same value as the corresponding menu id."
  236. "    */"
  237. "   #define OPEN_WSFILE           IDM_OPENWSFILE"
  238. ""
  239. "   /*"
  240. "    *   IDs of dialog items in WSFILE.RC"
  241. "    */"
  242. "   #define ID_UNDO            801"
  243. "   #define ID_DEFAULT         802"
  244. "   #define ID_HELP            803"
  245. ""
  246. "   /*"
  247. "    *  Keys for save-restore methods"
  248. "    */"
  249. "   #define IDKEY_LASTWORKER   1"
  250. ""
  251. "   /*"
  252. "    *   Default values of instance data items"
  253. "    */"
  254. "   #define DEFAULT_LASTWORKER \"Anonymous\""
  255. ""
  256. "   /*"
  257. "    *   Help IDs"
  258. "    *"
  259. "    *   NOTE:  See wsfile.ipf for the source of this class's help,"
  260. "    *   from which wsfile.hlp is built"
  261. "    */"
  262. "   #define ID_HELP_DEFAULT    256"
  263. "   #define ID_HELP_OPENWSFILE 257"
  264. "   #define ID_HELP_LASTWORKER 258"
  265. "   #define ID_HELP_SOUNDALARM 259"
  266. ""
  267. "   /*"
  268. "    *   Indexes into WSFILEDETAILS array"
  269. "    */"
  270. "   #define  INDEX_LASTWORKER   0"
  271. ""
  272. "   /*"
  273. "    *   WSFILEDETAILS:  Structure used for details view"
  274. "    */"
  275. "   typedef struct _WSFILEDETAILS"
  276. "   {"
  277. "      PSZ     pszLastWorker; /* Last person to work with wsfile */"
  278. "   } WSFILEDETAILS;"
  279. "   typedef WSFILEDETAILS *PWSFILEDETAILS;"
  280. "";
  281.  
  282.  
  283.     //# Internal Instance Variables
  284.     PSZ pszLastWorker;            // name of last person to work with this file
  285.  
  286.     //# Method Modifiers
  287.     wpInitData: override;
  288.  
  289.     //
  290.     // OVERRIDE: wpInitData                                   ( ) PRIVATE
  291.     //                                                        (X) PUBLIC
  292.     // DESCRIPTION:
  293.     //
  294.     //   Initialize our state variables. Allocate any extra memory that
  295.     //   we might need.
  296.     //
  297.     wpUnInitData: override;
  298.  
  299.     //
  300.     // OVERRIDE: wpUnInitData                                 ( ) PRIVATE
  301.     //                                                        (X) PUBLIC
  302.     // DESCRIPTION:
  303.     //
  304.     //   Clear up memory that was allocated on wpInitData.
  305.     //
  306.     wpSaveState: override;
  307.  
  308.     //
  309.     // METHOD: wpSaveState                                    ( ) PRIVATE
  310.     //                                                        (X) PUBLIC
  311.     // DESCRIPTION:
  312.     //
  313.     //   Save our state variables (pitch and duration).
  314.     //
  315.     wpRestoreState: override;
  316.  
  317.     //
  318.     // METHOD: wpRestoreState                                 ( ) PRIVATE
  319.     //                                                        (X) PUBLIC
  320.     // DESCRIPTION:
  321.     //
  322.     //   Retrieve our saved state variables (pitch and duration).
  323.     //
  324.     wpAddSettingsPages: override;
  325.  
  326.     //
  327.     // METHOD: wpAddSettingsPages                             ( ) PRIVATE
  328.     //                                                        (X) PUBLIC
  329.     // DESCRIPTION:
  330.     //
  331.     //   Add our own settings page to let the user alter the pitch
  332.     //   and duration of the wsfile's beep.
  333.     //
  334.     wpFilterPopupMenu: override;
  335.  
  336.     //
  337.     // METHOD: wpFilterPopupMenu                              ( ) PRIVATE
  338.     //                                                        (X) PUBLIC
  339.     // DESCRIPTION:
  340.     //
  341.     //   Filter out any options from the context that don't apply.
  342.     //
  343.     // HOW TO OVERRIDE:
  344.     //
  345.     //   No restrictions.
  346.     //
  347.     wpModifyPopupMenu: override;
  348.  
  349.     //
  350.     // METHOD: wpModifyPopupMenu                              ( ) PRIVATE
  351.     //                                                        (X) PUBLIC
  352.     // DESCRIPTION:
  353.     //
  354.     //   Add our extra option to the context menu to beep the horn
  355.     //
  356.     wpMenuItemSelected: override;
  357.  
  358.     //
  359.     // METHOD: wpMenuItemSelected                             ( ) PRIVATE
  360.     //                                                        (X) PUBLIC
  361.     // DESCRIPTION:
  362.     //
  363.     //   Process input from the extra menu option that we added.
  364.     //
  365.     wpMenuItemHelpSelected: override;
  366.  
  367.     //
  368.     // METHOD: wpMenuItemHelpSelected                         ( ) PRIVATE
  369.     //                                                        (X) PUBLIC
  370.     // DESCRIPTION:
  371.     //
  372.     //   Process input from the extra menu option that we added.
  373.     //
  374.     wpQueryDetailsData: override;
  375.  
  376.     //
  377.     // METHOD: wpQueryDetailsData                             ( ) PRIVATE
  378.     //                                                        (X) PUBLIC
  379.     // DESCRIPTION:
  380.     //
  381.     //   Returns the wsfile specific data for the details view of this object.
  382.     //   Sets the pointer (*ppDetailsData) to the beginning of the buffer
  383.     //   into which the data is written.
  384.     //
  385.     wpOpen: override;
  386.  
  387.     //
  388.     //  METHOD: wpOpen                                         ( ) PRIVATE
  389.     //                                                         (X) PUBLIC
  390.     //  DESCRIPTION:
  391.     //
  392.     //    Opens the wsfile window.
  393.     //
  394.     wpSetupOnce: override;
  395.     //
  396.     //
  397.     //  METHOD: wpSetupOnce                                    ( ) PRIVATE
  398.     //                                                         (X) PUBLIC
  399.     //  DESCRIPTION:
  400.     //
  401.     //    Specify ONE TIME initialization.  This method is
  402.     //    invoked once on an object when it is initially created.
  403.     //
  404.     //    The one time initialization we're doing is to write
  405.     //    some default data to the file
  406.     wpSetup: override;
  407.  
  408.     //
  409.     // METHOD: wpSetup                                        ( ) PRIVATE
  410.     //                                                        (X) PUBLIC
  411.     // DESCRIPTION:
  412.     //
  413.     //   Specify Setup strings to do special setup string processing
  414.     //
  415.     //   New Key/Value to be parsed and processed by this override:
  416.     //
  417.     //             SOUND=(YES/NO)   YES will invoke _soundAlarm method
  418.     //                              NO  will do nothing
  419.         wpFormatDragItem: override;
  420.  
  421.     //
  422.     // METHOD: wpFormatDragItem                               ( ) PRIVATE
  423.     //                                                        (X) PUBLIC
  424.     // DESCRIPTION:
  425.     //
  426.     //   Specify a unique RMF that will only be understood by instances
  427.     //   of class WSFOLDER.  (see _wpDragOver and _wpDrop overrides in
  428.     //   wsfolder.c).
  429.     //
  430.  
  431.     //# Data Modifiers
  432.  
  433.   };
  434. #endif /* __SOMIDL__ */
  435. };
  436.  
  437. interface M_WSFILE
  438. //# Comment for parent WPDataFile:
  439.  
  440. {
  441.   HMODULE clsQueryModuleHandle();
  442.  
  443.   //
  444.   // METHOD: clsQueryModuleHandle                           ( ) PRIVATE
  445.   //                                                        (X) PUBLIC
  446.   // DESCRIPTION:
  447.   //
  448.   //   This method returns the module handle of this class.  If this is the
  449.   //   first invocation, DosQueryModuleHandle is called to save the handle
  450.   //   for future invocations.
  451.   //
  452.   // RETURN:
  453.   //
  454.   //   0              Unsuccessful
  455.   //   non-zero       module handle
  456.   //
  457.  
  458.   PSZ clsQueryDefaultFileText();
  459.  
  460.   //
  461.   // METHOD: clsQueryDefaultFileText                        ( ) PRIVATE
  462.   //                                                        (X) PUBLIC
  463.   // DESCRIPTION:
  464.   //
  465.   //   This method returns some default text to stuff in an empty WSFILE.
  466.   //
  467.   // RETURN:
  468.   //
  469.   //   PSZ
  470.   //
  471.  
  472.  
  473.  
  474. #ifdef __SOMIDL__
  475.   implementation {
  476.  
  477.     releaseorder: clsQueryModuleHandle,clsQueryDefaultFileText;
  478.  
  479.     //# Class Modifiers
  480.     externalstem = wsfile;
  481.     local;
  482.     externalprefix = wsfM_;     /* CSC2IDL: CHANGED from wsf_ after ctoi step */
  483.     functionprefix = wsfM_;
  484.     majorversion = 1;
  485.     minorversion = 2;
  486.     filestem = wsfile;
  487.     callstyle = oidl;
  488.  
  489.     //# Method Modifiers
  490.     wpclsInitData: override;
  491.  
  492.     //
  493.     // METHOD: wpclsInitData
  494.     //
  495.     // DESCRIPTION:
  496.     //
  497.     //   Initalize the class data
  498.     //
  499.     wpclsUnInitData: override;
  500.  
  501.     //
  502.     // METHOD: wpclsUnInitData
  503.     //
  504.     // DESCRIPTION:
  505.     //
  506.     //   Free any class data
  507.     //
  508.     wpclsQueryTitle: override;
  509.  
  510.     //
  511.     // METHOD: wpclsQueryTitle                                ( ) PRIVATE
  512.     //                                                        (X) PUBLIC
  513.     // DESCRIPTION:
  514.     //
  515.     //   Return the string "New MyFile".
  516.     //
  517.     wpclsQueryIconData: override;
  518.  
  519.     //
  520.     // METHOD: wpclsQueryIconDdata                            ( ) PRIVATE
  521.     //                                                        (X) PUBLIC
  522.     // DESCRIPTION:
  523.     //
  524.     //   Return the class icon
  525.     //
  526.     wpclsQueryDefaultHelp: override;
  527.  
  528.     //
  529.     // METHOD: wpclsQueryDefaultHelp                          ( ) PRIVATE
  530.     //                                                        (X) PUBLIC
  531.     // DESCRIPTION:
  532.     //
  533.     //   Process input from the extra menu option that we added.
  534.     //
  535.     wpclsQueryDefaultView: override;
  536.  
  537.     //
  538.     // METHOD: wpclsQueryDefaultView                          ( ) PRIVATE
  539.     //                                                        (X) PUBLIC
  540.     // DESCRIPTION:
  541.     //
  542.     //   Returns the default view for a new instance of this object.
  543.     //
  544.     // REMARKS:
  545.     //
  546.     //   Tell the system what our default open view is...
  547.     //
  548.     wpclsQueryDetailsInfo: override;
  549.  
  550.     //
  551.     // METHOD: wpclsQueryDetailsInfo                          ( ) PRIVATE
  552.     //                                                        (X) PUBLIC
  553.     // DESCRIPTION:
  554.     //
  555.     //   Appends the wsfile specific chain of FIELDINFO structures describing the
  556.     //   details data of this object to *ppDetailsData (if ppDetailsData
  557.     //   is NON-NULL).  In this case it also sets *ppDetailsData to the
  558.     //   head of the linked list.
  559.     //
  560.     //   Adds the number of bytes required by the details data for wsfile to *pSize
  561.     //   (if pSize is NON-NULL).
  562.     //
  563.     // REMARKS:
  564.     //
  565.     //   Add details data for this object.
  566.     //
  567.     // From WPFileSystem
  568.     wpclsQueryStyle: override;
  569.  
  570.     //
  571.     // METHOD: wpclsQueryStyle                                ( ) PRIVATE
  572.     //                                                        (X) PUBLIC
  573.     // DESCRIPTION:
  574.     //
  575.     //    The wpclsQueryStyle method is called to allow the class object
  576.     //    to specify the default object class style for its instances.
  577.     //
  578.     // REMARKS:
  579.     //
  580.     //    This method can be called at any time in order to determine the
  581.     //    default style for instances of this class.
  582.     //
  583.     //    This method should be overridden in order to modify the default
  584.     //    object style for instances of this class.
  585.     //
  586.  
  587.   };
  588. #endif /* __SOMIDL__ */
  589. };
  590.  
  591. #endif  /* wsfile_idl */
  592.