home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / wps / textfldr / textfldr.idl < prev    next >
Text File  |  1999-05-11  |  6KB  |  205 lines

  1.  
  2. //# This file was generated by the SOM Compiler.
  3. //# FileName: textfldr.id2.
  4. //# Generated using:
  5. //#     SOM Precompiler somopc: 2.7
  6. //#     SOM Emitter emitidl: 2.22
  7.  
  8. //
  9. //
  10. //   Module Name: TEXTFLDR
  11. //
  12. //   OS/2 Work Place Shell Sample Program
  13. //
  14. //   Copyright (C) 1993 IBM Corporation
  15. //
  16. //       DISCLAIMER OF WARRANTIES.  The following [enclosed] 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 textfldr_idl
  27. #define textfldr_idl
  28.  
  29. #include <wpfolder.idl>
  30. #include <somcls.idl>
  31.  
  32. interface M_TextFolder;
  33.  
  34. interface TextFolder : WPFolder
  35.  
  36. //
  37. // CLASS: TextFolder
  38. //
  39. // CLASS HIERARCHY:
  40. //
  41. //     SOMObject
  42. //       └── WPObject
  43. //             └── WPFileSystem
  44. //                   └── WPFolder
  45. //                         └──  TextFolder
  46. //
  47. // DESCRIPTION:
  48. //
  49. //    This is the TextFolder object class. This object is similar to
  50. //    normal folders. The text folder rejects any object that isn't
  51. //    a file system object that only contains text. The TextFolder accepts
  52. //    file system objects that have a type of 'Plain Text' or have no type
  53. //    and contain text characters only.
  54. //
  55. //    An instance of this class can be created as a Workplace object.
  56. //
  57.  
  58. {
  59. #ifdef __PRIVATE__
  60.  
  61.   BOOL IsTextFile(in PSZ pszFileName);
  62.  
  63.   //
  64.   // METHOD: IsTextFile                                     (X) PRIVATE
  65.   //                                                        ( ) PUBLIC
  66.   // DESCRIPTION:
  67.   //
  68.   //   This method checks the first 'n' characters of a file to determine
  69.   //   if it is or is not text. This method is invoked by the
  70.   //   ValidateDragAndDrop method. It is invoked only if no type is specified
  71.   //   for the object being manipulated.  A file is considered to be text if
  72.   //   the first 'n' bytes are in the range of ASCII 32 (20 Hex) to ASCII 126
  73.   //   (7E Hex), or is a carriage return (ASCII 10, Hex 0A), line feed
  74.   //   (ASCII 13, Hex 0D), tab (ASCII 8, HEX 08), or end of file marker
  75.   //   (ASCII 26, Hex 1A).
  76.   //
  77.   //   NOTE: The value used for 'n' is stored in the variable ulSampleSize
  78.   //   which is local to the IsTextFile method.
  79.   //
  80.   // RETURN:
  81.   //
  82.   //   TRUE  - the object is a text file.
  83.   //   FALSE - the object is not a text file.
  84.   //
  85.   // HOW TO OVERRIDE:
  86.   //
  87.   //   n/a
  88.   //
  89.  
  90.   BOOL ValidateDragAndDrop(in PDRAGINFO pdrgInfo);
  91.  
  92.   //
  93.   // METHOD: ValidateDragAndDrop                            (X) PRIVATE
  94.   //                                                        ( ) PUBLIC
  95.   // DESCRIPTION:
  96.   //
  97.   //   This method determines if an object can be dragged/dropped on the
  98.   //   TextFolder. It is invoked by the wpDrag and wpDragOver methods.
  99.   //
  100.   //   The ValidateDragAndDrop method first checks the type of the object
  101.   //   being manipulated. If a type is specified, and it is Plain Text,
  102.   //   the operation is considered to be valid. If a type is specified and
  103.   //   it is not Plain Text the operation is considered invalid. If no
  104.   //   type is specified the IsTextFile() method is invoked to determine
  105.   //   if the object is or is not a text object.
  106.   //
  107.   // RETURN:
  108.   //
  109.   //   TRUE  - The object can be dragged/dropped on the TextFolder.
  110.   //   FALSE - The object can not be dragged/dropped on the TextFolder.
  111.   //
  112.   // HOW TO OVERRIDE:
  113.   //
  114.   //   n/a
  115.   //
  116.   //
  117.   //   Methods from the WPFileSystem class
  118.   //
  119.  
  120.  
  121. #endif
  122.  
  123.  
  124. #ifdef __SOMIDL__
  125.   implementation {
  126.  
  127.     releaseorder: IsTextFile,ValidateDragAndDrop;
  128.  
  129.     //# Class Modifiers
  130.     externalstem = TextFolderwps;
  131.     local;
  132.     externalprefix = TextFolderwps_;
  133.     majorversion = 1;
  134.     minorversion = 2;
  135.     filestem = textfldr;
  136.     metaclass = M_TextFolder;
  137.     callstyle = oidl;
  138.  
  139.     passthru C_ih =     ""
  140. "        #define   INCL_WIN"
  141. "        #define   INCL_DOSERRORS"
  142. "        #define   INCL_DOSMODULEMGR"
  143. "        #define   INCL_WPCLASS"
  144. "        #include  <os2.h>"
  145. ""
  146. "        #include  <pmwp.h>"
  147. ""
  148. "        #include \"string.h\""
  149. ""
  150. "        #define ID_ICON 100"
  151. ""
  152. "        #define FIRST_TEXT_CHAR         0x20"
  153. "        #define LAST_TEXT_CHAR          0x7e"
  154. "        #define CHAR_CARRIAGE_RETURN    '\r'"
  155. "        #define CHAR_LINE_FEED          '\n'"
  156. "        #define CHAR_TAB                '\t'"
  157. "        #define CHAR_END_OF_FILE        0x1a"
  158. "";
  159.  
  160.     passthru C_h_after =  ""
  161. "";
  162.  
  163.     //# Method Modifiers
  164.     wpFilterPopupMenu: override;
  165.     wpAddFolderView2Page: override;
  166.     wpAddFolderIncludePage: override;
  167.     wpDragOver: override;
  168.     wpDrop: override;
  169.  
  170. #ifdef __PRIVATE__
  171.  
  172.     //# Data Modifiers
  173.  
  174. #endif
  175.  
  176.   };
  177. #endif /* __SOMIDL__ */
  178. };
  179.  
  180. interface M_TextFolder
  181. {
  182.  
  183. #ifdef __SOMIDL__
  184.   implementation {
  185.  
  186.     //# Class Modifiers
  187.     externalstem = TextFolderwps;
  188.     local;
  189.     externalprefix = TextFolderwps_;
  190.     functionprefix = TextFolderM_;
  191.     majorversion = 1;
  192.     minorversion = 2;
  193.     filestem = textfldr;
  194.     callstyle = oidl;
  195.  
  196.     //# Method Modifiers
  197.     wpclsQueryTitle: override;
  198.     wpclsQueryIconData: override;
  199.  
  200.   };
  201. #endif /* __SOMIDL__ */
  202. };
  203.  
  204. #endif  /* textfldr_idl */
  205.