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

  1. /*******************************************************************************
  2. * FILE NAME: ltask.hpp                                                         *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *                                                                              *
  6. * Classes                                                                      *
  7. *   TaskPage                                                                   *
  8. *   TaskCnrObj                                                                 *
  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 _LTASK_
  20. #define _LTASK_
  21.  
  22. #include <imcelcv.hpp>
  23. #include <icnrctl.hpp>
  24. #include <icnrcol.hpp>
  25. #include <istring.hpp>
  26. #include <icombobx.hpp>
  27. #include <ientryfd.hpp>
  28. #include <icmdhdr.hpp>
  29. #include <icheckbx.hpp>
  30. #include <imsgbox.hpp>
  31. #include <ipoint.hpp>
  32. #include <inotebk.hpp>
  33. #include <iapp.hpp>
  34.  
  35. #include "ldbase.hpp"
  36. #include "lproject.hpp"
  37. #include "lpagectl.hpp"
  38.  
  39.  
  40. /******************************************************************************
  41. * Class TaskCnrObj - Task container object.                                   *
  42. ******************************************************************************/
  43. class TaskCnrObj : public IContainerObject
  44. {
  45.    public: 
  46. /*------------------------ Constructors/Destructor ----------------------------
  47. | Construct the object given a task, description, and billable flag.          |
  48. -----------------------------------------------------------------------------*/
  49.       TaskCnrObj( const IString& stTask,
  50.                   const IString& stDesc,
  51.                   const IString& stBill );
  52.  
  53.      ~TaskCnrObj();
  54.  
  55. /*------------------------------- Accessors -----------------------------------
  56. | These functions provide a means of getting and setting the accessible        |
  57. | attributes of instances of this class:                                       |
  58. |   task                - Returns the task.                                    |
  59. |   desc                - Returns the description.                             |
  60. |   bill                - Returns the billable status.                         |
  61. |   setTask             - Sets the task.                                       |
  62. |   setDesc             - Sets the description.                                |
  63. |   setBill             - Sets the billable status.                            |
  64. |   taskOffset          - Returns the container offset for the task.           |
  65. |   descOffset          - Returns the container offset for the description.    |
  66. |   billOffset          - Returns the container offset for the billable status.|
  67. -----------------------------------------------------------------------------*/
  68.       inline IString
  69.          task() const { return Task; };
  70.       inline IString
  71.          desc() const { return Desc; };
  72.       inline IString
  73.          bill() const { return Bill; };
  74.  
  75.       inline TaskCnrObj
  76.          &setTask( const IString& ta ) { Task=ta; return *this; };
  77.       inline TaskCnrObj
  78.          &setDesc( const IString& de ) { Desc=de; return *this; };
  79.       inline TaskCnrObj
  80.          &setBill( const IString& bi ) { Bill=bi; return *this; };
  81.  
  82.       inline unsigned long
  83.          taskOffset() { return offsetof( TaskCnrObj, Task ); };
  84.       inline unsigned long
  85.          descOffset() { return offsetof( TaskCnrObj, Desc ); };
  86.       inline unsigned long
  87.          billOffset() { return offsetof( TaskCnrObj, Bill ); };
  88.  
  89.    private: 
  90.  
  91.       IString
  92.          Task,          
  93.          Desc,
  94.          Bill;
  95. };
  96.  
  97.  
  98. /******************************************************************************
  99. * Class TasksPage - Task page.                                                *
  100. ******************************************************************************/
  101. class TasksPage : public IMultiCellCanvas,
  102.                   public ICommandHandler
  103. {
  104.    public:
  105.       friend class TimeCard;
  106.  
  107. /*------------------------ Constructors/Destructor ----------------------------
  108. | Construct the object in only one way:                                       |
  109. | 1) IWindow*, IString.                                                       |
  110. -----------------------------------------------------------------------------*/
  111.       TasksPage( IWindow* pParent,
  112.                  const IString& theKey = NULL );
  113.  
  114.      ~TasksPage();
  115.  
  116. /*------------------------ Database Functions ---------------------------------
  117. | These functions are used to save data to the database:                      |
  118. |   verifyAndSave       - Verify the page data and save to the database.      |
  119. -----------------------------------------------------------------------------*/
  120.       Boolean
  121.          verifyAndSave( IString& theString,
  122.                         IString& theEntry,
  123.                         const IString saveName = NULL );
  124.  
  125. /*------------------------------ Accessors ------------------------------------
  126. | These functions provide a means of getting and setting the accessible       |
  127. | attributes of instances of this class:                                      |
  128. |   pageSettings        - Return the page settings for this page.             |
  129. |   key                 - Return the key.                                     |
  130. |   getTaskData         - Return the task data.                               |
  131. |   setTaskData         - Set the task data.                                  |
  132. -----------------------------------------------------------------------------*/
  133.       inline INotebook::PageSettings
  134.          pageSettings() { return thePageSettings; };
  135.  
  136.       inline IString
  137.          &key() { return Key; };
  138.  
  139.       inline LTaskData
  140.         &getTaskData() { return taskData; };
  141.  
  142.       Boolean
  143.          setTasksData();  
  144.  
  145. /*----------------------------- Page Manipulation -----------------------------
  146. | These functions provide a means of manipulating the instances of this class:|
  147. |   fillEntryfields     - Fill the entryfields for the given container object.|
  148. -----------------------------------------------------------------------------*/
  149.       TasksPage&
  150.          fillEntryfields( TaskCnrObj* cnrObject );
  151.  
  152.  
  153.    protected: 
  154.  
  155. /*----------------------------- Event Processing ------------------------------
  156. | Handle and process events:                                                  |
  157. |   command             - Process command events.                             |
  158. |   handleIt            - Start handling events.                              |
  159. -----------------------------------------------------------------------------*/
  160.       Boolean
  161.          command( ICommandEvent& event );
  162.  
  163.       TasksPage
  164.         &handleIt();
  165.  
  166.    private: 
  167.  
  168.       TasksPage
  169.         &setCells(),
  170.         &fillCnr();
  171.  
  172.       Boolean
  173.          addTask( IString& i1, IString& i2, IString& i3 ),
  174.          changeTask( IString& i1, IString& i2, IString& i3, TaskCnrObj* cnrObj );
  175.  
  176.       TasksPage
  177.          &unMark();
  178.  
  179.       PageButtons
  180.          pageButtons;
  181.  
  182.       PageCnrButtons
  183.          pageCnrButtons;
  184.  
  185.       IStaticText
  186.          taskText,
  187.          billableText,
  188.          descrText;
  189. //  currentTasksText,
  190. //  descr2Text,
  191. //  billable2Text;
  192.  
  193.       IEntryField
  194.          task;
  195.  
  196.       ICheckBox
  197.          billable;
  198.  
  199.       IEntryField
  200.          descr;
  201.  
  202.       IContainerControl
  203.         *pCnr;            
  204.  
  205.       TaskCnrObj
  206.         *pTaskCnrObj;     
  207.  
  208.       IContainerColumn
  209.         *pColTask;        
  210.  
  211.       IContainerColumn
  212.         *pColDesc,        
  213.         *pColBill;
  214.  
  215.       LTaskData
  216.          taskData,
  217.          origTaskData;
  218.  
  219.       IString
  220.          Key;             
  221.  
  222.       INotebook::PageSettings
  223.          thePageSettings;
  224.  
  225. #ifdef IC_MOTIF
  226.       LPictureVerifyHandler
  227.          alphaNumericHandler;
  228. #endif
  229.  
  230.       PageCnrSelHandler
  231.          cnrSelHandler;
  232. };
  233. #endif
  234.