home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / clsam4j / testcnr.hp_ / TESTCNR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-25  |  4.9 KB  |  153 lines

  1. #include <iframe.hpp>
  2. #include <icmdhdr.hpp>
  3. #include <ientryfd.hpp>
  4. #include <ititle.hpp>
  5. #include <istattxt.hpp>
  6. #include <idate.hpp>
  7. #include <itime.hpp>
  8. #include <icnr.hpp>
  9. #include <istring.hpp>
  10. #include <iiconctl.hpp>
  11.  
  12. class IResourceId;
  13. class IResourceLibrary;
  14. class IContainerControl;
  15.  
  16. #define FIELDOFFSET2(type, field)    ((long)&(((type *)0)->field))
  17.  
  18. extern "C"
  19. {
  20.    #include <string.h>
  21.  
  22.    void loadContainer(IContainerControl& pcnrctl);
  23. }
  24.  
  25.  
  26.  
  27. /**********************************************************/
  28. /* Define our Customer Container Window.                  */
  29. /**********************************************************/
  30. class CustomerList : public IFrameWindow, public ICommandHandler 
  31. {
  32.  
  33.    public:
  34.  
  35.       CustomerList(const IRectangle& rect,
  36.                     Boolean fLoadObjects=true);
  37.       ~CustomerList() {;}
  38.  
  39.                 Boolean loadObjects()  { return fLoadObjects; }
  40.       IContainerColumn* colIcon()      { return &cnrcolIcon; }
  41.       IContainerColumn* colName()      { return &cnrcolName; }
  42.       IContainerColumn* colAddress()   { return &cnrcolAddress; }
  43.       IContainerColumn* colPhone()     { return &cnrcolPhone; }
  44.       IContainerColumn* colAge()       { return &cnrcolAge; }
  45.       IContainerColumn* colOrderDate() { return &cnrcolOrderDate; }
  46.       IContainerColumn* colOrderTime() { return &cnrcolOrderTime; }
  47.      IContainerControl& container()    { return *_pcnrCustList;   }
  48.      IContainerControl& objectList()   { return *_pObjectList;   }
  49.            IStaticText& statusArea()   { return *_pStatusLine;   }
  50.  
  51.   protected:
  52.     virtual Boolean command(ICommandEvent& cmdevt);
  53.  
  54.    private:
  55.  IContainerControl* _pcnrCustList;
  56.  IContainerControl* _pObjectList;
  57.             ITitle* _pTitle;
  58.       IIconControl* _pTitleIcon;
  59.        IStaticText* _pStatusLine;
  60.    IContainerColumn cnrcolIcon;
  61.    IContainerColumn cnrcolName;
  62.    IContainerColumn cnrcolAddress;
  63.    IContainerColumn cnrcolPhone;
  64.    IContainerColumn cnrcolAge;
  65.    IContainerColumn cnrcolOrderDate;
  66.    IContainerColumn cnrcolOrderTime;
  67.    Boolean  fLoadObjects;
  68. };
  69.  
  70.  
  71.  
  72.  
  73. /**********************************************************/
  74. /* Define the data record for our container objects       */
  75. /**********************************************************/
  76. class Customer : public IContainerObject
  77. {
  78. friend CustomerList;
  79.    public:
  80.                Customer(const IString& strName,
  81.                         const IPointerHandle& hptrIcon = 0,
  82.                         const IString& strAddress = IString(),
  83.                         const IString& strPhone = IString(),
  84.                         unsigned long ulAge = 0);
  85.  
  86.                Customer(Customer&);
  87.  
  88.               ~Customer();
  89.  
  90.  
  91.  
  92. virtual void   handleOpen(IContainerControl* pcnrctl);
  93.         void   setCustomerName(const IString& strCustomer)
  94.                 { strCustomerName = strCustomer; }
  95.         void   setCustomerAddress(const IString& strAddress)
  96.                 { strCustomerAddress = strAddress; }
  97.         void   setCustomerPhone(const IString& strPhone)
  98.                 { strCustomerPhone = strPhone; }
  99.         void   setCustomerAge(unsigned long ulAge)
  100.                 { ulCustomerAge = ulAge; }
  101.         void   setOrderDate(const IDate& timeOrder);
  102.         void   setOrderTime(const ITime& timeOrder);
  103.  
  104.    IString customerName() const
  105.                    {  return strCustomerName; }
  106.    IString customerAddress() const
  107.                    {  return strCustomerAddress; }
  108.    IString customerPhone() const
  109.                    {  return strCustomerPhone; }
  110.          unsigned long customerAge() const
  111.                    {  return ulCustomerAge; }
  112.  
  113.     IContainerObject* objectCopy();
  114.  
  115.   private:
  116.             IString strCustomerName;
  117.             IString strCustomerAddress;
  118.             IString strCustomerPhone;
  119.               unsigned long ulCustomerAge;
  120.             IString strOrderDate;
  121.             IString strOrderTime;
  122. };
  123.  
  124.  
  125.  
  126. extern "C"
  127. {
  128. long _System pfncompName(const Customer* p1,
  129.                                const Customer* p2,
  130.                                const IContainerControl* pcnrctl);
  131.  
  132. long _System pfncompAddress(const Customer* p1,
  133.                                const Customer* p2,
  134.                                const IContainerControl* pcnrctl);
  135.  
  136. long _System pfncompPhone(const Customer* p1,
  137.                                const Customer* p2,
  138.                                const IContainerControl* pcnrctl);
  139.  
  140. long _System pfncompAge(const Customer* p1,
  141.                                const Customer* p2,
  142.                                const IContainerControl* pcnrctl);
  143.  
  144. Boolean _System pfnfilterA_K(const Customer* pcust,
  145.                                const IContainerControl* pcnrctl);
  146.  
  147. Boolean _System pfnfilterL_Z(const Customer* pcust,
  148.                                const IContainerControl* pcnrctl);
  149.  
  150. Boolean _System pfnfilterOver30(const Customer* pcust,
  151.                                   const IContainerControl* pcnrctl);
  152. }
  153.