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

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