home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IDRGEVT_
- #define _IDRGEVT_
- /**************************************************************/
- /* CLASSES NAMES: IBeginDragEvent */
- /* IDragOperationEvent */
- /* IDragOverEvent */
- /* IDropOnEvent */
- /* IDragOverNotificationEvent */
- /* IRenderEvent */
- /* IRenderCompleteEvent */
- /* IEndConversationEvent */
- /* */
- /* DESCRIPTION : This file defines a series of event classes */
- /* for direct manipulation operations. */
- /* */
- /* SYNOPSIS: #include <idrgevt.hpp> */
- /* */
- /* CHANGE ACTIVITY: */
- /* DATE: INITIAL: DESCRIPTION */
- /* */
- /* 050191 PG & KKL Initiate code & design */
- /* 100191 KKL Update per R2.0 spec. */
- /* 111991 KKL Update for new Manipulation cls*/
- /* 170892 PHG Giverny update - redesign */
- /* 071092 PHG Major update */
- /* */
- /**************************************************************/
- /* Copyright (c) IBM Corporation 1991 */
- /**************************************************************/
-
- #ifndef _IBASETYP_
- #include <ibasetyp.hpp>
- #endif
- #ifndef _IRESLIB_
- #include <ireslib.hpp>
- #endif
- #ifndef _IPOINT_
- #include <ipoint.hpp>
- #endif
- #ifndef _IWINDOW_
- #include <iwindow.hpp>
- #endif
- #ifndef _IEVENT_
- #include <ievent.hpp>
- #endif
- #ifndef _IBITFLAG_
- #include <ibitflag.hpp>
- #endif
-
- // forward define classes
- class IDragOperationEvent;
- class IRenderEvent;
- class IEndConversationEvent;
-
- // include D&D related headers
- #ifndef _IDRGSTYL_
- #include <idrgstyl.hpp>
- #endif
- #ifndef _IDRGITM_
- #include <idrgitm.hpp>
- #endif
-
-
- class IBeginDragEvent : public IEvent {
- /**************************************************************************
- * Constructed on WM_BEGINDRAG message *
- * Hungarian is 'idevt' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IBeginDragEvent(const IEvent& evt);
- virtual
- ~IBeginDragEvent();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | isPointerEvent - returns wether the event results from pointer action |
- | pointerPos - returns the pointer position relative to this window |
- +------------------------------------------------------------------------*/
- virtual Boolean
- isPointerEvent() const;
- virtual IPoint
- pointerPos() const;
-
- }; // IBeginDragEvent
-
-
- class IDragOperationEvent : public IEvent {
- /**************************************************************************
- * General base class for target drag operation events *
- * Encapsulates the operations to extract data from a DRAGITEM structure *
- * whose pointer is stored in mp1 (can be overloaded to get pointer *
- * differently) *
- * Provides methods to access the DRAGINFO elements. *
- * Hungarian is 'dopevt' *
- **************************************************************************/
- public:
- /*------------------------ DRAG OPERATION FLAGS --------------------------+
- | These flags are used to qualify a drag operation |
- +------------------------------------------------------------------------*/
- INESTEDBITFLAGCLASSDEF0(Operations, IDragOperationEvent);
- static const Operations
- noop,
- defop,
- unknown,
- copy,
- move,
- link,
- create;
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one way to construct instances of this class |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IDragOperationEvent(const IEvent& evt);
- virtual
- ~IDragOperationEvent();
-
- /*------------------------ HELPER FUNCTIONS ------------------------------+
- | These functions are used to test the state of the Operations flags |
- | isDefault - Test if operation is default |
- | isUnknown - Test if operation is unknown |
- | isCopy - Test if operation is a copy |
- | isMove - Test if operation is a move |
- | isCreate - Test if operation is creation |
- | isLink - Test if operation is a link |
- +------------------------------------------------------------------------*/
- Boolean
- isDefault() const,
- isUnknown() const,
- isCopy() const,
- isMove() const,
- isCreate() const,
- isLink() const;
-
- /*------------------------ DRAGINFO ACCESSORS ----------------------------+
- | Functions to access the drag info information |
- | dragItemsCount - returns count of items dragged |
- | sourceHandle - returns the source window's handle |
- | operations - returns the operations in progress |
- | dropPosition - returns the position of the mouse ptr |
- +------------------------------------------------------------------------*/
- unsigned long
- dragItemsCount() const;
- IWindowHandle
- sourceHandle() const;
- Operations
- operations() const;
- virtual IPoint
- dropPosition() const;
-
- /*------------------------ GENERAL FUNCTIONS -----------------------------+
- | Functions to get information pertaining to the drag in progress |
- | isSameProcess - tells if this the source is in the same process |
- | dragitemPtr - yields a pointer to a given drag item |
- +------------------------------------------------------------------------*/
- Boolean
- isSameProcess() const;
- void*
- dragitemPtr(unsigned long ulItem) const;
-
- protected:
- /*-------------------------------- OVERRIDES -----------------------------+
- | This class defines the following overridable functions: |
- | draginfoPtr - returns the stored draginfo pointer |
- | extractDraginfoPtr - extracts the draginfo pointer from the evt |
- +------------------------------------------------------------------------*/
- void*
- draginfoPtr() const;
- virtual void*
- extractDraginfoPtr() const;
-
- /*-------------------------------- HELPER --------------------------------+
- | Helper utility functions |
- | asOperations - turn an ulOperation passed by PM to a IDragOperation |
- +------------------------------------------------------------------------*/
- Operations
- asOperations(unsigned long ulOperation) const;
-
- private:
- /*-------------------------- PRIVATE FUNCTIONS ---------------------------+
- | Private functions |
- | accessDragInfo - To access the DRAGINFO structure |
- | freeDragInfo - To free the DRAGINFO structure if different process |
- +------------------------------------------------------------------------*/
- IDragOperationEvent
- &accessDragInfo(),
- &freeDragInfo();
-
- /*----------------------------- PRIVATE DATA -----------------------------+
- | Private data members |
- | pClDragInfo - Stored DRAGINFO pointer |
- +------------------------------------------------------------------------*/
- void* pClDragInfo;
-
- }; // IDragOperationEvent
-
-
- class IDragOverEvent : public IDragOperationEvent {
- /**************************************************************************
- * Event to encapsulate the drag over messages *
- * Hungarian is 'dovevt' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IDragOverEvent(const IEvent& evt);
- virtual
- ~IDragOverEvent();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | dropPosition - returns the drop position from msg param 2 |
- | setDragPointer - sets the drag pointer from resource or icon |
- | setDragSysPointer - sets the drag pointer from system icons |
- | defaultOperation - returns the default operation |
- | setDefaultOperation - sets the default operation |
- +------------------------------------------------------------------------*/
- virtual IPoint
- dropPosition() const;
-
- IDragOverEvent
- &setDragPointer(IResourceId& resid),
- &setDragPointer(IPointerHandle ptrhDrag),
- &setDragSysPointer(long lSysPtr);
-
- Operations
- defaultOperation();
- IDragOverEvent
- &setDefaultOperation(const Operations& drgopDefault);
-
- //!PHG!: missing: functions to set the drag images - wait for BBXX Sets
-
- private:
- /*----------------------------- PRIVATE DATA -----------------------------+
- | Private data members |
- | drgopClDefault - current default operation for event |
- +------------------------------------------------------------------------*/
- Operations drgopClDefault;
- }; // IDragOverEvent
-
-
- class IDropOnEvent : public IDragOperationEvent {
- /**************************************************************************
- * Event to encapsulate the drop on messages *
- * Hungarian is 'donevt' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IDropOnEvent(const IEvent& evt);
- virtual
- ~IDropOnEvent();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | operation - returns the operation for the drop |
- +------------------------------------------------------------------------*/
- Operations
- operation() const;
-
- }; // IDropOnEvent
-
-
- class IRenderEvent : public IEvent {
- /**************************************************************************
- * This class encapsulates the DM_RENDER event used for rendering *
- * in direct manipulation operations. *
- * Hungarian is 'rendevt' *
- **************************************************************************/
- public:
- INESTEDBITFLAGCLASSDEF0(Operation, IRenderEvent);
- static const Operation
- copy,
- link,
- move;
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IRenderEvent(const IEvent& evt);
-
- virtual
- ~IRenderEvent();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting information of the rendering |
- | request, and set some of the attributes |
- | wndhClient - handle of the render requester at target |
- | itemId - ID of the item to render |
- | selectedRMF - RMF to render to |
- | nameToRender - name to render to |
- | targetInfo - target-specific information |
- | setTargetInfo- set the target-specific information |
- | operation - required operation to perform |
- +------------------------------------------------------------------------*/
- IWindowHandle
- wndhClient() const;
- unsigned long
- itemId() const;
- IString
- selectedRMF() const,
- nameToRender() const;
- unsigned long
- targetInfo() const;
- void
- setTargetInfo(unsigned long ulNewTargetInfo);
- Operation
- operation() const;
-
- /*-------------------------------- UTILITY -------------------------------+
- | Utility functions |
- | dragtransferPtr - get to the dragtransfer pointer |
- | isSameProcess - find out if the target is in the same process |
- +------------------------------------------------------------------------*/
- void*
- dragtransferPtr() const;
- Boolean
- isSameProcess() const;
-
- /*----------------------------- IMPLEMENTATION ---------------------------+
- | Management of the DRAGTRANSFER structure |
- | forceFreeXFer - force a free of the dragtransfer upon deletion |
- +------------------------------------------------------------------------*/
- protected:
- void
- forceFreeXFer();
-
- private:
- /*----------------------------- PRIVATE DATA MANAGEMENT ------------------+
- | Instance flag and function to control the freeing of the DRAGTRANSFER |
- | freeXFer - free the structure |
- | bForceFreeXFer - flag to say if the structure has to be freed |
- +------------------------------------------------------------------------*/
- void
- freeXFer();
- Boolean
- bForceFreeXFer;
-
- };// IRenderEvent
-
-
- class IRenderCompleteEvent : public IRenderEvent {
- /**************************************************************************
- * Event to encapsulate the DM_RENDERCOMPLETE event *
- * Hungarian is 'rendcompevt' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IRenderCompleteEvent(const IEvent& evt);
- virtual
- ~IRenderCompleteEvent();
-
- // test render flags
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of testing the event's success flags |
- | isRenderOK - Test if the rendering has completed successfully |
- | isRenderRetry - Test if the rendering has to be retryed |
- +------------------------------------------------------------------------*/
- Boolean
- isRenderOK() const,
- isRenderRetry() const;
-
- }; // IRenderCompleteEvent
-
- class IEndConversationEvent : public IEvent {
- /**************************************************************************
- * Event to encapsulate the endconversation event *
- * Hungarian is 'endconvevt' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IEndConversationEvent(const IEvent& evt);
- virtual
- ~IEndConversationEvent();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting to the event's characteristics |
- | itemId - ID of the item for which conversation ends |
- | isRenderSuccess - Test if the rendering has gone OK |
- +------------------------------------------------------------------------*/
- unsigned long
- itemId() const;
- Boolean
- isRenderSuccess() const;
-
- };// IEndConversationEvent
-
- class IUDragDropRender : public IEvent {
- /**************************************************************************
- * Class to encapsulate a private message used to trigger rendering of *
- * a specific item *
- * Note: This message's implementation may change, as there are pending *
- * problems if too many message are posted to a busy queue *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1 - From an untyped generic IEvent |
- +------------------------------------------------------------------------*/
- IUDragDropRender(const IEvent& evt);
- virtual
- ~IUDragDropRender();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting the accessible params for this |
- | event. |
- | dragxferPtr - get to the dragtransfer pointer for item to render |
- +------------------------------------------------------------------------*/
- void*
- dragxferPtr() const;
- };// IUDragDropRender
-
-
- /*=========================================================================
- | Inlines for IBeginDragEvent PHG 22/10 |
- =========================================================================*/
- inline IBeginDragEvent :: IBeginDragEvent(const IEvent& evt)
- : IEvent(evt) { }
- inline IBeginDragEvent :: ~IBeginDragEvent()
- { }
-
- /*=========================================================================
- | Inlines for IDragOperationEvent PHG 22/10 |
- =========================================================================*/
- inline Boolean IDragOperationEvent :: isDefault() const
- { return( operations().asUnsignedLong() == defop.asUnsignedLong() ); }
-
- inline Boolean IDragOperationEvent :: isUnknown() const
- { return( operations().asUnsignedLong() == unknown.asUnsignedLong() ); }
-
- inline Boolean IDragOperationEvent :: isCopy() const
- { return( !(isDefault() || isUnknown()) && (operations().asUnsignedLong() & copy.asUnsignedLong() )==copy.asUnsignedLong() ); }
-
- inline Boolean IDragOperationEvent :: isMove() const
- { return( !(isDefault() || isUnknown()) && (operations().asUnsignedLong() & move.asUnsignedLong() )==move.asUnsignedLong() ); }
-
- inline Boolean IDragOperationEvent :: isCreate() const
- { return( !(isDefault() || isUnknown()) && (operations().asUnsignedLong() & create.asUnsignedLong())==create.asUnsignedLong()); }
-
- inline Boolean IDragOperationEvent :: isLink() const
- { return( !(isDefault() || isUnknown()) && (operations().asUnsignedLong() & link.asUnsignedLong() )==link.asUnsignedLong() ); }
-
- inline IDragOperationEvent::Operations IDragOperationEvent :: asOperations(unsigned long ulOperation) const
- { return(ulOperation); }
-
-
- /*=========================================================================
- | Inlines for IDragOverEvent PHG 22/10 |
- =========================================================================*/
- inline IDragOperationEvent::Operations IDragOverEvent :: defaultOperation()
- { return(drgopClDefault); }
-
- inline IDragOverEvent& IDragOverEvent :: setDefaultOperation(
- const IDragOperationEvent::Operations& drgopDefault)
- { drgopClDefault=drgopDefault; return(*this); }
-
- /*=========================================================================
- | Inlines for IDropOnEvent PHG 22/10 |
- =========================================================================*/
- inline IDropOnEvent :: IDropOnEvent(const IEvent& evt)
- : IDragOperationEvent(evt) { }
- inline IDropOnEvent :: ~IDropOnEvent()
- { }
-
- /*=========================================================================
- | Inlines for IRenderEvent PHG 22/10 |
- =========================================================================*/
- inline IRenderEvent :: IRenderEvent(const IEvent& evt)
- : IEvent(evt) { bForceFreeXFer=false; }
-
- inline IRenderEvent :: ~IRenderEvent()
- { freeXFer(); }
-
- inline void IRenderEvent :: forceFreeXFer()
- { bForceFreeXFer=true; }
-
-
- /*=========================================================================
- | Inlines for IRenderCompleteEvent PHG 22/10 |
- =========================================================================*/
- inline IRenderCompleteEvent :: IRenderCompleteEvent(const IEvent& evt)
- :IRenderEvent(evt) { forceFreeXFer(); }
-
- inline IRenderCompleteEvent :: ~IRenderCompleteEvent()
- { }
-
-
- /*=========================================================================
- | Inlines for IEndConversationEvent PHG 22/10 |
- =========================================================================*/
- inline IEndConversationEvent :: IEndConversationEvent(const IEvent& evt)
- :IEvent(evt) { }
-
- inline IEndConversationEvent :: ~IEndConversationEvent()
- { }
-
- /*=========================================================================
- | Inlines for IUDragDropRender PHG 22/10 |
- =========================================================================*/
- inline IUDragDropRender :: IUDragDropRender(const IEvent& evt)
- : IEvent(evt) { }
- inline IUDragDropRender :: ~IUDragDropRender()
- { }
- inline void* IUDragDropRender :: dragxferPtr() const
- { return((void*)param1()); }
-
- #endif /* ifndef _IDRGEVT_ */