home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ireslib.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  8.2 KB  |  258 lines

  1. #ifndef _IRESLIB_
  2. #define _IRESLIB_
  3. /*******************************************************************************
  4. * FILE NAME: ireslib.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IResourceLibrary                                                         *
  9. *     IDynamicLinkLibrary                                                      *
  10. *     IResourceId                                                              *
  11. *                                                                              *
  12. * COPYRIGHT:                                                                   *
  13. *   IBM Open Class Library                                                     *
  14. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  15. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  16. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  17. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  18. *                                                                              *
  19. *******************************************************************************/
  20. #include <ivbase.hpp>
  21. #include <ihandle.hpp>
  22.  
  23. class IString;
  24. class IDLLModule;
  25. class ISize;
  26. class IWindow;
  27. class IMenu;
  28. class IResLibPrivateData;
  29.  
  30. #pragma pack(4)
  31.  
  32. class IResourceLibrary  : public IVBase {
  33. typedef IVBase
  34.   Inherited;
  35. public:
  36. /*------------------------------- Constructors -------------------------------*/
  37.   IResourceLibrary   ( );
  38.   IResourceLibrary   ( const IResourceLibrary& resLibrary );
  39. virtual
  40.  ~IResourceLibrary   ( );
  41.  
  42. IResourceLibrary
  43.  &operator=           ( const IResourceLibrary& resLibrary );
  44.  
  45. /*---------------------------- Resource Information --------------------------*/
  46. virtual IString
  47.   fileName           ( ) const;
  48.  
  49. virtual Boolean
  50.   isOpen             ( ) const;
  51.  
  52. virtual IModuleHandle
  53.   handle             ( ) const;
  54.  
  55. /*-------------------------------- Diagnostics -------------------------------*/
  56. virtual IString
  57.   asString           ( ) const,
  58.   asDebugInfo        ( ) const;
  59.  
  60.  
  61. /*------------------------------ Resource Loading ----------------------------*/
  62. virtual IString
  63.   loadString      ( unsigned long stringId  ) const,
  64.   loadMessage     ( unsigned long messageId ) const;
  65.  
  66.  
  67. virtual IMenuHandle
  68.   loadMenu        ( unsigned long menuId,
  69.                     IWindow*      menuOwner ) const;
  70.  
  71. virtual IWindowHandle
  72.   loadDialog      ( unsigned long dialogId,
  73.                     IWindow*      dialogParent,
  74.                     IWindow*      dialogOwner,
  75.                     IWinProc*     dialogProcedure,
  76.                     void*         dialogCreateParameters ) const;
  77.  
  78.  
  79. virtual IAccelTblHandle
  80.   loadAccelTable  ( unsigned long accelTableId ) const;
  81.  
  82. virtual IResourceLibrary
  83.  &loadHelpTable   ( IWindow*      helpInstance,
  84.                     unsigned long helpTableId ) const;
  85.  
  86. virtual IPointerHandle
  87.   loadIcon        ( unsigned long iconId,
  88.                     Boolean       cached = true ) const,
  89.   loadPointer     ( unsigned long iconId,
  90.                     Boolean       cached = true ) const;
  91.  
  92. virtual IBitmapHandle
  93.   loadBitmap      ( unsigned long bitmapId,
  94.                     Boolean       cached = true ) const,
  95.   loadBitmap      ( unsigned long bitmapId,
  96.                     const ISize&  bitmapSize,
  97.                     Boolean       cached = true ) const;
  98.  
  99.  
  100. virtual IString
  101.   tryToLoadString      ( unsigned long stringId  ) const,
  102.   tryToLoadMessage     ( unsigned long messageId ) const;
  103.  
  104. virtual IPointerHandle
  105.   tryToLoadIcon        ( unsigned long iconId,
  106.                          Boolean       cached = true ) const;
  107.  
  108. virtual IBitmapHandle
  109.   tryToLoadBitmap     ( unsigned long bitmapId,
  110.                         Boolean       cached = true ) const,
  111.   tryToLoadBitmap     ( unsigned long bitmapId,
  112.                         const ISize&  bitmapSize,
  113.                         Boolean       cached = true ) const;
  114.  
  115. private:
  116. /*-------------------------------- Private -----------------------------------*/
  117. char
  118.  *loadText       ( Boolean       isString,
  119.                    unsigned long stringID,
  120.                    char*         buffer = 0,
  121.                    unsigned long length = 0,
  122.                    Boolean       throwException = true ) const;
  123.  
  124.  
  125. static unsigned long
  126.   addRef          ( const IPointerHandle& pointerHandle ),
  127.   addRef          ( const IBitmapHandle&  bitmapHandle ),
  128.   removeRef       ( const IPointerHandle& pointerHandle ),
  129.   removeRef       ( const IBitmapHandle&  bitmapHandle );
  130.  
  131. static unsigned long
  132.   systemPointer ( unsigned long systemPointerId,
  133.                   Boolean       fCopy = false,
  134.                   Boolean       fIconApi = false );
  135. static unsigned long
  136.   systemBitmap  ( unsigned long systemBitmapId);
  137.  
  138. IResLibPrivateData
  139.  *ppd;
  140.  
  141. IModuleHandle
  142.   hInstance;
  143.  
  144. friend class IPointerHandle;
  145. friend class IBitmapHandle;
  146. friend class ISystemPointerHandle;
  147. friend class ISystemBitmapHandle;
  148. friend class ICnrObjPrivateData;
  149.  
  150.  
  151. };  // IResourceLibrary
  152.  
  153.  
  154. class IDynamicLinkLibrary : public IResourceLibrary
  155. {
  156. typedef IResourceLibrary
  157.   Inherited;
  158. public:
  159. /*------------------------------- Constructors -------------------------------*/
  160.   IDynamicLinkLibrary   ( const char*                resourceFileName );
  161.   IDynamicLinkLibrary   ( const IModuleHandle&       moduleHandle );
  162.   IDynamicLinkLibrary   ( const IDynamicLinkLibrary& dllLibrary );
  163.  
  164. virtual
  165.   ~IDynamicLinkLibrary  ( );
  166.  
  167. IDynamicLinkLibrary
  168.  &operator=             ( const IDynamicLinkLibrary& dllLibrary );
  169.  
  170. /*-------------------------- Opening and Closing -----------------------------*/
  171. virtual IDynamicLinkLibrary
  172.  &open                ( ),
  173.  &close               ( );
  174.  
  175. /*----------------------- Procedure Address Loading --------------------------*/
  176. void
  177.  *procAddress       ( const char*   procedureName ) const,
  178.  *procAddress       ( unsigned long procedureOrdinal ) const;
  179.  
  180. Boolean
  181.   isEntryPoint32Bit ( const char*   procedureName ) const,
  182.   isEntryPoint32Bit ( unsigned long procedureOrdinal ) const;
  183.  
  184. /*--------------------- Dynamic Link Library Information ---------------------*/
  185. virtual Boolean
  186.   isOpen           ( ) const;
  187.  
  188. virtual IString
  189.   fileName         ( ) const;
  190.  
  191. virtual IModuleHandle
  192.   handle           ( ) const;
  193.  
  194. /*-------------------------------- Diagnostics -------------------------------*/
  195. virtual IString
  196.   asString         ( ) const,
  197.   asDebugInfo      ( ) const;
  198.  
  199.  
  200. private:
  201. /*-------------------------------- Private -----------------------------------*/
  202. static unsigned long
  203.   addRef          ( const IModuleHandle& moduleHandle ),
  204.   removeRef       ( const IModuleHandle& moduleHandle );
  205.  
  206. IDLLModule
  207.  *pmodClResource;
  208. };
  209.  
  210.  
  211. class IResourceId  : public IBase
  212. {
  213. typedef IBase
  214.   Inherited;
  215. public:
  216. /*------------------------------- Constructors -------------------------------*/
  217.   IResourceId      ( unsigned long              resourceId,
  218.                      const IResourceLibrary&    resourceLibrary );
  219.   IResourceId      ( unsigned long              resourceId,
  220.                      const IDynamicLinkLibrary& dllLibrary );
  221.  
  222.   IResourceId      ( unsigned long              resourceId );
  223.  
  224. /*--------------------------------- Resources --------------------------------*/
  225. unsigned long
  226.   id                    ( ) const;
  227.  
  228. operator unsigned long  ( ) const;
  229.  
  230. const IResourceLibrary
  231.  &resourceLibrary       ( ) const;
  232.  
  233. /*-------------------------------- Diagnostics -------------------------------*/
  234. IString
  235.   asString         ( ) const,
  236.   asDebugInfo      ( ) const;
  237.  
  238.  
  239. private:
  240. /*------------------------------ Hidden Members ------------------------------*/
  241. IResourceId
  242.   &operator=    ( const IResourceId& resourceId );
  243.  
  244. /*--------------------------------- Private ----------------------------------*/
  245. unsigned long
  246.   ulClId;
  247.  
  248. const IResourceLibrary
  249.  &reslibCl;
  250.  
  251. }; // IResourceId
  252.  
  253. #pragma pack()
  254.  
  255.   #include <ireslib.inl>
  256.  
  257. #endif /* _IRESLIB_ */
  258.