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

  1. /*******************************************************************************
  2. * FILE NAME: iembmod.hpp                                                       *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Declaration of the classes:                                                *
  6. *     IEmbedderModel                                                           *
  7. *     IEmbeddedComponent                                                       *
  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 _IEMBMOD_
  21. #define _IEMBMOD_
  22.  
  23. #include <imodel.hpp>
  24. #include <icompnen.hpp>
  25. #include <igrabhdl.hpp>
  26. #include <irect.hpp>
  27. #include <iptr.h>
  28. #include <iseq.h>
  29.  
  30. // classes defined in this module
  31. class IEmbeddedComponent;
  32. class IEmbedderModel;
  33.  
  34. // forward references
  35. class IEmbeddedComponentImp;
  36. class CAswStorage;
  37. class CAswContainer;
  38. class CAswRootContainer;
  39.  
  40.  
  41. #pragma pack(4)
  42.  
  43.  
  44.  
  45. /*******************************************************************************
  46. *                                                                              *
  47. *                           IEmbeddedComponent                                 *
  48. *                                                                              *
  49. *******************************************************************************/
  50.  
  51. class IEmbeddedComponent : public IVBase, public IMGrabbable
  52. {
  53. public:
  54.     
  55. /*----------------------- Construction/Destruction ---------------------------*/
  56.     
  57.                             IEmbeddedComponent();
  58.                             IEmbeddedComponent( const IEmbeddedComponent& );
  59.     virtual void            initialize( Boolean, Boolean );
  60.     virtual                 ~IEmbeddedComponent();
  61.         
  62.  
  63. /*------------------------------ Painting ------------------------------------*/
  64.  
  65.     virtual void            draw( IPresSpaceHandle&,
  66.                                   const IRectangle&,
  67.                                   Boolean metaFile = false );
  68.     void                    showGrabHandles( Boolean bShow = true );
  69.         
  70.         
  71. /*--------------------- Embedded Component Management ------------------------*/
  72.  
  73.     void                    goActive( long lVerb = 0 );
  74.     void                    goInactive();
  75.     IComponent::EAspect     aspect() const;
  76.     void                    setAspect( const IComponent::EAspect );
  77.  
  78.  
  79. /*----------------------------- Informational --------------------------------*/
  80.     
  81.     Boolean                 isInitialized() const;
  82.     Boolean                 isInPlaceActive() const;
  83.     const IRectangle&       area() const;
  84.     virtual IRectangle      objectArea() const;
  85.     virtual IString         name() const;
  86.     IGUIBundle&             bundle() const;
  87.     unsigned                number() const;
  88.     IGrabHandles*           grabHandles() const;
  89.  
  90.  
  91. /*---------------------- Sizing Notification Handlers ------------------------*/
  92.  
  93.     void                    resize( const IRectangle& );
  94.     void                    setArea( const IRectangle& );
  95.     virtual void            setObjectArea( const IRectangle& );
  96.  
  97.     
  98. /*------------------------- Streaming Operators ------------------------------*/
  99.  
  100.     IBaseStream&            operator>>= ( IBaseStream& towhere ) const;
  101.     IBaseStream&            operator<<= ( IBaseStream& fromwhere );
  102.  
  103. #ifdef IC_LIBRARYUSEONLY
  104.     IEmbeddedComponentImp*  containedObject() const;
  105.     IPoint                  dragMouseOffset() const;
  106.     TypeExtensionDeclarationsMacro(IEmbeddedComponent)
  107.     virtual void            preinitialize( IGUIBundle& inBundle,
  108.                                            CAswStorage* fromStorage = NULL );
  109. #endif
  110.  
  111. protected:
  112.  
  113. /*-------------------------- IMGrabbable overrides ---------------------------*/
  114.  
  115.     virtual IRectangle      rect() const;
  116.     virtual void            setRect( const IRectangle& );
  117.     virtual IWindow&        inWindow() const;
  118.     virtual Boolean         doDragDrop( const IPoint& );
  119.  
  120. private:
  121.     IEmbeddedComponent&     operator=( const IEmbeddedComponent& );
  122.  
  123.     enum Version { kOriginalVersion };
  124.  
  125.     IRectangle              fArea;
  126.     IComponent::EAspect     fAspect;
  127.     unsigned short          fNumber; // A unique number for this component
  128.     IGrabHandles*           fpGrabHandles;
  129.     IGUIBundle*             fpBundle;
  130.   
  131.     IEmbeddedComponentImp*  fpImplementation;
  132.     IPoint                  ftDragMouseOffset;
  133.     
  134. };
  135.  
  136.  
  137. /*******************************************************************************
  138. *                                                                              *
  139. *                           IEmbedderModel                                     *
  140. *                                                                              *
  141. *******************************************************************************/
  142.  
  143. class IEmbedderModel : public IModel
  144. {
  145. public:
  146.     
  147. /*---------------------- Construction/Destruction ----------------------------*/
  148.  
  149.                             IEmbedderModel();
  150.                             IEmbedderModel( const IEmbedderModel& );
  151.     virtual                 ~IEmbedderModel();
  152.  
  153.     
  154. /*------------------------- IModel Overrides ---------------------------------*/
  155.  
  156.     virtual void            attachTo( IComponent& );
  157.     virtual Boolean         hasChanged() const;
  158.  
  159.     
  160. /*-------------------- Embedded Component management -------------------------*/
  161.  
  162.     typedef ISequence< IElemPointer<IEmbeddedComponent> > ComponentList;
  163.  
  164.     const ComponentList&    componentList() const;
  165.     IEmbeddedComponent*     selectedComponent() const;
  166.     virtual void            selectComponent( IEmbeddedComponent* );
  167.     virtual void            adopt( IEmbeddedComponent* );
  168.     virtual IEmbeddedComponent* orphan( IEmbeddedComponent& );
  169.     virtual void            deleteAll();
  170.  
  171.     // Subclasses can override this method to create custom EmbeddedComponents
  172.     // this method creates an IEmbeddedComponent by default
  173.     virtual IEmbeddedComponent* createEmbeddedComponent() const;
  174.  
  175.     
  176. /*------------------------- Streaming Operators ------------------------------*/
  177.  
  178.     virtual IBaseStream&    operator>>= ( IBaseStream& ) const;
  179.     virtual IBaseStream&    operator<<= ( IBaseStream& );
  180.  
  181.  
  182. #ifdef IC_LIBRARYUSEONLY
  183.     CAswContainer*          container() const;
  184.     CAswRootContainer*      rootContainer() const;
  185.     virtual void            fileRenamed( const IString& name );
  186.     
  187.     static INotificationId  AddedComponentId;
  188.     static INotificationId  RemovedComponentId;
  189.     static INotificationId  ComponentAreaChangedId;
  190.  
  191.     TypeExtensionDeclarationsMacro(IEmbedderModel)
  192. #endif
  193.     
  194. private:
  195.     IEmbedderModel&         operator=( const IEmbedderModel& );
  196.     
  197.     enum Version { kOriginalVersion };
  198.     
  199.     // List of all the embedded components in this model
  200.     ComponentList           fComponentList;
  201.     IEmbeddedComponent*     fpSelectedComponent;
  202.  
  203.     CAswContainer*          fpContainer;
  204.     CAswRootContainer*      fpRootContainer; // either == fpContainer or NULL
  205.     
  206.     
  207. }; // class IEmbedderModel
  208.  
  209.  
  210.   #include <iembmod.inl>
  211.  
  212.  
  213. #pragma pack()
  214.  
  215.  
  216. #endif // _IEMBMOD_
  217.