home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / acdf5 / acdfmdl5.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  2.6 KB  |  79 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //                      SAMPLE CODE
  3. //
  4. // FileName: ACDFMdl5.hpp
  5. //
  6. // ClassName: ACompDocFwkModel
  7. //
  8. // Description: Compound Document Framework Header file for the Model Class
  9. //              This sample demonstrates the use of streaming collection class.
  10. //              A collection of the TPerson is created depending on the screen
  11. //              selection in the view.
  12. //              This sample show how to use both the ISequence collection class
  13. //              and the IKeySet collection class
  14. //              There are also 2 different types of notification messages sent 
  15. //              to the view depending on what is changed.
  16. ///////////////////////////////////////////////////////////////////////////////
  17. #ifndef _COMPDOCFWK_MODEL_
  18. #define _COMPDOCFWK_MODEL_
  19.  
  20. #ifdef IC_TRACE_DEVELOP
  21.     #include <itrace.hpp>
  22. #else
  23.     #define IFUNCTRACE_DEVELOP()
  24.     #define ITRACE_DEVELOP(x)
  25. #endif
  26.  
  27. #include <inotifev.hpp>
  28.  
  29. #include <imodel.hpp>
  30. #include <iseq.h>
  31. #include <ikeyset.h>
  32. #include <iptr.h>
  33. #include "ACDFPsn5.hpp"
  34.  
  35. class ACompDocFwkModel : public IModel  // Inherit from IModel
  36. {
  37. public:
  38.     TypeExtensionDeclarationsMacro(ACompDocFwkModel)
  39.     typedef ISequence< IElemPointer<TPerson> >   PersonList;
  40.     typedef IKeySet<TPerson, IString >           PersonKeyList;
  41.  
  42.     static const INotificationId kListChanged;   // When element is add to the list
  43.     static const INotificationId kSelectionChanged; // When the current selection changes 
  44.  
  45.     enum CollectionType     { kSeq, kKey } ;
  46.  
  47.                             ACompDocFwkModel();
  48.     virtual                 ~ACompDocFwkModel();
  49.     
  50.     virtual IBaseStream&    operator>>=( IBaseStream& towhere ) const;
  51.     virtual IBaseStream&    operator<<=( IBaseStream& fromwhere );
  52.  
  53.     void                    addToList(TPerson&);
  54.     void                    deleteFromList(TPerson&);
  55.  
  56.     TPerson                 getPersonFirstList();
  57.     TPerson                 getPersonNextList();
  58.     TPerson                 getPersonList(long,IString);
  59.     TPerson                 getSelectedPerson();
  60.  
  61.     void                    setCollectionType(CollectionType myType);
  62.  
  63. protected:
  64.                             ACompDocFwkModel( const ACompDocFwkModel&);
  65.  
  66. private:
  67.     enum                    { kOriginalVersion };
  68.     ACompDocFwkModel&       operator=(const ACompDocFwkModel&);
  69.  
  70.     CollectionType          fType;
  71.     PersonList              fPersonList;
  72.     PersonKeyList           fPersonKeyList;
  73.     TPerson                 fSelectedPerson;
  74.  
  75.     ICursor*                fCursor;
  76. };
  77.  
  78. #endif
  79.