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

  1. /******************************************************************************
  2. * .FILE:         dmsamp3.hpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION:  Direct Manipulation Sample Program 3: Class Definitions      *
  5. *                                                                             *
  6. * .CLASSES:      MyWindow                                                     *
  7. *                MySourceWin                                                  *
  8. *                MyTargetWin                                                  *
  9. *                Customer                                                     *
  10. *                                                                             *
  11. * .COPYRIGHT:                                                                 *
  12. *    Licensed Material - Program-Property of IBM                              *
  13. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  14. *                                                                             *
  15. * .DISCLAIMER:                                                                *
  16. *   The following [enclosed] code is sample code created by IBM               *
  17. *   Corporation.  This sample code is not part of any standard IBM product    *
  18. *   and is provided to you solely for the purpose of assisting you in the     *
  19. *   development of your applications.  The code is provided 'AS IS',          *
  20. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  21. *   arising out of your use of the sample code, even if they have been        *
  22. *   advised of the possibility of such damages.                               *
  23. *                                                                             *
  24. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  25. *                                                                             *
  26. ******************************************************************************/
  27. #include <iframe.hpp>
  28. #include <ititle.hpp>
  29. #include <icnr.hpp>
  30. #include <idmhndlr.hpp>
  31.  
  32. #include "dmsamp3.h"
  33.  
  34. class MyWindow;
  35.  
  36.  
  37. class Customer : public IContainerObject {
  38. /*******************************************************************************
  39. * Objects of this class are used to show direct manipulation support for       *
  40. * containers.  Instances of this object are created to allow demonstrations    *
  41. * of moves and copies of this object between intra-process containers.         *
  42. *******************************************************************************/
  43. public:
  44. friend class IContainerColumn;
  45. friend class MyWindow;
  46.  
  47. /*-------------------------- Constructors/Destructor ---------------------------
  48. | Objects of this class are constructed by providing the following:            |
  49. |   o A reference to a customer object (a copy constructor)                    |
  50. |   o A IString for the icon text, an icon resource id, an IString for the     |
  51. |     customer name, address, and phone number, and a pointer to a MyWindow    |
  52. |     object                                                                   |
  53. ------------------------------------------------------------------------------*/
  54.   Customer  ( const Customer &cnrobj );
  55.  
  56.   Customer  ( const IString  &iconText,
  57.               unsigned long  iconID,
  58.               const IString  &name,
  59.               const IString  &address,
  60.               const IString  &phone,
  61.               MyWindow       *window );
  62.  
  63.   ~Customer ( ) {};
  64.  
  65. /*-------------------------------- Accessors -----------------------------------
  66. | Instances of the Customer class have attributes that can be accessed by the  |
  67. | following functions:                                                         |
  68. |   name       - Returns the customer name                                     |
  69. |   address    - Returns the customer address.                                 |
  70. |   phone      - Returns the customer phone number.                            |
  71. |   setName    - Sets the customer name.                                       |
  72. |   setAddress - Sets the customer address.                                    |
  73. |   setPhone   - Sets the customer phone number.                               |
  74. ------------------------------------------------------------------------------*/
  75.   IString name    ( ) const  { return this->strName; }
  76.   IString address ( ) const  { return this->strAddress; }
  77.   IString phone   ( ) const  { return this->strPhone; }
  78.  
  79.   void setName    ( const IString &name )     { this->strName = name; }
  80.   void setAddress ( const IString &address )  { this->strAddress = address; }
  81.   void setPhone   ( const IString &phone )    { this->strPhone = phone; }
  82.  
  83. /*-------------------------------- Overrides -----------------------------------
  84. | The following function overrides the objectCopy function defined in the      |
  85. | base IContainerObject class:                                                 |
  86. |  objectCopy - Called when it is necessary to make a copy of the Customer     |
  87. |               object.  This is invoked when IContainerControl::copyObjectTo  |
  88. |               is called.                                                     |
  89. ------------------------------------------------------------------------------*/
  90.   IContainerObject* objectCopy( );
  91.  
  92. private:
  93.   IString   strName,
  94.             strAddress,
  95.             strPhone;
  96.   MyWindow  *myWin;
  97. };
  98.  
  99.  
  100. class MyWindow : public IFrameWindow {
  101. /*******************************************************************************
  102. * This is the common base class for the demo source window class, MySourceWin, *
  103. * and the demo target window class, MyTargetWin.                               *
  104. *******************************************************************************/
  105. friend class Customer;
  106.  
  107. public:
  108. /*-------------------------- Constructor/Destructor ----------------------------
  109. | Objects of this class are constructed by providing the following:            |
  110. |   o A window ID                                                              |
  111. ------------------------------------------------------------------------------*/
  112.   MyWindow  ( unsigned long windowId );
  113.   ~MyWindow ( ) {};
  114.  
  115. protected:
  116.   IContainerControl *cnrCtl;
  117.   Customer          *car,
  118.                     *space,
  119.                     *bolt,
  120.                     *starfleet;
  121.   IResourceLibrary  reslib;
  122. };
  123.  
  124.  
  125. class MySourceWin : public MyWindow {
  126. /*******************************************************************************
  127. * This is the demo source window class.                                        *
  128. *******************************************************************************/
  129. public:
  130. /*------------------------------ Constructor -----------------------------------
  131. | Objects of this class are constructed by providing the following:            |
  132. |   o A window ID                                                              |
  133. ------------------------------------------------------------------------------*/
  134.   MySourceWin ( unsigned long windowId );
  135. };
  136.  
  137. class MyTargetWin : public MyWindow {
  138. /*******************************************************************************
  139. * This is the demo source window class.                                        *
  140. *******************************************************************************/
  141. public:
  142. /*------------------------------ Constructor -----------------------------------
  143. | Objects of this class are constructed by providing the following:            |
  144. |   o A window ID                                                              |
  145. ------------------------------------------------------------------------------*/
  146.   MyTargetWin ( unsigned long windowId );
  147. };
  148.  
  149.