home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IDMOPER.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
12KB
|
254 lines
#ifndef _IDMOPER_
#define _IDMOPER_
/*******************************************************************************
* FILE NAME: idmoper.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* IDMOperation - Direct manipulation operation common base class, *
or abstract class. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IREFCNT_
#include <irefcnt.hpp>
#endif
#ifndef _IPOINT_
#include <ipoint.hpp>
#endif
#ifndef _IHANDLE_
#include <ihandle.hpp>
#endif
#ifndef _IDMITEM_
#include <idmitem.hpp>
#endif
#ifndef _IDMCOMM_
#include <idmcomm.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
/* Forward Declarations */
struct _DRAGINFO;
class IContainerObject;
class IDMSourceBeginEvent;
class IDMTargetEnterEvent;
class IDMItemSeq;
class IDMOperation : public IRefCounted {
typedef IRefCounted
Inherited;
typedef IDM::Source
Source;
/*******************************************************************************
* This is the common base class, or abstract class, for the direct manipulation*
* source and target drag operation classes. Objects of this class provide *
* general-purpose information about direct manipulation operations. Access *
* to this information is gained through its derived classes. *
* *
* Objects of this class possess information about the direct manipulation *
* operation as a whole: *
* - Operation type (for example, copy, move, or link) *
* - Position of the pointing device within the source or target window *
* - Source of the operation (pointing device versus keyboard) *
* - Generic drag item handle *
* - Number of associated drag items, IDMItems *
* - Pointer to the collection of IDMItems *
* - A collection of IDMItem objects, one for each item being dragged *
* during this operation. *
* *
* Instances of this class are not intended to be created by application *
* programmers. Generally, instances are created only by their subclasses that *
* require this information. *
*******************************************************************************/
public:
/*-------------------------------- Operations ----------------------------------
| The following functions deal with the default operation attribute in |
| instances of this class: |
| operation - Returns the default direct manipulation operation. |
| setOperation - Sets the default direct manipulation operation. |
| |
| The following static members provide the set of pre-defined operation codes: |
| drag - Default drag (no augmentation keys are pressed). |
| copy - Copy (the copy augmentation key is pressed). |
| link - Link (the link augmentation key(s) is(are) pressed). |
| move - Move (the move augmentation key is pressed). |
| unknown - Unknown (application-defined operation codes should |
| be assigned values greater than this). |
------------------------------------------------------------------------------*/
virtual unsigned long
operation ( ) const;
virtual IDMOperation
&setOperation ( unsigned long op );
static const unsigned long
drag,
copy,
link,
move,
unknown;
/*-------------------------------- Accessors -----------------------------------
| These functions provide read/write access to attributes of instances of |
| this class: |
| position - Returns the drag or drop position within the |
| source or target window. |
| source - Returns the source of the direct manipulation |
| operation (i.e. always pointing device) |
| sourceWindowHandle - Returns the handle of the source window for the |
| direct manipulation operation. |
| targetWindowHandle - Returns the handle of the target window for the |
| direct manipulation operation. |
| sourceWindow - Returns a pointer to the source window for the |
| direct manipulation operation. |
| targetWindow - Returns a pointer to the target window for the |
| direct manipulation operation. |
| setSource - Sets the source of the direct manipulation |
| operation. |
| setPosition - Sets the pointing device position for the direct |
| manipulation operation. |
| setSourceWindowHandle - Sets the source window handle of the direct |
| manipulation operation during a source begin event.|
| setTargetWindowHandle - Sets the target window handle of the direct |
| manipulation operation during a target enter event.|
------------------------------------------------------------------------------*/
virtual IPoint
position ( ) const;
virtual Source
source ( ) const;
virtual IWindowHandle
sourceWindowHandle ( ) const,
targetWindowHandle ( ) const;
virtual IWindow
*sourceWindow ( ) const,
*targetWindow ( ) const;
virtual IDMOperation
&setSource ( Source source ),
&setPosition ( IPoint position ),
&setSourceWindowHandle ( IWindowHandle window ),
&setTargetWindowHandle ( IWindowHandle window );
/*-------------------------------- Drag Items ----------------------------------
| The following functions provide a means of accessing the IDMItem objects |
| involved in the direct manipulation operation described by instances of |
| this class: |
| numberOfItems - Returns the number of drag items. |
| item - Returns the drag item with a given position. 0 is |
| returned if the position is invalid. |
| replaceItem - Replaces a given drag item with another. |
| addItem - Associates another drag item with this operation. |
| removeItem - Removes a drag item from the operation, using either a |
| position or the drag item handle. |
| |
| Note: Items are maintained positionally, which is 1-based. |
------------------------------------------------------------------------------*/
unsigned
numberOfItems ( );
IDMItem::Handle
item ( unsigned position );
IDMOperation
&replaceItem ( unsigned position,
const IDMItem::Handle &replacement ),
&addItem ( const IDMItem::Handle &newItem ),
&removeItem ( unsigned position ),
&removeItem ( const IDMItem::Handle &itemToRemove );
/*------------------------------ Container Support -----------------------------
| The following functions facilitates container support in the operation: |
| containerObject - Returns the pointer to a container object. |
| setContainerObject - Sets a pointer to a container object. |
------------------------------------------------------------------------------*/
IContainerObject
*containerObject ( ) const;
IDMOperation
&setContainerObject ( IContainerObject *object );
protected:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed by providing the following: |
| - Reference to the source begin event |
| - Reference to the target enter event |
------------------------------------------------------------------------------*/
IDMOperation ( IDMSourceBeginEvent &event );
IDMOperation ( IDMTargetEnterEvent &event );
virtual
~IDMOperation ( );
/*------------------------------ Implementation --------------------------------
| The following functions provide various utility services used to implement |
| this class: |
| dragInfo - Returns the handle to the drag information. |
| setDragInfo - Sets the handle to the drag information. |
------------------------------------------------------------------------------*/
_DRAGINFO
*dragInfo ( ) const;
IDMOperation
&setDragInfo ( _DRAGINFO *dragInfo );
private: /*------------------------ PRIVATE ----------------------------------*/
unsigned long
op;
IWindowHandle
srcWindowHandle,
tgtWindowHandle;
Source
src;
IPoint
pos;
IContainerObject
*pCnrObj;
_DRAGINFO
*pPMDragInfo;
IDMItemSeq
*pDMItemSeqCl;
IDMItemSeq
*itemCollection ();
}; // class IDMOperation
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#ifndef I_NO_INLINES
#include <idmoper.inl>
#endif
#endif //_IDMOPER_