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

  1. /******************************************************************************
  2. * .FILE:         dmsamp3.hpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION:  Direct Manipulation Sample Program 4: Class definitions      *
  5. *                                                                             *
  6. * .CLASSES:      Customer                                                     *
  7. *                MyWindow                                                     *
  8. *                MySourceWin                                                  *
  9. *                MyTargetWin                                                  *
  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. |   iconId     - Returns the custmoer's icon id.                               |
  72. |   setName    - Sets the customer name.                                       |
  73. |   setAddress - Sets the customer address.                                    |
  74. |   setPhone   - Sets the customer phone number.                               |
  75. ------------------------------------------------------------------------------*/
  76.   IString name    ( ) const  { return this->strName; }
  77.   IString address ( ) const  { return this->strAddress; }
  78.   IString phone   ( ) const  { return this->strPhone; }
  79.   unsigned long iconId ( ) const { return this->ulIconId; }
  80.  
  81.   void setName    ( const IString &name )     { this->strName = name; }
  82.   void setAddress ( const IString &address )  { this->strAddress = address; }
  83.   void setPhone   ( const IString &phone )    { this->strPhone = phone; }
  84.  
  85. /*-------------------------------- Overrides -----------------------------------
  86. | The following function overrides the objectCopy function defined in the      |
  87. | base IContainerObject class:                                                 |
  88. |  objectCopy - Called when it is necessary to make a copy of the Customer     |
  89. |               object.  This is invoked when IContainerControl::copyObjectTo  |
  90. |               is called.                                                     |
  91. ------------------------------------------------------------------------------*/
  92.   IContainerObject* objectCopy( );
  93.  
  94. private:
  95.   IString   strName,
  96.             strAddress,
  97.             strPhone;
  98.   unsigned long ulIconId;
  99.   MyWindow  *myWin;
  100. };
  101.  
  102.  
  103. class MyWindow : public IFrameWindow {
  104. /*******************************************************************************
  105. * This is the common base class for the demo source window class, MySourceWin, *
  106. * and the demo target window class, MyTargetWin.                               *
  107. *******************************************************************************/
  108. friend class Customer;
  109.  
  110. public:
  111. /*-------------------------- Constructor/Destructor ----------------------------
  112. | Objects of this class are constructed by providing the following:            |
  113. |   o A window ID                                                              |
  114. ------------------------------------------------------------------------------*/
  115.   MyWindow  ( unsigned long windowId );
  116.   ~MyWindow ( ) {};
  117.  
  118. protected:
  119.   IContainerControl *cnrCtl;
  120.   Customer          *car,
  121.                     *space,
  122.                     *bolt,
  123.                     *starfleet;
  124.   IResourceLibrary  reslib;
  125. };
  126.  
  127.  
  128. class MySourceWin : public MyWindow {
  129. /*******************************************************************************
  130. * This is the demo source window class.                                        *
  131. *******************************************************************************/
  132. public:
  133. /*------------------------------ Constructor -----------------------------------
  134. | Objects of this class are constructed by providing the following:            |
  135. |   o A window ID                                                              |
  136. ------------------------------------------------------------------------------*/
  137.   MySourceWin ( unsigned long windowId );
  138. };
  139.  
  140. class MyTargetWin : public MyWindow {
  141. /*******************************************************************************
  142. * This is the demo source window class.                                        *
  143. *******************************************************************************/
  144. public:
  145. /*------------------------------ Constructor -----------------------------------
  146. | Objects of this class are constructed by providing the following:            |
  147. |   o A window ID                                                              |
  148. ------------------------------------------------------------------------------*/
  149.   MyTargetWin ( unsigned long windowId );
  150. };
  151.  
  152.