home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IDMEVENT.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
35KB
|
779 lines
#ifndef _IDMEVENT_
#define _IDMEVENT_
/*******************************************************************************
* FILE NAME: idmevent.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* IDMEvent *
* *
* IDMSourceBeginEvent *
* IDMSourceRenderEvent *
* IDMSourcePrepareEvent *
* IDMSourceEndEvent *
* IDMSourceDiscardEvent *
* IDMSourcePrintEvent *
* *
* IDMTargetEnterEvent *
* IDMTargetLeaveEvent *
* IDMTargetDropEvent *
* IDMTargetHelpEvent *
* IDMTargetEndEvent *
* *
* 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 _IEVENT_
#include <ievent.hpp>
#endif
#ifndef _IDMITEM_
#include <idmitem.hpp>
#endif
#ifndef _IDMSRCOP_
#include <idmsrcop.hpp>
#endif
#ifndef _IDMCOMM_
#include <idmcomm.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
/* Forward Declarations */
struct _DRAGTRANSFER;
struct _DRAGITEM;
struct _PRINTDEST;
class IPoint;
class IWindowHandle;
class IString;
class IContainerObject;
class IContainerControl;
class IDMSourceOperation;
class IDMEvent : public IEvent {
typedef IEvent
Inherited;
/*******************************************************************************
* This is the common base class for all direct manipulation event classes. *
*******************************************************************************/
public:
/*----------------------- Constructor/Destructor ------------------------------|
| Instances of this class are constructed from a generic IEvent. |
------------------------------------------------------------------------------*/
IDMEvent ( const IEvent &event );
virtual
~IDMEvent ( );
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
};
class IDMSourceBeginEvent : public IDMEvent {
typedef IDMEvent
Inherited;
typedef IDM::Source
Source;
/*******************************************************************************
* Objects of this class represent the event that occurs upon initiation *
* of a direct manipulation event at the source window. Instances are *
* passed as argument to the IDMSourceHandler functions setup() and *
* begin() functions. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourceBeginEvent ( const IEvent &event );
virtual
~IDMSourceBeginEvent ( );
/*--------------------------------- Accessors ----------------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| source - Returns the source of the drag operation. |
| position - Returns the pointing device position (only if source is |
| pointingDevice). |
------------------------------------------------------------------------------*/
virtual Source
source ( ) const;
virtual IPoint
position ( ) const;
/*---------------------------- Container Support ------------------------------+
| These methods provide a means of getting and setting the container |
| attributes of instances of this class: |
| containerId - Returns the source container's ID. |
| object - Returns a pointer to the object over which the drag |
| started. Returns 0 if drag started over container |
| "white space" or if non-container. |
| container - Returns a pointer to the source container for which the |
| event occurred. |
| offset - Returns the position of the pointing device relative to |
| the source container object's origin. |
+-----------------------------------------------------------------------------*/
virtual unsigned long
containerId ( ) const;
virtual IContainerObject
*object ( ) const;
virtual IContainerControl
*container ( ) const;
virtual ISize
offset ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
Source
src;
}; // IDMSourceBeginEvent
class IDMSourceRenderEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
* Objects of this class represent direct manipulation "rendering" events. *
* Such events are created and dispatched to source handlers when a direct *
* manipulation target handler requests source rendering. *
* *
* In addition to the standard IEvent attributes (event and window *
* identifiers), such objects also possess: *
* o an associated IDMItem *
* o an alternate window handle *
* o a target window handle *
* o a rendering mechanism/format selected by the target *
* o a target name *
* o an arbitrary target "information" (an unsigned long) *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourceRenderEvent ( const IEvent &event );
virtual
~IDMSourceRenderEvent ( );
/*-------------------------------- Accessors -----------------------------------
| The following functions provide read/write access to the accessible |
| attributes of instances of this class: |
| dragItem - Returns handle to the IDMItem corresponding to |
| the item being rendered. |
| alternateWindow - Returns a pointer to the alternate source window. |
| alternateWindowHandle - Returns the handle of the alternate source window. |
| selectedMechanism - Returns the selected rendering mechanism. |
| selectedFormat - Returns the selected rendering format. |
| targetName - Returns the target "render to" name. |
| targetInfo - Returns the target-defined "information." |
| setTargetInfo - Can be used to pass information to the target |
| targetWindow - Returns a pointer to the target window. |
| targetWindowHandle - Returns the handle of the target window. |
| canRetry - Indicates whether renderer processing this event |
| will be allowed to retry if a failure occurs. |
| setRetry - Sets the retry flag. |
| completion - Returns the flag which indicates a successful |
| completion or not. |
| setCompletion - Sets the completion flag. |
------------------------------------------------------------------------------*/
virtual IDMItem::Handle
dragItem ( ) const;
virtual IWindow
*alternateWindow ( ) const,
*targetWindow ( ) const;
virtual IWindowHandle
alternateWindowHandle ( ) const,
targetWindowHandle ( ) const;
virtual IString
selectedMechanism ( ) const,
selectedFormat ( ) const,
targetName ( ) const;
virtual unsigned long
targetInfo ( ) const;
virtual Boolean
canRetry ( ) const;
virtual IDMSourceRenderEvent
&setTargetInfo ( unsigned long info ),
&setRetry ( Boolean allowRetry = true ),
&setCompletion ( IDM::RenderCompletion code );
virtual IDM::RenderCompletion
completion ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
friend class IDMSourcePrepareEvent;
friend class IDMSourceRenderer;
IDMItem::Handle
pDMSrcItemHandle;
IString
strSelMechanism,
strSelFormat,
strTgtName;
Boolean
bRetry;
IDM::RenderCompletion
rcCompletion;
_DRAGTRANSFER
*pPMDragTransfer;
IWindowHandle
tgtWindowHandle;
_DRAGTRANSFER
*dragTransfer ( ) const;
}; // IDMSourceRenderEvent
class IDMSourcePrepareEvent : public IDMSourceRenderEvent {
typedef IDMSourceRenderEvent
Inherited;
/*******************************************************************************
* These events are sent to the source window when the source renderer for a *
* given object has indicated such notification is necessary prior to starting *
* the source rendering of a drag item. *
* *
* Objects of this class provide all the "query" functions inherited from *
* IDMSourceRenderEvent. In addition, functions are provided to provide *
* return information to the target: *
* o an alternate source window that the target should communicate with *
* during rendering *
* o two result flags indicating whether rendering should be done by the *
* target and/or whether the target should retry with a different *
* rendering mechanism and format. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourcePrepareEvent ( const IEvent &event );
virtual
~IDMSourcePrepareEvent ( );
/*-------------------------------- Accessors -----------------------------------
| The following functions provide read/write access to the accessible |
| attributes of instances of this class: |
| alternateWindow - Returns a pointer to the alternate source |
| window. |
| alternateWindowHandle - Returns the handle of the alternate source |
| window. |
| setAlternateWindowHandle - Sets alternate source window handle. |
------------------------------------------------------------------------------*/
virtual IWindow
*alternateWindow ( ) const;
virtual IWindowHandle
alternateWindowHandle ( ) const;
IDMSourcePrepareEvent
&setAlternateWindowHandle ( const IWindowHandle &window );
/*---------------------------------- Result ------------------------------------
| These functions provide means of specifying render preparation results to |
| be passed back to the target: |
| targetCanRetry - Returns current setting of the "retry" flag. |
| noSourceRendering - Returns current "no source rendering" flag. |
| setTargetCanRetry - Sets "retry" flag. |
| setNoSourceRendering - Sets "no source rendering" flag. |
------------------------------------------------------------------------------*/
Boolean
targetCanRetry ( ) const,
noSourceRendering ( ) const;
IDMSourcePrepareEvent
&setTargetCanRetry ( Boolean flag ),
&setNoSourceRendering ( Boolean flag );
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
Boolean
bTgtCanRetry,
bNoSrcRendering;
}; // IDMSourcePrepareEvent
class IDMSourceEndEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
* These events are sent to the direct manipulation source window when a *
* target renderer has completed the rendering of a drag item. One such *
* event is expected for each of the drag items involved in the direct *
* manipulation operation. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourceEndEvent ( const IEvent &event );
virtual
~IDMSourceEndEvent ( );
/*-------------------------------- Accessors -----------------------------------
| These functions provide access to attributes of instances of this class: |
| dragItem - Returns handle of drag item the target has |
| completed rendering of. |
| wasTargetSuccessful - Returns whether target successfully completed its |
| rendering. |
------------------------------------------------------------------------------*/
virtual IDMItem::Handle
dragItem ( ) const;
virtual Boolean
wasTargetSuccessful ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
Boolean
bWasTgtSuccessful;
IDMItem::Handle
pDMSrcItemHandle;
}; // IDMSourceEndEvent
class IDMSourceDiscardEvent : public IDMEvent {
typedef IDMEvent
Inherited;
typedef IDM::DiscardIndicator
DiscardIndicator;
/*******************************************************************************
* Events of this class are sent to the source window when the dragged objects *
* are dropped on a shredder object. The event essentially returns an *
* indicator to the target identifying who has responsibility for deletion of *
* the item(s) or an indicator that aborts the discard operation. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourceDiscardEvent ( const IEvent &event );
virtual
~IDMSourceDiscardEvent ( );
/*-------------------------------- Accessors -----------------------------------
| These functions provide access to attributes of instances of this class: |
| sourceOperation - Returns the source operation for this event. |
| setSourceOperation - Sets the source operation for this event. |
| whoDiscards - Returns discard indicator that identifies who should |
| delete the item(s). |
| setWhoDiscards - Set the discard indicator. IDM::sourceDiscards is |
| the default. |
------------------------------------------------------------------------------*/
IDMSourceOperation::Handle
sourceOperation ( ) const;
virtual DiscardIndicator
whoDiscards ( ) const;
IDMSourceDiscardEvent
&setSourceOperation ( const IDMSourceOperation::Handle &operation ),
&setWhoDiscards ( DiscardIndicator indicator );
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
IDMSourceOperation::Handle
pSrcOpH;
DiscardIndicator
discardInd;
}; // IDMSourceDiscardEvent
class IDMSourcePrintEvent : public IDMEvent {
typedef IDMEvent
Inherited;
typedef IDM::PrintIndicator
PrintIndicator;
/*******************************************************************************
* Events of this class are sent to the source window when the dragged objects *
* are dropped on a printer object. The event essentially returns an *
* indicator to the target identifying who has responsibility for printing *
* the item(s) or an indicator that aborts the print operation. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMSourcePrintEvent ( const IEvent &event );
virtual
~IDMSourcePrintEvent ( );
/*-------------------------------- Accessors -----------------------------------
| These functions provide access to attributes of instances of this class: |
| sourceOperation - Returns the source operation for this event. |
| setSourceOperation - Sets the source operation for this event. |
| whoPrints - Returns print indicator that identifies who should |
| print the item(s). |
| setWhoPrints - Set the print indicator. IDM::sourcePrints is |
| the default. |
| printDestination - Returns pointer to the print destination for this |
| event. |
------------------------------------------------------------------------------*/
IDMSourceOperation::Handle
sourceOperation ( ) const;
virtual PrintIndicator
whoPrints ( ) const;
IDMSourcePrintEvent
&setSourceOperation ( const IDMSourceOperation::Handle &operation ),
&setWhoPrints ( PrintIndicator indicator );
_PRINTDEST
*printDestination ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
IDMSourceOperation::Handle
pSrcOpH;
PrintIndicator
printInd;
}; // IDMSourcePrintEvent
class IDMTargetEnterEvent : public IDMEvent {
typedef IDMEvent
Inherited;
typedef IDM::DropIndicator
DropIndicator;
/*******************************************************************************
* Instances of this class encapsulate direct manipulation events that *
* occur at the target handler when a drag operation enters a potential *
* target window. Target handlers access information about the dragged *
* items from the associated IDMTargetOperation object *
* *
* The event result field is of particular importance for these event objects. *
* The result will indicate whether the dragged object(s) can be dropped on *
* this target, and if so, what the default operation would be. This class *
* provides specialized functions to set the components of the event result. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMTargetEnterEvent ( const IEvent &event );
virtual
~IDMTargetEnterEvent ( );
/*--------------------------------- Accessors ----------------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| position - Returns the pointing device position. |
------------------------------------------------------------------------------*/
virtual IPoint
position ( ) const;
/*---------------------------------- Result ------------------------------------
| These functions provide means of querying and setting the components of |
| the event result: |
| dropIndicator - Returns indicator of whether drop is allowed. |
| setDropIndicator - Sets indicator of whether drop is allowed. |
| defaultOperation - Returns the default operation for this target. |
| setDefaultOperation - Sets the default operation for this target. |
------------------------------------------------------------------------------*/
virtual DropIndicator
dropIndicator ( ) const;
virtual unsigned long
defaultOperation ( ) const;
IDMTargetEnterEvent
&setDropIndicator ( DropIndicator indicator ),
&setDefaultOperation ( unsigned long operation );
/*---------------------------- Container Support ------------------------------+
| These methods provide a means of getting and setting the container |
| attributes of instances of this class: |
| isDragAfter - Queries whether the event is a drag-after or drag-over |
| event. |
| isAboveFirst - Queries whether drag-after has occurred above the first |
| object in the list. |
| containerId - Returns the target container's ID. |
| object - Returns a pointer to the object over which the drag-after |
| or drag-over event occurred. Returns 0 if drag was |
| over container "white space" or if non-container window. |
| container - Returns a pointer to the container where the drag-after |
| or drag-over event occurred. |
+-----------------------------------------------------------------------------*/
virtual Boolean
isDragAfter ( ) const,
isAboveFirst ( ) const;
virtual unsigned long
containerId ( ) const;
virtual IContainerObject
*object ( ) const;
virtual IContainerControl
*container ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
DropIndicator
dropInd;
unsigned long
op;
}; // IDMTargetEnterEvent
class IDMTargetLeaveEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
* Events of this class are sent to the target window when either the dragged *
* objects leave the window or the operation is terminated while the objects *
* are over the window. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMTargetLeaveEvent ( const IEvent &event );
virtual
~IDMTargetLeaveEvent ( );
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
}; // IDMTargetLeaveEvent
class IDMTargetDropEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
* Instances of this class encapsulate direct manipulation events that *
* occur at the target handler when a drop occurs on a target window. *
* Target handlers access information about the dragged items from the *
* stored IDMTargetOperation object that was created as part of the *
* IDMTargetEnterEvent processing. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMTargetDropEvent ( const IEvent &event );
virtual
~IDMTargetDropEvent ( );
/*--------------------------------- Accessors ----------------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| dropPosition - Returns the position, expressed in desktop coordinates, |
| where the drop occurred. |
| setDropPosition - Sets the position, expressed in desktop coordinates, |
| where the drop occurred. |
| targetInfo - Returns the target-defined "information." |
| setTargetInfo - Can be used to pass information to the target |
------------------------------------------------------------------------------*/
virtual IPoint
dropPosition ( ) const;
virtual unsigned long
targetInfo ( ) const;
virtual IDMTargetDropEvent
&setDropPosition ( const IPoint &position ),
&setTargetInfo ( unsigned long info );
/*----------------------------- Container Support ------------------------------
| These functions provide drop support for the container drop event: |
| containerId - Returns the target container's ID. |
| object - Returns a pointer to the object over which the drop-on |
| event occurred. Returns 0 if drop was on container |
| "white space" or non-container window. |
| container - Returns a pointer to the container where the drop-on |
| event occurred. |
------------------------------------------------------------------------------*/
virtual unsigned long
containerId ( ) const;
virtual IContainerObject
*object ( ) const;
virtual IContainerControl
*container ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
IPoint
pos;
unsigned long
ulTgtInfo;
}; // IDMTargetDropEvent
class IDMTargetHelpEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
* Events of this class are sent to the target window when help is requested *
* while the objects are over the window. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMTargetHelpEvent ( const IEvent &event );
virtual
~IDMTargetHelpEvent ( );
/*--------------------------------- Accessors ----------------------------------
| This function provides means of getting the accessible attributes of |
| instances of this class: |
| operation - Returns the operation (i.e. move, copy, or link) which can be |
| used to provide help in the context of the drag operation. |
------------------------------------------------------------------------------*/
virtual unsigned long
operation ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
}; // IDMTargetHelpEvent
class IDMTargetEndEvent : public IDMEvent {
typedef IDMEvent
Inherited;
/*******************************************************************************
These events occur when the source window has completed rendering of a
given drag item, and has indicated so to the target. The event provides
source window information about the item rendering results.
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed from generic IEvent objects. |
------------------------------------------------------------------------------*/
IDMTargetEndEvent ( const IEvent &event );
virtual
~IDMTargetEndEvent ( );
/*--------------------------------- Accessors ----------------------------------
| This function provides means of getting and setting the accessible |
| attributes of instances of this class: |
| dragItem - Returns handle of the drag item that source has |
| completed renderering. |
| alternateWindow - Returns a pointer to the alternate source |
| window. |
| alternateWindowHandle - Returns the handle of the alternate source |
| window. |
| targetInfo - Returns the target-defined "information." |
------------------------------------------------------------------------------*/
virtual IDMItem::Handle
dragItem ( ) const;
virtual IWindow
*alternateWindow ( ) const;
virtual IWindowHandle
alternateWindowHandle ( ) const;
virtual unsigned long
targetInfo ( ) const;
/*---------------------------------- Result ------------------------------------
| These functions provide access to rendering result information returned |
| by the source window: |
| renderingFailed - Source is unable to perform the rendering operation. |
| The target may be allowed to retry, but if it |
| chooses not to, it must call informSourceOfCompletion() |
| to end the operation. |
| targetCanRetry - Source has completed the rendering operation and will |
| allow the target to retry its part of the operation |
| if it fails. |
------------------------------------------------------------------------------*/
Boolean
renderingFailed ( ) const,
targetCanRetry ( ) const;
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
IDMItem::Handle
targetItemFromPM (_DRAGITEM *pDragItem);
IDMItem::Handle
pDMTgtItemHandle;
unsigned long
usCompletion;
_DRAGTRANSFER
*pPMDragTransfer;
_DRAGTRANSFER
*dragTransfer() const;
}; // IDMTargetEndEvent
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#ifndef I_NO_INLINES
#include <idmevent.inl>
#endif
#endif //_IDMEVENT_