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

  1. /*******************************************************************************
  2. * FILE NAME: lperswin.hpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION: Frame window for matching personnel                             *
  5. *                                                                              *
  6. * Class                                                                        *
  7. *   LPersonnelWindow                                                           *
  8. *   LPersonnelWindowCommandHandler                                             *
  9. *   LPersonnelCnr                                                              *
  10. *   LPersonnelCnrObject                                                        *
  11. *   LPersonnelWindowHelpHandler                                                *
  12. *                                                                              *
  13. * COPYRIGHT:                                                                   *
  14. *   Licensed Materials - Property of IBM                                       *
  15. *   (C) Copyright IBM Corporation 1992, 1995                                   *
  16. *   All Rights Reserved                                                        *
  17. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  18. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  19. *                                                                              *
  20. *******************************************************************************/
  21. #ifndef _LPERSWIN_
  22.   #define _LPERSWIN_
  23.  
  24. #include <iapp.hpp>
  25. #include <irect.hpp>
  26. #include <istring.hpp>
  27. #include <iframe.hpp>
  28. #include <ititle.hpp>
  29. #include <iinfoa.hpp>
  30. #include <imenubar.hpp>
  31. #ifdef IC_PM
  32. #include <idmhndlr.hpp>
  33. #include <itbar.hpp>
  34. #include <itbarbut.hpp>
  35. #include <iflytext.hpp>
  36. #include <iflyhhdr.hpp>
  37. #endif
  38. #include <icmdhdr.hpp>
  39. #include <icnrhdr.hpp>
  40. #include <icnrmhdr.hpp>
  41. #include <ievent.hpp>
  42. #include <icnr.hpp>
  43. #include <icnrobj.hpp>
  44. #include <icnrctl.hpp>
  45. #include <icnrcol.hpp>
  46. #include <ipopmenu.hpp>
  47. #include <ifont.hpp>
  48. #include <imsgbox.hpp>
  49. #include <ihelp.hpp>
  50. #include <ihelphdr.hpp>
  51. #include "lcnrobj.hpp"
  52. #include "ldbase.hpp"
  53. #include "ldbqry.hpp"
  54. #include "lancelot.h"
  55. #ifdef IC_PM
  56. #include "lperswdm.hpp"
  57. #endif
  58.  
  59. class LPersonnelWindow;
  60.  
  61. /******************************************************************************
  62. * Class LPersonnelCnrObject - LPersonnelMainWindow's container object         *
  63. ******************************************************************************/
  64. class LPersonnelCnrObject : public LCnrObject
  65. {
  66.    friend class LPersonnelCnr;
  67.  
  68.    public:
  69.  
  70. /*------------------------ Constructors/Destructor ----------------------------
  71. | Construct the object in two of four ways:                                   |
  72. | 1) Existing object                                                          |
  73. | 2) Icon resourceId and EmployeeData object.                                 |
  74. -----------------------------------------------------------------------------*/
  75.       LPersonnelCnrObject( const LPersonnelCnrObject& cnrobj );
  76.  
  77.       LPersonnelCnrObject( unsigned long icon,
  78.             const LEmployeeData& employee );
  79.  
  80.       virtual
  81.         ~LPersonnelCnrObject();
  82.  
  83. /*------------------------------- Accessors -----------------------------------
  84. | These functions provide a means of getting and setting the accessible        |
  85. | attributes of instances of this class:                                       |
  86. |   employeeRecord      - Returns the employee data                            |
  87. -----------------------------------------------------------------------------*/
  88.       inline LEmployeeData
  89.          employeeRecord() const { return theEmployee; };
  90.  
  91.    private:
  92.  
  93.       LEmployeeData
  94.          theEmployee;
  95. };
  96.  
  97.  
  98. /******************************************************************************
  99. * Class LPersonnelCnr - Personnel window's container                          *
  100. ******************************************************************************/
  101. class LPersonnelCnr : public IContainerControl,
  102.                       protected ICnrHandler,
  103.                       protected ICnrMenuHandler
  104.  
  105. {
  106.    public:
  107. /*------------------------ Constructors/Destructor ----------------------------
  108. | Construct the object in only one way:                                       |
  109. | 1) Window id, parent, owner, and location                                   |
  110. -----------------------------------------------------------------------------*/
  111.       LPersonnelCnr( unsigned long id, LPersonnelWindow* parent,
  112.                      LPersonnelWindow* owner, IRectangle location=IRectangle() );
  113.       virtual
  114.         ~LPersonnelCnr();
  115.  
  116. /*------------------------------- Accessors -----------------------------------
  117. | These functions provide a means of getting and setting the accessible        |
  118. | attributes of instances of this class:                                       |
  119. |   lastPopupMenuObject - Returns the last container object that had a         |
  120. |                         popup menu over it.  But not guaranteed that the     |
  121. |                         last action was a popup menu.                        |
  122. |   setLastPopupMenuObject - Sets the last container object that had a popup   |
  123. |                         menu over it.                                        |
  124. -----------------------------------------------------------------------------*/
  125.       LPersonnelCnrObject
  126.         *lastPopupMenuObject() { return ptheLastPopupMenuObject; };
  127.  
  128.       LPersonnelCnr
  129.         &setLastPopupMenuObject( LPersonnelCnrObject* object )
  130.                                { ptheLastPopupMenuObject = object; return *this; };
  131.  
  132.    protected:
  133. /*----------------------------- Event Processing ------------------------------
  134. | Handle and process events:                                                  |
  135. |   makePopupMenu       - Process popup menu events.                          |
  136. |   enter               - Process the enter key for container objects.        |
  137. |   help                - Process the help key for container objects.         |
  138. -----------------------------------------------------------------------------*/
  139.       virtual Boolean
  140.          makePopUpMenu( IMenuEvent& evt ),
  141.          enter( ICnrEnterEvent& evt ),
  142.          help( ICnrHelpEvent& evt );
  143.  
  144.    private:
  145.       LPersonnelCnrObject
  146.         *pCnrObject[ ID_PERSONNEL_MAX_CNROBJECTS ];
  147.  
  148.       IContainerColumn
  149.          colIcon,
  150.          colIconText,
  151.          colLastName,
  152.          colFirstName,
  153.          colMiddleInitial,
  154.          colEmployeeNumber,
  155.          colInternalPhone,
  156.          colExternalPhone,
  157.          colInternalAddress,
  158.          colExternalAddress,
  159.          colRoom,
  160.          colBuilding,
  161.          colDepartment,
  162.          colManagerNumber,
  163.          colManagerName;
  164.  
  165.       LPersonnelCnrObject
  166.         *ptheLastPopupMenuObject;
  167.  
  168.       IHelpWindow
  169.         *helpWin;
  170.  
  171.       IPopUpMenu
  172.         *popm;
  173.  
  174. };
  175.  
  176.  
  177. /******************************************************************************
  178. * Class LPersonnelWindowCommandHandler - Handle command events.               *
  179. ******************************************************************************/
  180. class LPersonnelWindowCommandHandler : public ICommandHandler
  181. {
  182.    public:
  183. /*------------------------ Constructors/Destructor ----------------------------
  184. | Construct the object in only one way:                                       |
  185. | 1) Owner, help window, and container.                                       |
  186. -----------------------------------------------------------------------------*/
  187.       LPersonnelWindowCommandHandler( LPersonnelWindow* owner,
  188.                                       IHelpWindow* helpWin,
  189.                                       LPersonnelCnr* cnrCtl );
  190.       virtual
  191.         ~LPersonnelWindowCommandHandler();
  192.  
  193. /*------------------------- Container Object Actions --------------------------
  194. | These functions provide a means of performing actions on container objects.  |
  195. |   openAction          - Opens/views the container object.                    |
  196. |   createAction        - Creates a new container object.                      |
  197. |   transferAction      - Transfer the container object to another department. |
  198. |   deleteAction        - Deletes the container object.                        |
  199. -----------------------------------------------------------------------------*/
  200.       LPersonnelWindowCommandHandler
  201.         &openAction( LPersonnelCnrObject* cnrObject ),
  202.         &createAction( LPersonnelCnrObject* cnrObject ),
  203.         &transferAction( LPersonnelCnrObject* cnrObject );
  204.       Boolean
  205.         deleteAction( LPersonnelCnrObject* cnrObject );
  206.  
  207.    protected:
  208. /*----------------------------- Event Processing ------------------------------
  209. | Handle and process events:                                                  |
  210. |   command             - Process command events.                             |
  211. -----------------------------------------------------------------------------*/
  212.       virtual Boolean
  213.          command( ICommandEvent& event );
  214.  
  215.    private:
  216.       LPersonnelWindow
  217.         *pOwner;
  218.  
  219.       IHelpWindow
  220.         *pHelp;
  221.  
  222.       LPersonnelCnr
  223.         *pCnr;
  224. };
  225.  
  226.  
  227. /******************************************************************************
  228. * Class LPersonnelWindowHelpHandler - Handle help events.                     *
  229. ******************************************************************************/
  230. class LPersonnelWindowHelpHandler : public IHelpHandler
  231. {
  232.    public:
  233. /*------------------------ Constructors/Destructor ----------------------------
  234. | Construct the object in only one way:                                       |
  235. | 1) No parameters.                                                           |
  236. -----------------------------------------------------------------------------*/
  237.       LPersonnelWindowHelpHandler();
  238.  
  239.       virtual
  240.          ~LPersonnelWindowHelpHandler();
  241.  
  242.    protected:
  243. /*----------------------------- Event Processing ------------------------------
  244. | Handle and process events:                                                  |
  245. |   keysHelpId          - Process help events for the container.              |
  246. -----------------------------------------------------------------------------*/
  247.       virtual Boolean
  248.          keysHelpId( IEvent& event );
  249. };
  250.  
  251.  
  252. #ifdef IC_PM
  253. /******************************************************************************
  254. * Class LPersonnelToolBar - Toolbar class                                     *
  255. ******************************************************************************/
  256. class LPersonnelToolBar : public IToolBar
  257. {
  258.    public:
  259. /*------------------------ Constructors/Destructor ----------------------------
  260. | Construct the object in only one way:                                       |
  261. | 1) Resource id, owner, information area.                                    |
  262. -----------------------------------------------------------------------------*/
  263.       LPersonnelToolBar( unsigned long id, IFrameWindow* owner,
  264.                          ITextControl* infoArea );
  265.  
  266. /*----------------------------- Manipulators ----------------------------------
  267. | These functions provide a means of manipulating the attributes of            |
  268. | instances of this class:                                                     |
  269. |   enableSelects       - Enable or disables the select-all and deselect-all   |
  270. |                         toolbar buttons.                                     |
  271. -----------------------------------------------------------------------------*/
  272.       LPersonnelToolBar
  273.        &enableSelects( Boolean which = true );
  274.  
  275.    private:
  276.       IToolBarButton
  277.          openButton,
  278.          createButton,
  279.          transferButton,
  280.          deleteButton,
  281.          iconButton,
  282.          treeButton,
  283.          detailsButton,
  284.          selectAllButton,
  285.          deselectAllButton,
  286.          sortAscButton,
  287.          sortDescButton,
  288.          arrangeButton,
  289.          helpButton;
  290.  
  291.       IFlyText
  292.          flyText;
  293.  
  294.       IFlyOverHelpHandler
  295.          flyHelpHdr;
  296. };
  297. #endif
  298.  
  299. /******************************************************************************
  300. * Class LPersonnelWindow - Personnel frame window.                            *
  301. ******************************************************************************/
  302. class LPersonnelWindow : public IFrameWindow
  303. {
  304.    public:
  305. /*------------------------ Constructors/Destructor ----------------------------
  306. | Construct the object in only one way:                                       |
  307. | 1) Owner, QueryIntersection object, query string.                           |
  308. -----------------------------------------------------------------------------*/
  309.       LPersonnelWindow( IWindow* owner, QueryIntersection& bagOfIds,
  310.                          const IString deptQuery);
  311.       virtual
  312.        ~LPersonnelWindow();
  313.  
  314. /*------------------------------- Accessors -----------------------------------
  315. | These functions provide a means of getting and setting the accessible       |
  316. | attributes of instances of this class:                                      |
  317. |   helpWindow          - Returns the help window for this frame window.      |
  318. |   deptQuery           - If a fully-qualified department name was specified  |
  319. |                         on the query, return the department name.           |
  320. |   selectsAllowed      - Returns true if select all/deselect all is allowed. |
  321. -----------------------------------------------------------------------------*/
  322.       inline IHelpWindow
  323.        *helpWindow() { return &help; };
  324.  
  325.       inline IString
  326.         deptQuery() { return aDeptQuery; };
  327.  
  328.       inline Boolean
  329.          selectsAllowed() { return aSelects; };
  330.  
  331. /*------------------------------- Manipulation --------------------------------
  332. | These functions provide a means of manipulating the instances of this class:|
  333. |   populate            - Populate the container with employee objects.       |
  334. |   enableSelects       - Enable or disables the select-all and deselect-all   |
  335. |                         toolbar buttons.                                     |
  336. -----------------------------------------------------------------------------*/
  337.       LPersonnelWindow
  338.        &populate( QueryIntersection& bagOfIds );
  339.  
  340.       LPersonnelWindow
  341.        &enableSelects( Boolean which = true );
  342.  
  343. #ifdef IC_PM
  344.       IDMItemProviderFor< EmployeeItem >
  345.          provider;
  346. #endif
  347.  
  348. /*----------------------------- Event Processing ------------------------------
  349. | Handle and process events:                                                  |
  350. |   command             - Process command events.                             |
  351. |   keysHelpId          - Process the help key for container objects.         |
  352. -----------------------------------------------------------------------------*/
  353.    protected:
  354.       Boolean
  355.          command( ICommandEvent& evt ),
  356.          keysHelpId( IEvent& evt );
  357.  
  358.    private:
  359.       ITitle
  360.          title;
  361.  
  362.       IMenuBar
  363.          menubar;
  364.  
  365.       IInfoArea
  366.          infoarea;
  367.  
  368.       LPersonnelCnr
  369.          cnr;
  370.  
  371. #ifdef IC_PM
  372.       LPersonnelToolBar
  373.          toolbar;
  374. #endif
  375.  
  376.       IHelpWindow
  377.          help;
  378.  
  379.       LPersonnelWindowCommandHandler
  380.          cmdHdr;
  381.  
  382.       LPersonnelWindowHelpHandler
  383.          helpHdr;
  384.  
  385.       IString
  386.          aDeptQuery;
  387.  
  388.       Boolean
  389.          aSelects;
  390. };
  391. #endif
  392.