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

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