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

  1. /*******************************************************************************
  2. * FILE NAME: ltimec.hpp                                                        *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *                                                                              *
  6. * Class                                                                        *
  7. *   TimeCard                                                                   *
  8. *   TimeCardPage                                                               *
  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.  
  20. #ifndef _LTIMEC_
  21. #define _LTIMEC_
  22.  
  23. #include <imcelcv.hpp>
  24. #include <icnrctl.hpp>
  25. #include <icnrcol.hpp>
  26. #include <istring.hpp>
  27. #include <icombobx.hpp>
  28. #include <ientryfd.hpp>
  29. #include <ivport.hpp>
  30. #include <isplitcv.hpp>
  31. #include <ifont.hpp>
  32. #include <ispinnum.hpp>
  33. #include <inotebk.hpp>
  34. #include <icmdhdr.hpp>
  35.  
  36. #ifdef IC_MOTIF
  37. #include <ipicvhdr.hpp>
  38. #endif
  39.  
  40. #include "ldbase.hpp"
  41. #include "lpagectl.hpp"
  42. #include "lproject.hpp"
  43. #include "ltask.hpp"
  44. #ifdef IC_PM
  45. #include "ltimepie.hpp"
  46. #endif
  47.  
  48.  
  49. //----------------------------------------------------------------------------
  50. // class WeekEndingDate
  51. //----------------------------------------------------------------------------
  52. class WeekEndingDate : public IDate
  53. {
  54. public: // ------------------------- PUBLIC ----------------------------------
  55. enum WeekScroll{ next,
  56.                  previous
  57.                };
  58.   WeekEndingDate(IDate date = IDate());
  59.   ~WeekEndingDate();
  60.  
  61. const IDate
  62.   nextDate(WeekScroll scroll = next );
  63.  
  64. inline const IDate
  65.   date() { return theDate;};
  66.  
  67. private: // ------------------------ PRIVATE --------------------------------
  68.  
  69. IDate
  70.   theDate;
  71.  
  72. };
  73.  
  74. //----------------------------------------------------------------------------
  75. // class TimeCard
  76. //----------------------------------------------------------------------------
  77. class TimeCard : public IMultiCellCanvas
  78. {
  79. public: // ----------------------- PUBLIC -----------------------------------
  80.      // to get to private data in verifyAndSave()
  81. friend class TimeCardPage;
  82.   TimeCard(IWindow* pParent,
  83.            ProjectPage* pProjPage,
  84.            TasksPage* pTasksPage,
  85.            LTimeCardData* pTimeCardData);
  86.  
  87.     ~TimeCard();
  88.  
  89. TimeCard&
  90.     fillVp(LTimeCardData * tcp);
  91.  
  92. TimeCard&
  93.     fillVpText();
  94.  
  95. TimeCard&
  96.   fillHours(const IString &theKey);
  97.  
  98. TimeCard&
  99.   setHours(const IString &key);
  100.  
  101. inline int
  102.   getTotalHours() {return totalHours;};
  103.  
  104. inline int
  105.   getTotalBillable() {return totalBillable;};
  106.  
  107. TimeCard&
  108.   mtComboBoxes();
  109.  
  110. TimeCard&
  111.   fillComboBox();
  112.  
  113. protected: // ---------------------- PROTECTED --------------------------------
  114.  
  115. TimeCard&
  116.  handleIt();
  117.  
  118. private: // ------------------------ PRIVATE --------------------------------
  119.  
  120. TimeCard&
  121.   setCells();       // build multi-cell canvas
  122.  
  123. IEntryField
  124.  *date[ID_TIMECARD_ENTRIES];
  125.  
  126. IComboBox
  127.  *proj[ID_TIMECARD_ENTRIES],
  128.  *task[ID_TIMECARD_ENTRIES];
  129.  
  130. INumericSpinButton
  131.  *hours[ID_TIMECARD_ENTRIES];
  132.  
  133. IStaticText
  134.   dateHeader,
  135.   projectHeader,
  136.   taskHeader,
  137.   hourHeader;
  138.  
  139. ProjectPage
  140.  *pProjectPage;
  141.  
  142. TasksPage
  143.  *pTasksPage;
  144.  
  145. #ifdef IC_MOTIF
  146. IPictureVerifyHandler
  147.   dateHandler;
  148. #endif
  149.  
  150. int
  151.   totalHours,
  152.   totalBillable;
  153.  
  154. };
  155.  
  156.  
  157. //----------------------------------------------------------------------------
  158. // class TimeCardPage
  159. //----------------------------------------------------------------------------
  160. class TimeCardPage : public IMultiCellCanvas,
  161.                      public ICommandHandler
  162. {
  163. public: // -------------------------- PUBLIC -------------------------------
  164. friend class LTimeCardData;
  165.   TimeCardPage(  IWindow* pParent,
  166.                  ProjectPage* pProjPage,
  167.                  TasksPage  * pTasksPage,
  168.                  const IString& theKey= NULL);
  169.  
  170.      ~TimeCardPage();
  171. Boolean
  172.   verifyAndSave( IString& theString,
  173.                  IString& theEntry,
  174.                  const IString saveName=NULL);
  175.  
  176. inline INotebook::PageSettings
  177.   pageSettings() { return thePageSettings; };
  178.  
  179. inline IString
  180.  &key() {return Key;};
  181.  
  182. TimeCardPage&
  183.   deleteObject(IString theKey);
  184.  
  185. inline TimeCardPage&
  186.   fillCBagain() {timeCard.fillComboBox(); return *this;};
  187.  
  188.  
  189. protected: // -------------------------- PROTECTED --------------------------
  190.  
  191. Boolean
  192.   command( ICommandEvent& event );
  193.  
  194. TimeCardPage&
  195.   handleIt();
  196.  
  197. private: //----------------------------- PRIVATE ----------------------------
  198.  
  199. TimeCardPage&
  200.   setCells();
  201.  
  202. TimeCardPage&
  203.   setDisplayText(const char* totHours, const char* totBillable);
  204.  
  205. PageButtons
  206.   pageButtons;
  207.  
  208. PageScrollButtons
  209.   pageScrollButtons;
  210.  
  211. IViewPort
  212.   tcVp;
  213.  
  214. IStaticText
  215.   totalHoursText,
  216.   totalBillableHoursText;
  217.  
  218. ProjectPage
  219.  *pProjectPage;
  220.  
  221. TasksPage
  222.  *pTasksPage;
  223.  
  224. WeekEndingDate
  225.   weekEndingDate;
  226.  
  227. LTimeCardData
  228.  *pTimeCardData;
  229.  
  230. TimeCard
  231.     timeCard;
  232.  
  233. #ifdef IC_PM
  234. LTimeCardPieChart
  235.   pieChart;
  236. #endif
  237.  
  238. IString
  239.     Key;               // employee number
  240.  
  241. INotebook::PageSettings
  242.     thePageSettings;
  243.  
  244. };
  245.  
  246. #endif
  247.