home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
SAMPLES
/
ICLUI
/
DRAG4
/
DMSAMP4.CPP
< prev
next >
Wrap
Text File
|
1993-10-20
|
8KB
|
167 lines
#include "dmsamp4.hpp"
/*------------------------------------------------------------------------------
| main |
------------------------------------------------------------------------------*/
void main( int argc, char *argv[] )
{
// Permit debugging during DrgDrag...
IDM::debugSupport = true;
// Create window...
DMSample4Window
frame( argv[1] );
// Show it...
frame.showModally();
}
/*------------------------------------------------------------------------------
| MyWindow::MyWindow |
| |
| Constructor. |
------------------------------------------------------------------------------*/
MyWindow :: MyWindow ( unsigned long windowId ) :
IFrameWindow ( windowId ),
cnrh (new ICnrHandler ()),
cnrCtl (new ICnrCtl (windowId + 20, this, this, IRectangle())),
car ((Customer *) 0),
space ((Customer *) 0),
bolt ((Customer *) 0),
starfleet ((Customer *) 0),
reslib()
{
/***********************************************************************/
/* Container handler handles event for the container. */
/***********************************************************************/
cnrh->handleEventsFor(cnrCtl);
/***********************************************************************/
/* Set the container as the frame client. */
/***********************************************************************/
setClient(cnrCtl);
/***********************************************************************/
/* Create the container objects ... */
/***********************************************************************/
car = new Customer ("Auto Racer", CAR, "Al Uncer",
"Le Mans, France", "(919) 555-1234", this);
space = new Customer ("Astronaut", SPACE, "E. T.",
"Pirx the Pilot", "(919) 555-4321", this);
bolt = new Customer ("Technician", BOLT, "Joe Blow",
"The Sky", "(919) 555-4321", this);
starfleet = new Customer ("Captain", STARFLEET, "J. L. Picard",
"Starfleet", "(919) 555-1212", this);
/***********************************************************************/
/* and add them to the container. */
/***********************************************************************/
cnrCtl->addObject(car);
cnrCtl->addObject(space);
cnrCtl->addObject(bolt);
cnrCtl->addObject(starfleet, space);
/***********************************************************************/
/* Set the container's attributes. */
/***********************************************************************/
cnrCtl->setDeleteObjectsOnClose();
cnrCtl->showTreeLine();
cnrCtl->showTitle();
cnrCtl->enableDrawItem();
/***********************************************************************/
/* Container view will be tree icon view. */
/***********************************************************************/
cnrCtl->showTreeIconView();
/***********************************************************************/
/* Show it ... */
/***********************************************************************/
cnrCtl->show();
}
/*------------------------------------------------------------------------------
| MySourceWin::MySourceWin |
| |
| Constructor. |
------------------------------------------------------------------------------*/
MySourceWin :: MySourceWin ( unsigned long windowId ) :
MyWindow ( windowId )
{
ITitle title (this, "C Set ++ Direct Manipulation - Source Container" );
/***********************************************************************/
/* Enable the source for dragging from (only). */
/***********************************************************************/
IDMHandler::enableDragFrom( cnrCtl );
};
/*------------------------------------------------------------------------------
| MyTargetWin::MyTargetWin |
| |
| Constructor. |
------------------------------------------------------------------------------*/
MyTargetWin :: MyTargetWin ( unsigned long windowId ) :
MyWindow ( windowId )
{
ITitle title (this, "C Set ++ Direct Manipulation - Target Container" );
/***********************************************************************/
/* Enable the target for dropping on (only). */
/***********************************************************************/
IDMHandler::enableDropOn( cnrCtl );
}
/*------------------------------------------------------------------------------
| Custoner::Customer |
| |
| Copy constructor. |
------------------------------------------------------------------------------*/
Customer :: Customer ( const Customer &cnrobj ) :
IContainerObject ( (const IContainerObject &)cnrobj ),
strName ( cnrobj.name() ),
strAddress ( cnrobj.address() ),
strPhone ( cnrobj.phone() ),
ulIconId ( cnrobj.iconId() ),
myWin ( cnrobj.myWin )
{
}
/*------------------------------------------------------------------------------
| Custoner::Customer |
| |
| Constructor. |
------------------------------------------------------------------------------*/
Customer :: Customer ( const IString &Text,
unsigned long Icon,
const IString &Name,
const IString &Address,
const IString &Phone,
MyWindow* win ) :
IContainerObject ( Text, Icon ),
strName ( Name ),
strAddress ( Address ),
strPhone ( Phone ),
ulIconId ( Icon ),
myWin ( win )
{
}
/*------------------------------------------------------------------------------
| Customer::objectCopy |
| |
| Make a copy of the Customer object. Called by |
| IContainerObject::copyObjectTo(). |
------------------------------------------------------------------------------*/
IContainerObject* Customer :: objectCopy()
{
/***********************************************************************/
/* Use Customer copy constructor to make a copy of the object. */
/***********************************************************************/
Customer *copy = new Customer(*this);
return((IContainerObject *)copy);
}