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

  1. /******************************************************************************
  2. * .FILE:         lacct.hpp                                                    *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Definition       *
  5. *                                                                             *
  6. * .CLASSES:      AccountPage                                                  *
  7. *                AcctCnrObj                                                   *
  8. *                                                                             *
  9. * .COPYRIGHT:                                                                 *
  10. *    Licensed Material - Program-Property of IBM                              *
  11. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  12. *                                                                             *
  13. * .DISCLAIMER:                                                                *
  14. *   The following [enclosed] code is sample code created by IBM               *
  15. *   Corporation.  This sample code is not part of any standard IBM product    *
  16. *   and is provided to you solely for the purpose of assisting you in the     *
  17. *   development of your applications.  The code is provided 'AS IS',          *
  18. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  19. *   arising out of your use of the sample code, even if they have been        *
  20. *   advised of the possibility of such damages.                               *
  21. *                                                                             *
  22. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  23. *                                                                             *
  24. ******************************************************************************/
  25. #ifndef _LACCT_
  26. #define _LACCT_
  27.  
  28. #include <icnrctl.hpp>
  29. #include <icnrcol.hpp>
  30. #include <imcelcv.hpp>
  31. #include <ientryfd.hpp>
  32. #include <icmdhdr.hpp>
  33. #include <istring.hpp>
  34. #include <istattxt.hpp>
  35. #include <imsgbox.hpp>
  36. #include <inotebk.hpp>
  37. #include <iselhdr.hpp>
  38.  
  39. #include "ldbase.hpp"
  40. #include "lpagectl.hpp"
  41.  
  42. /******************************************************************************
  43. * Class AcctCnrObj - Account container object.                                *
  44. ******************************************************************************/
  45. class AcctCnrObj : public IContainerObject
  46. {
  47.    public:
  48.  
  49. /*------------------------ Constructors/Destructor ----------------------------
  50. | Construct the object given a user ID and node.                              |
  51. -----------------------------------------------------------------------------*/
  52.       AcctCnrObj( const IString& stCurrentUserId,
  53.                   const IString& stNodeSystem );
  54.       ~AcctCnrObj();
  55.  
  56. /*------------------------------- Accessors -----------------------------------
  57. | These functions provide a means of getting and setting the accessible        |
  58. | attributes of instances of this class:                                       |
  59. |   getUserId           - Returns the user ID.                                 |
  60. |   getNode             - Returns the node.                                    |
  61. |   setUserId           - Sets the user ID.                                    |
  62. |   setNode             - Sets the node.                                       |
  63. |   currentUserIdOffset - Returns the container offset for the user ID.        |
  64. |   nodeSysOffset       - Returns the container offset for the node/system.    |
  65. -----------------------------------------------------------------------------*/
  66.       inline IString
  67.          getUserId() const { return ( currentUserId ); };
  68.       inline IString
  69.          getNode() const { return ( nodeSystem ); };
  70.  
  71.       inline AcctCnrObj
  72.         &setUserId( const IString& uid ) { currentUserId=uid; return *this; };
  73.       inline AcctCnrObj
  74.         &setNode( const IString& node ) { nodeSystem=node; return *this; };
  75.  
  76.       inline unsigned long
  77.          currentUserIdOffset() { return offsetof( AcctCnrObj, currentUserId ); };
  78.       inline unsigned long
  79.          nodeSysOffset() { return offsetof( AcctCnrObj, nodeSystem ); };
  80.  
  81.    private:
  82.  
  83.       IString
  84.          currentUserId,
  85.          nodeSystem;
  86. };
  87.  
  88.  
  89. /******************************************************************************
  90. * Class AccountPage - Account page.                                           *
  91. ******************************************************************************/
  92. class AccountPage : public IMultiCellCanvas,
  93.                     public ICommandHandler
  94. {
  95.    public:
  96.       friend class QueryAcct;
  97.  
  98. /*------------------------ Constructors/Destructor ----------------------------
  99. | Construct the object in one of two ways:                                    |
  100. | 1) IWindow*, IString.                                                       |
  101. | 2) IWindow*, LQueryData.                                                    |
  102. -----------------------------------------------------------------------------*/
  103.       AccountPage( IWindow* pParent,
  104.                    const IString& theKey = NULL );
  105.       AccountPage( IWindow* pParent,
  106.                    LQueryData& qd );
  107.       ~AccountPage();
  108.  
  109. /*------------------------ Database Functions ---------------------------------
  110. | These functions are used to save data to the database:                      |
  111. |   verifyAndSave       - Verify the page data and save to the database.      |
  112. -----------------------------------------------------------------------------*/
  113.       Boolean
  114.          verifyAndSave( IString& pString,
  115.                         IString& theEntry,
  116.                         const IString saveName = NULL );
  117.  
  118. /*------------------------------ Accessors ------------------------------------
  119. | These functions provide a means of getting and setting the accessible       |
  120. | attributes of instances of this class:                                      |
  121. |   pageSettings        - Return the page settings for this page.             |
  122. |   key                 - Return the key.                                     |
  123. -----------------------------------------------------------------------------*/
  124.       inline INotebook::PageSettings
  125.          pageSettings() { return thePageSettings; };
  126.  
  127.       inline IString
  128.          &key() { return Key; };
  129.  
  130. /*----------------------------- Page Manipulation -----------------------------
  131. | These functions provide a means of manipulating the instances of this class:|
  132. |   fillEntryfields     - Fill the entryfields for the given container object.|
  133. -----------------------------------------------------------------------------*/
  134.       AccountPage&
  135.          fillEntryfields( AcctCnrObj* cnrObject );
  136.  
  137.  
  138.    protected:
  139.  
  140. /*----------------------------- Event Processing ------------------------------
  141. | Handle and process events:                                                  |
  142. |   command             - Process command events.                             |
  143. |   handleIt            - Start handling events.                              |
  144. -----------------------------------------------------------------------------*/
  145.       Boolean
  146.          command( ICommandEvent& event );
  147.  
  148.       AccountPage
  149.          &handleIt();
  150.  
  151.    private:
  152.  
  153.       AccountPage
  154.          &setCells(),
  155.          &fillCnr(),
  156.          &unMark();
  157.  
  158.       Boolean
  159.          addAcct( IString& userId, IString& node ),
  160.          changeAcct( IString& userId, IString& node, AcctCnrObj* pCnrObj ),
  161.          setAcctData();
  162.  
  163.       PageButtons
  164.          pageButtons;
  165.  
  166.       PageCnrButtons
  167.          pageCnrButtons;
  168.  
  169.       IStaticText
  170.          userIdText,
  171.          nodeSysText;
  172.  
  173.       IEntryField
  174.          userId,
  175.          nodeSys;
  176.  
  177.       IContainerControl
  178.         *pCnr;
  179.  
  180.       AcctCnrObj
  181.         *pAcctCnrObj;
  182.  
  183.       IContainerColumn
  184.         *pColUserID,
  185.         *pColNodeSys;
  186.  
  187.       LAcctData
  188.          acctData,
  189.          origAcctData;
  190.  
  191.       IString
  192.          Key;
  193.  
  194.       Boolean
  195.          isAquery;
  196.  
  197.       INotebook::PageSettings
  198.          thePageSettings;
  199.  
  200.       PageCnrSelHandler
  201.          cnrSelHandler;
  202.  
  203. };
  204. #endif
  205.