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

  1. /*******************************************************************************
  2. * FILE NAME: ivbvprt.c                                                         *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Class implementation of the class(es):                                     *
  6. *    IVBVariablePart - Variable template class for parts.                      *
  7. *                                                                              *
  8. * COPYRIGHT:                                                                   *
  9. *   IBM(R) VisualAge(TM) for C++                                               *
  10. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  11. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  12. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  13. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  14. *******************************************************************************/
  15.  
  16. #ifndef _IVBVPRT_
  17.   #include <ivbvprt.h>
  18. #endif
  19.  
  20. #ifndef _INOTIFEV_
  21.   #include <inotifev.hpp>
  22. #endif
  23.  
  24. #include <ivbdefs.h>
  25.  
  26. /*------------------------------------------------------------------------------
  27. | IVBVariablePart <Element>::IVBVariablePart                                   |
  28. |                                                                              |
  29. | Standard constructor.                                                        |
  30. ------------------------------------------------------------------------------*/
  31. template < class Element >
  32. IVBVariablePart <Element>::IVBVariablePart ()
  33.   : IVBVariablePartBase ()
  34. {
  35.   iTarget.enableNotification();
  36.   handleNotificationsFor (iTarget);
  37. }
  38.  
  39. /*------------------------------------------------------------------------------
  40. | IVBVariablePart <Element>::~IVBVariablePart                                  |
  41. |                                                                              |
  42. | Standard destructor.                                                         |
  43. ------------------------------------------------------------------------------*/
  44. template < class Element >
  45. IVBVariablePart <Element>::~IVBVariablePart ()
  46. {
  47.   stopHandlingNotificationsFor (iTarget);
  48. }
  49.  
  50. /*------------------------------------------------------------------------------
  51. | IVBVariablePart <Element>::target                                            |
  52. |                                                                              |
  53. | Returns the target attribute.                                                |
  54. ------------------------------------------------------------------------------*/
  55. template < class Element >
  56. Element& IVBVariablePart <Element>::target ()
  57. {
  58.   return iTarget;
  59. }
  60.  
  61. /*------------------------------------------------------------------------------
  62. | IVBVariablePart <Element>::targetPtr                                         |
  63. |                                                                              |
  64. | Returns the target attribute.                                                |
  65. ------------------------------------------------------------------------------*/
  66. template < class Element >
  67. Element* IVBVariablePart <Element>::targetPtr ()
  68. {
  69.   return &iTarget;
  70. }
  71.  
  72. /*------------------------------------------------------------------------------
  73. | IVBVariablePart <Element>::setTarget                                         |
  74. |                                                                              |
  75. | Sets the target attribute.                                                   |
  76. ------------------------------------------------------------------------------*/
  77. template < class Element >
  78. IVBVariablePart <Element>& IVBVariablePart <Element>::setTarget
  79.   (Element newTarget)
  80. {
  81.   stopHandlingNotificationsFor (iTarget);
  82.   iTarget = newTarget;
  83.   iTarget.enableNotification();
  84.   handleNotificationsFor (iTarget);
  85.   notifyObservers(INotificationEvent(VBINITIALIZEID, *this));
  86.   notifyObservers(INotificationEvent(targetId, *this));
  87.   return *this;
  88. }
  89.  
  90. /*------------------------------------------------------------------------------
  91. | IVBVariablePart <Element>::setTarget                                         |
  92. |                                                                              |
  93. | Sets the target attribute.                                                   |
  94. ------------------------------------------------------------------------------*/
  95. template < class Element >
  96. IVBVariablePart <Element>& IVBVariablePart <Element>::setTarget
  97.   (Element* newTarget)
  98. {
  99.   return setTarget(*newTarget);
  100. }
  101.