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

  1. #ifndef _IVBCNR_
  2.   #define _IVBCNR_
  3. /*******************************************************************************
  4. * FILE NAME: ivbcnr.h                                                          *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IVBContainerControl                                                      *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18.  
  19. #include <icnrctl.hpp>
  20. #include <icnrobj.hpp>
  21.  
  22. #include <icolobsv.hpp>
  23. #include <irect.hpp>
  24. #include <inotify.hpp>
  25. #include <ivseq.h>
  26. #include <iexcbase.hpp>
  27.  
  28.  
  29. class IString;
  30. class IWindowHandle;
  31. template < class Element, class ViewClass, class Collection > class IVBContainerControlData;
  32. template < class Element > class IVSequence;
  33.  
  34.  
  35. #pragma implementation("ivbcnr.c")
  36. #pragma pack(4)
  37.  
  38.  
  39. template <class Element, class Collection, class CnrElement>
  40.   class IVBContainerControl : public IContainerControl {
  41.  
  42. typedef IContainerControl
  43.   Inherited;
  44.  
  45. #pragma define(ICollectionObserver<Element,IVBContainerControl<Element,Collection,CnrElement>,Collection>)
  46.  
  47. public:
  48. /*------------------------- Constructors -------------------------------------*/
  49.   IVBContainerControl ( unsigned long                       identifier,
  50.                         IWindow*                            parent,
  51.                         IWindow*                            owner,
  52.                         const IRectangle&                   initial   =
  53.                            IRectangle                         ( ),
  54.                         const IContainerControl::Style&     style     =
  55.                            IContainerControl::defaultStyle    ( ),
  56.                         const IContainerControl::Attribute& attribute =
  57.                            IContainerControl::defaultAttribute( ) );
  58.  
  59.   IVBContainerControl ( unsigned long                identifier,
  60.                         IWindow*                     parent   );
  61.  
  62.   IVBContainerControl ( const IWindowHandle&         handle   );
  63.  
  64. virtual
  65.  ~IVBContainerControl ( );
  66.  
  67. /*------------------------- Collection ---------------------------------------*/
  68. virtual Collection
  69.  *items                  ( ) const;
  70.  
  71. virtual IVBContainerControl<Element,Collection,CnrElement>
  72.  &setItems               ( Collection* collection );
  73.  
  74. /*------------------------- Collection-Reporting Protocol --------------------*/
  75. virtual IVBContainerControl<Element,Collection,CnrElement>
  76.  &elementChanged         ( unsigned long   position,
  77.                            const Element&  element  ),
  78.  &elementAdded           ( unsigned long   position,
  79.                            const Element&  element  ),
  80.  &elementDeleted         ( unsigned long   position ),
  81.  &elementsChanged        ( ),
  82.  &collectionReplaced     ( );
  83.  
  84. /*------------------------- Removing Objects ---------------------------------*/
  85. virtual IVBContainerControl<Element,Collection,CnrElement>
  86.  &removeSelectedElements     ( const Boolean deleteElements = true ),
  87.  &removeButton2Elements      ( const Boolean deleteElements = true ),
  88.  &removeAllElements          ( const Boolean deleteElements = true );
  89.  
  90. /*------------------------- Selection ----------------------------------------*/
  91. static const unsigned long
  92.   noSelection;
  93.  
  94. virtual IVBContainerControl<Element,Collection,CnrElement>
  95.  &select                      ( unsigned long   collectionPosition,
  96.                                 Boolean         select = true ),
  97.  &deselect                    ( unsigned long   collectionPosition );
  98.  
  99. virtual Element
  100.   selectedElement             ( ),
  101.   button2Element              ( ),
  102.   cursoredElement             ( );
  103.  
  104. virtual CnrElement
  105.  *selectedCnrObject           ( );
  106.  
  107. virtual unsigned long
  108.   selectedCollectionPosition  ( ),
  109.   button2CollectionPosition   ( ),
  110.   cursoredCollectionPosition  ( );
  111.  
  112. virtual IVSequence<Element>
  113.  *selectedElements            ( ),
  114.  *selectedElements            ( IVSequence<Element> & aSequence),           //compatibility
  115.  *selectedElements            ( IVSequence<Element> * aSequence),
  116.  *button2Elements             ( );
  117.  
  118. virtual IVSequence<unsigned long>
  119.  *selectedCollectionPositions ( ),
  120.  *selectedCollectionPositions ( IVSequence<unsigned long> * aSequence ),
  121.  *button2CollectionPositions  ( );
  122.  
  123. virtual IVSequence<IContainerObject *>
  124.  *selectedCnrObjects          ( ),
  125.  *selectedCnrObjects          ( IVSequence<IContainerObject *> & cnrObjects ),   //compatibility
  126.  *selectedCnrObjects          ( IVSequence<IContainerObject *> * cnrObjects ),
  127.  *button2CnrObjects           ( );
  128.  
  129. unsigned long
  130.   numberOfSelections          ( ) const,
  131.   numberOfButton2Objects       ( ) const;
  132.  
  133. virtual IVBContainerControl<Element,Collection,CnrElement>
  134.  &setButton2Point(const IPoint & aPoint);
  135.  
  136. virtual IPoint
  137.  button2Point() const;
  138.  
  139. /*------------------------- Notification Members -----------------------------*/
  140. static INotificationId const
  141.   button2PointId,
  142.   itemChangedId,
  143.   itemsId;
  144.  
  145. private:
  146. /*------------------------- Hidden Members -----------------------------------*/
  147.   IVBContainerControl
  148.              ( const IVBContainerControl< Element,Collection,CnrElement >& source );
  149. IVBContainerControl<Element,Collection,CnrElement>
  150.  &operator=  ( const IVBContainerControl< Element,Collection,CnrElement >& source );
  151.  
  152. /*------------------------- Private ------------------------------------------*/
  153. IVBContainerControlData< Element,
  154.                          IVBContainerControl<Element,Collection,CnrElement>,
  155.                          Collection>
  156.  *fVBContainerControlData;
  157.  
  158. void
  159.   initialize ( );
  160.  
  161. static const unsigned long
  162.   firstItem;
  163.  
  164. }; // IVBContainerControl<Element,Collection,CnrElement>
  165.  
  166.  
  167. class IVBContainerObject : public IContainerObject {
  168. public:
  169.   IVBContainerObject       ( const IString&         string,
  170.                              const IPointerHandle&  iconHandle = 0 );
  171.  
  172. IVBContainerObject
  173.  &operator=                ( const IVBContainerObject&  aObject );
  174.  
  175. virtual IVBContainerObject
  176.  &refreshFromObject        ( ) { return *this; }
  177. virtual IVBContainerObject
  178.  &updateToObject           ( ) { return *this; }
  179.  
  180. IString
  181.   asString                 ( ) const;
  182.  
  183. };  // IVBContainerObject
  184.  
  185. #if ! defined (__TEMPINC__)
  186. #include <ivbcnr.c>
  187. #endif
  188.  
  189. #pragma pack()
  190.  
  191. #endif  /*  _IVBCNR_  */
  192.