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

  1. /******************************************************************************
  2. * .FILE:         lskill.hpp                                                   *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Definition       *
  5. *                                                                             *
  6. * .CLASSES:      SkillPage                                                    *
  7. *                SkillCnrObj                                                  *
  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 _LSKILL_
  26. #define _LSKILL_
  27.  
  28. #include <icnrctl.hpp>
  29. #include <icnrcol.hpp>
  30. #include <imcelcv.hpp>
  31. #include <ientryfd.hpp>
  32. #include <icmdhdr.hpp>
  33. #include <ispinnum.hpp>
  34. #include <imsgbox.hpp>
  35. #include <inotebk.hpp>
  36.  
  37. #include "ldbase.hpp"
  38. #include "lpagectl.hpp"
  39.  
  40. /******************************************************************************
  41. * Class SkillCnrObj - Skill container object.                                 *
  42. ******************************************************************************/
  43. class SkillCnrObj : public IContainerObject
  44. {
  45.    public:
  46.  
  47. /*------------------------ Constructors/Destructor ----------------------------
  48. | Construct the object given a skill and experience.                          |
  49. -----------------------------------------------------------------------------*/
  50.       SkillCnrObj( const IString& stSkill,
  51.                    const IString& stExp );
  52.      ~SkillCnrObj();
  53.  
  54. /*------------------------------- Accessors -----------------------------------
  55. | These functions provide a means of getting and setting the accessible        |
  56. | attributes of instances of this class:                                       |
  57. |   getSkill            - Returns the skill.                                   |
  58. |   getExp              - Returns the experience.                              |
  59. |   setSkill            - Sets the skill.                                      |
  60. |   setExp              - Sets the experience.                                 |
  61. |   skillOffset         - Returns the container offset for the skill.          |
  62. |   expOffset           - Returns the container offset for the experience.     |
  63. -----------------------------------------------------------------------------*/
  64.       inline IString
  65.          getSkill() const {return (skill); };
  66.       inline IString
  67.          getExp()   const {return (exp); };
  68.  
  69.       inline SkillCnrObj
  70.         &setSkill( const IString& sk ) {skill=sk; return *this;};
  71.       inline SkillCnrObj
  72.         &setExp( const IString& ex ) {exp=ex; return *this;};
  73.  
  74.       inline unsigned long
  75.          skillOffset() { return offsetof(SkillCnrObj, skill); };
  76.       inline unsigned long
  77.          expOffset() { return offsetof(SkillCnrObj, exp); };
  78.  
  79.    private:
  80.  
  81.       unsigned long
  82.          unDoNum;
  83.  
  84.       IString
  85.          skill,
  86.          exp;
  87. };
  88.  
  89.  
  90. /******************************************************************************
  91. * Class SkillPage - Skill page.                                               *
  92. ******************************************************************************/
  93. class SkillPage : public IMultiCellCanvas,
  94.                   public ICommandHandler
  95. {
  96.    public:
  97.       friend class QuerySkill;
  98.  
  99. /*------------------------ Constructors/Destructor ----------------------------
  100. | Construct the object in one of two ways:                                    |
  101. | 1) IWindow*, IString.                                                       |
  102. | 2) IWindow*, LQueryData.                                                    |
  103. -----------------------------------------------------------------------------*/
  104.       SkillPage( IWindow* pParent,
  105.                  const IString& aKey = NULL );
  106.  
  107.       SkillPage( IWindow* pParent,
  108.                  LQueryData& qd );
  109.  
  110.      ~SkillPage();
  111.  
  112. /*------------------------ Database Functions ---------------------------------
  113. | These functions are used to save data to the database:                      |
  114. |   verifyAndSave       - Verify the page data and save to the database.      |
  115. -----------------------------------------------------------------------------*/
  116.       Boolean
  117.          verifyAndSave( IString& theString,
  118.                         IString& theEntry,
  119.                         const IString saveName = NULL );
  120.  
  121. /*------------------------------ Accessors ------------------------------------
  122. | These functions provide a means of getting and setting the accessible       |
  123. | attributes of instances of this class:                                      |
  124. |   pageSettings        - Return the page settings for this page.             |
  125. |   key                 - Return the key.                                     |
  126. -----------------------------------------------------------------------------*/
  127.       inline INotebook::PageSettings
  128.          pageSettings() { return thePageSettings; };
  129.  
  130.       inline IString
  131.          &key() {return Key;};
  132.  
  133. /*----------------------------- Page Manipulation -----------------------------
  134. | These functions provide a means of manipulating the instances of this class:|
  135. |   fillEntryfields     - Fill the entryfields for the given container object.|
  136. -----------------------------------------------------------------------------*/
  137.       SkillPage&
  138.          fillEntryfields( SkillCnrObj* cnrObject );
  139.  
  140.  
  141.    protected:
  142.  
  143. /*----------------------------- Event Processing ------------------------------
  144. | Handle and process events:                                                  |
  145. |   command             - Process command events.                             |
  146. |   handleIt            - Start handling events.                              |
  147. -----------------------------------------------------------------------------*/
  148.       Boolean
  149.          command( ICommandEvent& event );
  150.  
  151.       SkillPage&
  152.          handleIt();
  153.  
  154.    private:
  155.  
  156.       SkillPage
  157.         &setCells(),
  158.         &fillCnr(),
  159.         &unMark();
  160.  
  161.       Boolean
  162.          addSkill( IString& i1, IString& i2 ),
  163.          changeSkill( IString& i1, IString& i2, SkillCnrObj* cnrObj ),
  164.          setSkillData();
  165.  
  166.       PageButtons
  167.          pageButtons;
  168.  
  169.       PageCnrButtons
  170.          pageCnrButtons;
  171.  
  172.       QueryRange
  173.         *pSkillRange;
  174.  
  175.       IStaticText
  176.          skillText,
  177.          monthsExpText;
  178.  
  179.       IEntryField
  180.          skill;
  181.  
  182.       INumericSpinButton
  183.          monthsExp;
  184.  
  185.       IContainerControl
  186.         *pCnr;
  187.  
  188.       SkillCnrObj
  189.         *pSkillCnrObj;
  190.  
  191.       IContainerColumn
  192.         *pColSkill,
  193.         *pColExp;
  194.  
  195.       LSkillData
  196.          skillData,
  197.          origSkillData;
  198.  
  199.       IString
  200.          Key;
  201.  
  202.       INotebook::PageSettings
  203.          thePageSettings;
  204.  
  205.       Boolean
  206.          isAquery;
  207.  
  208.       PageCnrSelHandler
  209.          cnrSelHandler;
  210. };
  211. #endif
  212.