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

  1. /*******************************************************************************
  2. * FILE NAME: istatnry.hpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Declaration of the classes:                                                *
  6. *     IComponentStationery                                                     *
  7. *     IComponentStationeryFor                                                  *
  8. *                                                                              *
  9. * COPYRIGHT:                                                                   *
  10. *   IBM Open Class Library                                                     *
  11. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  12. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  13. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  14. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  15. *                                                                              *
  16. *   Portions or this component are based on work originating from Taligent.    *
  17. *   (C) Copyright Taligent, Inc. 1996 - All rights reserved.                   *
  18. *                                                                              *
  19. *******************************************************************************/
  20. #ifndef _ISTATNRY_
  21. #define _ISTATNRY_
  22.  
  23. #include <imsgbox.hpp>
  24.  
  25. // forward references
  26. class IModel;
  27. class IView;
  28. class IGUIBundle;
  29. class IComponent;
  30. class IComponentFactory;
  31. class IComponentFrameWindow;
  32. class CAswControl;
  33. class IAswClipboardSource;
  34. class IAswPasteTarget;
  35. class IAswDragSource;
  36. class CAswSourceFormatSet;
  37. class CAswTargetFormatSet;
  38.  
  39. // classes defined in this module
  40. class IComponentStationery;
  41. template < class AModel, class AView > class IComponentStationeryFor;
  42.  
  43.  
  44. #pragma pack(4)
  45.  
  46.  
  47. typedef unsigned short CLIPFORMAT;
  48.  
  49. /*******************************************************************************
  50. *                                                                              *
  51. *   Class IComponentStationery                                                 *
  52. *                                                                              *
  53. *   Abstract base class for component stationeries                             *
  54. *                                                                              *
  55. *******************************************************************************/
  56.  
  57. class IComponentStationery : public IVBase
  58. {
  59.  
  60. /*--------------------- Construction/Initialization --------------------------*/
  61. protected:
  62.                                     IComponentStationery();
  63. public:
  64.     virtual                         ~IComponentStationery();
  65.     virtual Boolean                 initialize();
  66.     int                             run( int argc, char* argv[] );
  67.  
  68. public:
  69. // Public Methods
  70.  
  71. /*-------------------------- Global Objects ----------------------------------*/
  72.  
  73.     static IComponentStationery&    stationery();
  74.     IGUIBundle&                     bundle()                const;
  75.  
  76.  
  77. /*---------------------------- Environment -----------------------------------*/
  78.  
  79.     const IString&                  appName()               const;
  80.     const IString&                  fileExt()               const;
  81.     const IString&                  shortName()             const;
  82.     Boolean                         isEmbedded()            const;
  83.     Boolean                         isContainer()           const;
  84.     Boolean                         isServer()              const;
  85.  
  86.  
  87. /*--------------------------- Helper Methods ---------------------------------*/
  88.  
  89.     void                            enableBusyDialog( Boolean );
  90.     void                            enableNotRespondingDialog( Boolean );
  91.     void                            rejectInComingCalls();
  92.     void                            allowInComingCalls();
  93.     IMessageBox::Response           messageBox( const char* msg,
  94.                                                 const IMessageBox::Style& style=
  95.                                                  IMessageBox::informationIcon |
  96.                                                  IMessageBox::moveable        |
  97.                                                  IMessageBox::applicationModal|
  98.                                                  IMessageBox::okButton,
  99.                                                 IWindow*    owner=NULL);
  100.  
  101.  
  102. /*----------------------------Factory Methods --------------------------------*/
  103.  
  104.     virtual IComponentFrameWindow*  createFrameWindow();
  105.     virtual IGUIBundle*             createBundle() const;
  106.     virtual IComponent*             createComponent() const;
  107.     virtual IModel*                 createModel() const = 0;
  108.     virtual IView*                  createView() const = 0;
  109.  
  110.  
  111. /*--------------------------- Library Use Only -------------------------------*/
  112. public:
  113. #ifdef IC_LIBRARYUSEONLY
  114.     // casting operator to make this class look like it was derived from CAswControl
  115.                                     operator CAswControl* () const;
  116.  
  117.     // should really be protected but have to be called from winmain
  118.     Boolean                         initWindows();
  119.     Boolean                         setupBundle();
  120.     // called in setup of compimp
  121.     IComponentFactory&              componentFactory()      const;
  122.  
  123. /*----------------------------- Data Exchange --------------------------------*/
  124.     IAswClipboardSource&            clipSource()            const;
  125.     IAswPasteTarget&                pasteTarget()           const;
  126.     IAswDragSource&                 dragSource()            const;
  127.     CLIPFORMAT                      cfEmbeddedObject()      const;
  128.     CLIPFORMAT                      cfObjectDescriptor()    const;
  129.     CLIPFORMAT                      cfLinkSource()          const;
  130.     CLIPFORMAT                      cfLinkSrcDescriptor()   const;
  131.     CAswSourceFormatSet&            sourceFormatSet();
  132.     CAswTargetFormatSet&            targetFormatSet();
  133.  
  134. #endif // IC_LIBRARYUSEONLY
  135.  
  136.  
  137. private:
  138.     void                            updateRegistry();
  139.     CAswControl&                    control()               const;
  140.  
  141. private:
  142. // Data members
  143.     // our 1 and only instance
  144.     static IComponentStationery*    fgTheStationery;
  145.  
  146.     CAswControl*                    fpAswControl;
  147.     IComponentFactory*              fpComponentFactory;
  148.  
  149.     // In the future the stationery will maintain a list of bundle pointers
  150.     // and support multi object servers.  Currently, servers are always
  151.     // registered with OLE using REGCLS_SINGLEUSE.
  152.     IGUIBundle*                     fpBundle;
  153.  
  154.     // clipboard and drag/drop support
  155.     IAswClipboardSource*            fpClipSource;
  156.     IAswPasteTarget*                fpPasteTarget;
  157.     IAswDragSource*                 fpDragSource;
  158.     CLIPFORMAT                      fcfEmbeddedObject;
  159.     CLIPFORMAT                      fcfObjectDescriptor;
  160.     CLIPFORMAT                      fcfLinkSource;
  161.     CLIPFORMAT                      fcfLinkSrcDescriptor;
  162.  
  163.     CAswSourceFormatSet*            fpSourceFormatSet;
  164.     CAswTargetFormatSet*            fpTargetFormatSet;
  165.  
  166.     // Running args
  167.     IString                         fstrAppName;
  168.     IString                         fstrFileExt;
  169.     IString                         fstrShortName;
  170.  
  171.     // command line parsing
  172.     Boolean                         fbEmbedded;
  173.  
  174.  
  175. }; // class IComponentStationery
  176.  
  177.  
  178.  
  179. /*******************************************************************************
  180. *                                                                              *
  181. *   Class IComponentStationeryFor                                              *
  182. *                                                                              *
  183. *   Templated stationery class; takes a model and a view                       *
  184. *                                                                              *
  185. *******************************************************************************/
  186.  
  187. template < class AModel, class AView >
  188. class IComponentStationeryFor : public IComponentStationery
  189. {
  190. public:
  191. // Constuction/Destruction
  192.                                     IComponentStationeryFor();
  193.                                     ~IComponentStationeryFor();
  194.  
  195. // Public Methods
  196.  
  197.     // implementation of pure virtual methods in base class
  198.     virtual IModel*                 createModel() const;
  199.     virtual IView*                  createView() const;
  200.  
  201.  
  202. }; // class IComponentStationeryFor
  203.  
  204.  
  205.  
  206. #ifndef __TEMPINC__
  207.   #include <istatnry.c>
  208. #endif
  209.  
  210.   #include <istatnry.inl>
  211.  
  212.  
  213. #pragma pack()
  214.  
  215. #endif // _ISTATNRY_
  216.