home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / CNR / ACNR.HPP < prev    next >
Text File  |  1995-05-01  |  6KB  |  153 lines

  1. #ifndef ACNREXWINDOW_HPP
  2. #define ACNREXWINDOW_HPP
  3. /******************************************************************************/
  4. /* Container Sample Program - C++ Class Header (ACNR.HPP)                     */
  5. /*                                                                            */
  6. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
  7. /*                                                                            */
  8. /* DISCLAIMER OF WARRANTIES:                                                  */
  9. /*   The following [enclosed] code is sample code created by IBM              */
  10. /*   Corporation.  This sample code is not part of any standard IBM product   */
  11. /*   and is provided to you solely for the purpose of assisting you in the    */
  12. /*   development of your applications.  The code is provided "AS IS",         */
  13. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  14. /*   arising out of your use of the sample code, even if they have been       */
  15. /*   advised of the possibility of such damages.                              */
  16. /******************************************************************************/
  17. /* NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          */
  18. /******************************************************************************/
  19.  
  20. #include <iframe.hpp>           //Include IFrameWindow Class Header
  21. #include <icmdhdr.hpp>          //Include ICommandEvent & ICommandHandler
  22. #include <icnrctl.hpp>
  23. #include <icnrhdr.hpp>
  24. #include <icnrehdr.hpp>
  25. #include <icnrmhdr.hpp>
  26. #include <imenuevt.hpp>
  27.  
  28. class ACnrexWindow;
  29. //**************************************************************************
  30. // Class:   ACnrMenuHandler                                                *
  31. //                                                                         *
  32. // Purpose: Subclass of ICnrMenuHandler so that the a PopUp Menu can be    *
  33. //          created.                                                       *
  34. //                                                                         *
  35. //**************************************************************************
  36. class ACnrMenuHandler: public ICnrMenuHandler //
  37. {
  38.   public:
  39.   ACnrMenuHandler
  40.    &setCnr(IContainerControl * pcnr)  { pcnrCtl = pcnr; return *this; };
  41.  
  42.   protected:                            //Define Protected Member
  43.     Boolean makePopUpMenu(IMenuEvent& cnEvt);
  44.  
  45.   private:
  46.     IContainerControl * pcnrCtl;
  47. };
  48.  
  49.  
  50. //**************************************************************************
  51. // Class:   Department                                                     *
  52. //                                                                         *
  53. // Purpose: describes department                                           *
  54. //                                                                         *
  55. //**************************************************************************
  56. class Department : public IContainerObject
  57.  
  58. {
  59.     friend class IContainerColumn;
  60.     friend class ACnrexWindow;
  61.  
  62.   public:
  63.  
  64.     Department(const IString& Name, const IPointerHandle& Icon,  const IString& Code,
  65.                const IString& Address);
  66.  
  67.     IString Code() const {  return strCode; }
  68.     IString Address() const {  return strAddress; }
  69.     void    setCode (IString code) {strCode = code;}
  70.     void    setAddress (IString address) {strAddress = address;}
  71.   virtual
  72.     void    handleOpen (IContainerControl* container);
  73.  
  74.   private:
  75.     IString       strAddress;
  76.     IString       strCode;
  77. };
  78.  
  79. //**************************************************************************
  80. // Class:   ADepartmentView                                                *
  81. //                                                                         *
  82. // Purpose: Window for department                                          *
  83. //                                                                         *
  84. //**************************************************************************
  85. class ADepartmentView : public IFrameWindow
  86.  
  87. {
  88.   public:
  89.     ADepartmentView(Department * aDept, IContainerControl* anOwner);
  90.     ~ADepartmentView();
  91.  
  92.   private:
  93.     Department * saveDept;
  94. };
  95.  
  96.  
  97. //**************************************************************************
  98. // Class:   ACnrexWindow                                                   *
  99. //                                                                         *
  100. // Purpose: Main Window for cnrex sample application                       *
  101. //                                                                         *
  102. //**************************************************************************
  103. class ACnrexWindow : public IFrameWindow,
  104.                      public ICommandHandler,
  105.                      public ICnrHandler
  106.  
  107. {
  108.   friend class ACnrMenuHandler;
  109.   public:                                  //Define the Public Information
  110.     ACnrexWindow(unsigned long windowId); //Constructor for this class
  111.     ~ACnrexWindow () {};
  112.  
  113.  
  114.   protected:                               //Define Protected Member
  115.     Boolean command(ICommandEvent& cmdEvent);
  116.  
  117.   private:                                 //Define Private Information
  118.     IContainerControl * cnrCtl;
  119.     Department *dept1, *dept2, *dept3, *dept4, *dept5, *dept6;
  120.     IContainerColumn  * colIcon,  *colName, *colCode, *colAddress;
  121.     IMenuBar          * menuBar;
  122.     ACnrMenuHandler   Chdr;
  123.     ICnrEditHandler   * _pcnrEdit;
  124. };
  125.  
  126. class SelectedObjectsFilter : public IContainerControl::FilterFn
  127. {
  128.   virtual Boolean 
  129.     isMemberOf( IContainerObject* object,
  130.                 IContainerControl* container ) const
  131.     {  
  132.       return container->isSelected( object );
  133.     }
  134. };
  135.  
  136. class AllObjectsFilter : public IContainerControl::FilterFn
  137. {
  138.   virtual Boolean 
  139.     isMemberOf( IContainerObject* object,
  140.                 IContainerControl* container) const
  141.     {
  142.       return true;
  143.     }
  144. };
  145.  
  146.  
  147. #endif
  148. class CnrEditHandler : public ICnrEditHandler
  149. {
  150. typedef ICnrEditHandler
  151.  Inherited;
  152. };
  153.