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

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