home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / LANCELOT / LPROJECT.HPP < prev    next >
C/C++ Source or Header  |  1995-04-01  |  9KB  |  244 lines

  1. /*******************************************************************************
  2. * FILE NAME: lproject.hpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *                                                                              *
  6. * Classes                                                                      *
  7. *   ProjectPage                                                                *
  8. *   ProjCnrObj                                                                 *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1995                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. * CHANGE HISTORY:                                                              *
  18. *******************************************************************************/
  19. #ifndef _LPROJECT_
  20. #define _LPROJECT_
  21.  
  22. #include <imcelcv.hpp>
  23. #include <icnrctl.hpp>
  24. #include <icnrcol.hpp>
  25. #include <icmdhdr.hpp>
  26. #include <imsgbox.hpp>
  27. #include <ientryfd.hpp>
  28. #include <istring.hpp>
  29. #include <icombobx.hpp>
  30. #include <icheckbx.hpp>
  31. #include <inotebk.hpp>
  32.  
  33. #include "ldbase.hpp"
  34. #include "ldbqry.hpp"
  35. #include "lpagectl.hpp"
  36.  
  37.  
  38. /******************************************************************************
  39. * Class ProjCnrObj - Project container object.                                *
  40. ******************************************************************************/
  41. class ProjCnrObj : public IContainerObject
  42. {
  43.    public: 
  44. /*------------------------ Constructors/Destructor ----------------------------
  45. | Construct the object given a project, description, manager, and active flag.|
  46. -----------------------------------------------------------------------------*/
  47.       ProjCnrObj( const IString& stProj,
  48.                   const IString& stDesc,
  49.                   const IString& stMgr,
  50.                   const IString& stAct="Yes");
  51.      ~ProjCnrObj();
  52.  
  53. /*------------------------------- Accessors -----------------------------------
  54. | These functions provide a means of getting and setting the accessible        |
  55. | attributes of instances of this class:                                       |
  56. |   proj                - Returns the project.                                 |
  57. |   desc                - Returns the description.                             |
  58. |   mgr                 - Returns the responsible manager.                     |
  59. |   act                 - Returns the active flag status.                      |
  60. |   setProj             - Sets the project.                                    |
  61. |   setDesc             - Sets the description.                                |
  62. |   setMgr              - Sets the responsible manager.                        |
  63. |   setAct              - Sets the active flag status.                         |
  64. |   projOffset          - Returns the container offset for the project.        |
  65. |   descOffset          - Returns the container offset for the description.    |
  66. |   mgrOffset           - Returns the container offset for the manager.        |
  67. |   actOffset           - Returns the container offset for the active status.  |
  68. -----------------------------------------------------------------------------*/
  69.       inline IString
  70.          proj() const { return Proj; };
  71.       inline IString
  72.          desc() const { return Desc; };
  73.       inline IString
  74.          mgr()  const { return Mgr;  };
  75.       inline IString
  76.          act()  const { return Act;  };
  77.  
  78.       inline ProjCnrObj
  79.         &setProj( const IString& pr )  { Proj=pr; return *this; };
  80.       inline ProjCnrObj
  81.         &setDesc( const IString& de ) { Desc=de; return *this; };
  82.       inline ProjCnrObj
  83.         &setMgr( const IString& m )   { Mgr=m; return *this; };
  84.       inline ProjCnrObj
  85.         &setAct( const IString& a )   { Act=a; return *this; };
  86.  
  87.       inline unsigned long
  88.          projOffset() { return offsetof( ProjCnrObj, Proj ); };
  89.       inline unsigned long
  90.          descOffset() { return offsetof( ProjCnrObj, Desc ); };
  91.       inline unsigned long
  92.          mgrOffset()  { return offsetof( ProjCnrObj, Mgr ); };
  93.       inline unsigned long
  94.          actOffset()  { return offsetof( ProjCnrObj, Act ); };
  95.  
  96.    private:
  97.  
  98.       IString
  99.          Proj,
  100.          Desc,
  101.          Mgr,
  102.          Act;
  103. };
  104.  
  105.  
  106. /******************************************************************************
  107. * Class ProjectPage - Project page.                                           *
  108. ******************************************************************************/
  109. class ProjectPage : public IMultiCellCanvas,
  110.                     public ICommandHandler
  111. {
  112.    public:
  113. /*------------------------ Constructors/Destructor ----------------------------
  114. | Construct the object in only one way:                                       |
  115. | 1) IWindow*, IString.                                                       |
  116. -----------------------------------------------------------------------------*/
  117.       ProjectPage( IWindow* pParent,
  118.                    const IString& aKey );
  119.  
  120.      ~ProjectPage();
  121.  
  122. /*------------------------ Database Functions ---------------------------------
  123. | These functions are used to save data to the database:                      |
  124. |   verifyAndSave       - Verify the page data and save to the database.      |
  125. -----------------------------------------------------------------------------*/
  126.       Boolean
  127.          verifyAndSave( IString& pString,
  128.                         IString& theEntry,
  129.                         const IString saveName = NULL );
  130.  
  131. /*------------------------------ Accessors ------------------------------------
  132. | These functions provide a means of getting and setting the accessible       |
  133. | attributes of instances of this class:                                      |
  134. |   pageSettings        - Return the page settings for this page.             |
  135. |   key                 - Return the key.                                     |
  136. |   projData            - Return the project data.                            |
  137. |   setProjectData      - Sets the project data.                              |
  138. -----------------------------------------------------------------------------*/
  139.       inline INotebook::PageSettings
  140.          pageSettings() { return thePageSettings; };
  141.  
  142.       inline IString
  143.          &key() { return Key; };
  144.  
  145.       inline LProjectData
  146.         &projData() { return projectData; };
  147.  
  148.       Boolean
  149.          setProjectData();
  150.  
  151. /*----------------------------- Page Manipulation -----------------------------
  152. | These functions provide a means of manipulating the instances of this class:|
  153. |   fillEntryfields     - Fill the entryfields for the given container object.|
  154. |   fillPage            - Fill the combobox with managers from database.      |
  155. -----------------------------------------------------------------------------*/
  156.       ProjectPage&
  157.          fillEntryfields( ProjCnrObj* cnrObject );
  158.  
  159.       ProjectPage
  160.          &fillPage();
  161.  
  162.  
  163.    protected:
  164. /*----------------------------- Event Processing ------------------------------
  165. | Handle and process events:                                                  |
  166. |   command             - Process command events.                             |
  167. |   handleIt            - Start handling events.                              |
  168. -----------------------------------------------------------------------------*/
  169.       Boolean
  170.          command( ICommandEvent& event );
  171.  
  172.       ProjectPage
  173.         &handleIt();
  174.  
  175.    private:
  176.  
  177.       ProjectPage
  178.          &setCells(),
  179.          &fillCnr();
  180.  
  181.       Boolean
  182.          addProj( IString& i1, IString& i2, IString& i3, IString& i4 ),
  183.          changeProj( IString& i1, IString& i2, IString& i3, IString& i4,
  184.                      ProjCnrObj* cnrObj );
  185.  
  186.       ProjectPage
  187.         &unMark();
  188.  
  189.       PageButtons
  190.          pageButtons;
  191.  
  192.       PageCnrButtons
  193.          pageCnrButtons;
  194.  
  195.       IStaticText
  196.          projText,
  197.          activeText,
  198.          descrText,
  199.          respMgrText;
  200.  
  201.       IEntryField
  202.          project;
  203.  
  204.       ICheckBox
  205.          active;
  206.  
  207.       IEntryField
  208.          descr;
  209.  
  210.       IComboBox
  211.          respMgr;
  212.  
  213.       IContainerControl
  214.         *pCnr;        
  215.  
  216.       ProjCnrObj
  217.         *pProjCnrObj; 
  218.  
  219.       IContainerColumn
  220.          *pColProj,
  221.          *pColDesc,
  222.          *pColMgr, 
  223.          *pColAct; 
  224.  
  225.       LProjectData
  226.          projectData,
  227.          origProjectData;
  228.  
  229.       IString
  230.          Key;
  231.  
  232.       INotebook::PageSettings
  233.          thePageSettings;
  234.  
  235.       #ifdef IC_MOTIF
  236.       LPictureVerifyHandler
  237.          alphaNumericHandler;
  238.       #endif
  239.  
  240.       PageCnrSelHandler
  241.          cnrSelHandler;
  242. };
  243. #endif
  244.