home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / uicldd.zip / DMSAMP3.CPP < prev    next >
Text File  |  1993-09-04  |  3KB  |  96 lines

  1. #include "dmsamp3.hpp"
  2.  
  3. void main()
  4. {
  5.    MySourceWin sourceWin (WND_SOURCE);
  6.    MyTargetWin targetWin (WND_TARGET);
  7.    IApplication::current().run();
  8. }
  9.  
  10.  
  11. MyWindow :: MyWindow ( unsigned long windowId ) :
  12.             IFrameWindow ( windowId ),
  13.  
  14.             cnrh (new ICnrHandler ()),
  15.             cnrCtl (new ICnrCtl (windowId + 20, this, this, IRectangle())),
  16.  
  17.             car ((Customer *) 0),
  18.             space ((Customer *) 0),
  19.             bolt ((Customer *) 0),
  20.             starfleet ((Customer *) 0),
  21.  
  22.             reslib()
  23. {
  24.   cnrh->handleEventsFor(cnrCtl);
  25.  
  26.   setClient(cnrCtl);
  27.  
  28.   car =       new Customer ("Auto Racer", CAR, "Al Uncer",
  29.                             "Le Mans, France", "(919) 555-1234", this);
  30.   space =     new Customer ("Astronaut", SPACE, "E. T.",
  31.                             "Pirx the Pilot", "(919) 555-4321", this);
  32.   bolt =      new Customer ("Repairman", BOLT, "Joe Blow",
  33.                             "The Sky", "(919) 555-4321", this);
  34.   starfleet = new Customer ("Captain", STARFLEET, "J. L. Picard",
  35.                             "Starfleet", "(919) 555-1212", this);
  36.  
  37.   cnrCtl->addObject(car);
  38.   cnrCtl->addObject(space);
  39.   cnrCtl->addObject(bolt);
  40.   cnrCtl->addObject(starfleet, space);
  41.  
  42.   cnrCtl->setDeleteObjectsOnClose();
  43.   cnrCtl->showTreeLine();
  44.   cnrCtl->showTitle();
  45.   cnrCtl->enableDrawItem();
  46.  
  47.   cnrCtl->showTreeIconView();
  48.  
  49.   show();
  50.   cnrCtl->show();
  51. }
  52.  
  53. MySourceWin :: MySourceWin ( unsigned long windowId ) :
  54.                MyWindow ( windowId )
  55. {
  56.   ITitle title (this, "C Set ++ Direct Manipulation - Source Container" );
  57.   srcHandler = new IDMCnrSourceHandler( cnrCtl );
  58. };
  59.  
  60. MyTargetWin :: MyTargetWin ( unsigned long windowId ) :
  61.                MyWindow ( windowId )
  62. {
  63.   ITitle title (this, "C Set ++ Direct Manipulation - Target Container" );
  64.   tgtHandler = new IDMCnrTargetHandler( cnrCtl );
  65. }
  66.  
  67. Customer :: Customer ( const Customer &cnrobj )  :
  68.             IContainerObject ( (const IContainerObject &)cnrobj ),
  69.             strName ( cnrobj.name() ),
  70.             strAddress ( cnrobj.address() ),
  71.             strPhone ( cnrobj.phone() ),
  72.             myWin ( cnrobj.myWin )
  73. {
  74. }
  75.  
  76. Customer :: Customer ( const IString &Text,
  77.                        unsigned long Icon,
  78.                        const IString &Name,
  79.                        const IString &Address,
  80.                        const IString &Phone,
  81.                        MyWindow* win )  :
  82.                        IContainerObject ( Text, Icon ),
  83.                        strName ( Name ),
  84.                        strAddress ( Address ),
  85.                        strPhone ( Phone ),
  86.                        myWin ( win )
  87. {
  88. }
  89.  
  90. IContainerObject* Customer :: objectCopy()
  91. {
  92.   /* invoke Customer :: Customer(Customer&) to do copy */
  93.   Customer *copy = new Customer(*this);
  94.   return((IContainerObject *)copy);
  95. }
  96.