home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / RAPSHEET / SUSCNRMF.CPV < prev    next >
Text File  |  1995-05-12  |  5KB  |  134 lines

  1. //****************************************************************************
  2. // Additional Member Functions for ISuspectCnrView - (suscnrmf.cpp)          *
  3. //                                                                           *
  4. // COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
  5. //                                                                           *
  6. // DISCLAIMER OF WARRANTIES:                                                 *
  7. //   The following [enclosed] code is sample code created by IBM             *
  8. //   Corporation.  This sample code is not part of any standard IBM product  *
  9. //   and is provided to you solely for the purpose of assisting you in the   *
  10. //   development of your applications.  The code is provided "AS IS",        *
  11. //   without warranty of any kind.  IBM shall not be liable for any damages  *
  12. //   arising out of your use of the sample code, even if they have been      *
  13. //   advised of the possibility of such damages.                             *
  14. //****************************************************************************
  15. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  16. //
  17.  
  18. #ifndef _ITRACE_
  19. #include <itrace.hpp>
  20. #endif
  21.  
  22. #ifndef _IVSEQ_
  23. #include <ivseq.h>
  24. #endif
  25.  
  26. #ifndef _ICNROLST_
  27. #include <icnrolst.hpp>
  28. #endif
  29.  
  30. //***************************************************************************
  31. // Additional events for ISuspectCnrView
  32. //***************************************************************************
  33. INotificationId ISuspectCnrView::suspectToOpenId = "ISuspectCnrView::suspectToOpen";
  34.  
  35.  
  36. //***************************************************************************
  37. // Additional member functions for ISuspectCnrView
  38. //***************************************************************************
  39. /*------------------------------------------------------------------------------
  40.  | ISuspectCnrView deselectAllSuspects(IVBContainerControl &)
  41.  -----------------------------------------------------------------------------*/
  42. ISuspectCnrView & ISuspectCnrView :: deselectAllSuspects(
  43.    IVBContainerControl< ISuspect *, 
  44.                         IVSequence<ISuspect *>,
  45.                         ISuspectCnrViewSuspectCnrCnrObj > & aSuspectCnr)
  46. {
  47.    IFUNCTRACE_DEVELOP();
  48.    try 
  49.    {
  50.       ICnrObjectSet CnrObjs = aSuspectCnr.objectList();
  51.       ICnrObjectSet::Cursor aCursor(CnrObjs);
  52.       int i=1;
  53.       forCursor(aCursor)
  54.       {
  55.          if (aSuspectCnr.isSelected(CnrObjs.elementAt(aCursor)))
  56.             aSuspectCnr.deselect(i);
  57.          i++;
  58.       }
  59.    }
  60.    catch (IException& exc) {};
  61.    return *this;
  62. }
  63.  
  64. /*------------------------------------------------------------------------------
  65.  | ISuspectCnrView openTargetSuspects(IVBContainerControl &, IVSequence &)
  66.  -----------------------------------------------------------------------------*/
  67. ISuspectCnrView & ISuspectCnrView :: openTargetSuspects(
  68.    IVSequence<ISuspect *> & aSuspectCollection)
  69. {
  70.    IFUNCTRACE_DEVELOP();
  71.    try 
  72.    {
  73.       ITRACE_DEVELOP("The number of elements to open: " +
  74.                      IString(aSuspectCollection.numberOfElements()));
  75.       IVSequence<ISuspect *>::Cursor aCursor(aSuspectCollection);
  76.       forCursor(aCursor)
  77.       {
  78.          setSuspectToOpen(aSuspectCollection.elementAt(aCursor));
  79.       }
  80.    }
  81.    catch (IException& exc) {};
  82.    return *this;
  83. }
  84.  
  85. /*------------------------------------------------------------------------------
  86.  | ISuspectCnrView selectAllSuspects(IVBContainerControl &)
  87.  -----------------------------------------------------------------------------*/
  88. ISuspectCnrView & ISuspectCnrView :: selectAllSuspects(
  89.    IVBContainerControl< ISuspect *, 
  90.                         IVSequence<ISuspect *>,
  91.                         ISuspectCnrViewSuspectCnrCnrObj > & aSuspectCnr)
  92. {
  93.    IFUNCTRACE_DEVELOP();
  94.    try 
  95.    {
  96.       ICnrObjectSet CnrObjs = aSuspectCnr.objectList();
  97.       ICnrObjectSet::Cursor aCursor(CnrObjs);
  98.       int i=1;
  99.       forCursor(aCursor)
  100.       {
  101.          if (!aSuspectCnr.isSelected(CnrObjs.elementAt(aCursor)))
  102.             aSuspectCnr.select(i);
  103.          i++;
  104.       }
  105.    }
  106.    catch (IException& exc) {};
  107.    return *this;
  108. }
  109.  
  110. //***************************************************************************
  111. // Access member functions for additional data members for ISuspectCnrView
  112. //***************************************************************************
  113. /*------------------------------------------------------------------------------
  114.  | ISuspect * suspectToOpen() const
  115.  -----------------------------------------------------------------------------*/
  116. ISuspect * ISuspectCnrView::suspectToOpen() const
  117. {
  118.   return iSuspectToOpen;
  119. }
  120.  
  121. /*------------------------------------------------------------------------------
  122.  | ISuspectCnrView & setSuspectToOpen(ISuspect *) const
  123.  -----------------------------------------------------------------------------*/
  124. ISuspectCnrView & ISuspectCnrView::setSuspectToOpen(ISuspect * aSuspect)
  125. {
  126.   if (iSuspectToOpen != aSuspect)
  127.   {
  128.     iSuspectToOpen = aSuspect;
  129.   } 
  130.   /* always fire the event */
  131.   notifyObservers(INotificationEvent(ISuspectCnrView::suspectToOpenId, *this));
  132.   return *this;
  133. }
  134.