home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IDRGTGTH_
- #define _IDRGTGTH_
- /*--------------------------------------------------------------*/
- /* CLASS NAMES: IDragTargetHandler */
- /* */
- /* DESCRIPTION : Target drag handler. */
- /* Handles: IDragOverEvent */
- /* IDropOnEvent */
- /* */
- /* CHANGE ACTIVITY: */
- /* --------------- */
- /* DATE: INITIAL: DESCRIPTION: */
- /* --/--/91/92 RDL & Co IDRGMAN.?PP */
- /* 08/19/92 PHG Created from IDrgMan stuff */
- /* */
- /*--------------------------------------------------------------*/
- /* Copyright (c) IBM Corporation 1991 */
- /*--------------------------------------------------------------*/
-
- // classes forward definitions
- class IDragTargetHandler;
- class IDropCatcher;
- class IDropCatcherSet;
- class IDxferAssoc;
- class IDxferAssocSet;
-
- // include ICLUI base definitions
- #ifndef _IBASETYP_
- #include <ibasetyp.hpp>
- #endif
- #ifndef _ISTRING_
- #include <istring.hpp>
- #endif
- #ifdef _USEBB_
- #ifndef _ISET_H
- #include <iset.h>
- #endif
- #else
- #ifndef _ISET_
- #include <iset.hpp>
- #endif
- declare(IGSet1, IDropCatcher);
- declare(IGSet1, IDxferAssoc)
- #endif
-
- #ifndef _IWINDOW_
- #include <iwindow.hpp>
- #endif
- #ifndef _IHANDLER_
- #include <ihandler.hpp>
- #endif
-
- // include Drag&Drop specific definitions
- #ifndef _IDRGEVT_
- #include <idrgevt.hpp>
- #endif
- #ifndef _IDRGITM_
- #include <idrgitm.hpp>
- #endif
- #ifndef _IDRPCTCH_
- #include <idrpctch.hpp>
- #endif
-
- ////////////////////////////////////////////////////////////////////
- // !PHG! --- TO DO -- !PHG!
- // Implement messages:
- // - DM_DROPHELP
- // - DM_DRAGLEAVE
- //
- // droptype: accept or not partial drops
- ////////////////////////////////////////////////////////////////////
-
- class IDxferAssoc : public IBase {
- /**************************************************************************
- * Class for association of a pdxfer, a hwndSource and a dropcatcher *
- * NOTE: This will be a nested private class when migrated to Boeblingen's*
- * KeySet later on *
- * This is a class for private use by IDragTargetHandler *
- **************************************************************************/
- friend class IDragTargetHandler;
- friend class IDxferAssocSet;
-
- private:
- IDxferAssoc(const void* pdragtransfer,
- IWindowHandle wndhSource,
- const IDropCatcher* pdrpctch) :
- pdragtransferCl(pdragtransfer),
- wndhClSource(wndhSource),
- pdrpctchCl(pdrpctch)
- { };
-
- // required == operator for IGSet1
- Boolean
- operator==(IDxferAssoc& dxas) const
- { return(dxas.pdragtransferCl==pdragtransferCl); }
-
- // associated data
- const void* pdragtransferCl;
- IWindowHandle wndhClSource;
- const IDropCatcher* pdrpctchCl;
- };
-
- class IDragTargetHandler : public IHandler {
- /**************************************************************************
- * Handler to intercept Drag&Drop messages on the target side and process *
- * them. *
- * This handler has a collection of IDropCather instances, which are *
- * used to catch drops and perform whatever action id required by the *
- * RMFs implemented by the catcher. *
- * *
- * EXAMPLE: *
- * {IDragTargetHandler* ptgth=new IDragTargetHandler(); *
- * IDropCatcher* pctch=new IDropCatcher(...); *
- * IWindow* pwnd=new IWindow(...); *
- * *
- * ptgth->dropCatcherList().add(pctch); *
- * pwnd->addHandler(ptgth); *
- * } *
- **************************************************************************/
- public:
- #ifdef _USEBB_
- typedef ISet<IDropCatcher*> IDropCatcherSet;
- typedef ISet<IDxferAssoc*> IDxferAssocSet;
- #else
- typedef IGSet1(IDropCatcher) IDropCatcherSet;
- typedef IGSet1(IDxferAssoc) IDxferAssocSet;
- #endif
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There is one default way to construct instances of this class: |
- | 1. Specify wether partial drops are enabled or not |
- | Note: *not* enabled so far |
- +------------------------------------------------------------------------*/
- IDragTargetHandler(Boolean bPartialDrop=false);
-
- virtual
- ~IDragTargetHandler();
-
- // give access to the drop catcher collection
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | dropCatcherList - give access to the drop catcher collection |
- +------------------------------------------------------------------------*/
- IDropCatcherSet&
- dropCatcherList() { return(drpcthsetCl); };
-
- // ask to render this item in specified RMF
- /*-------------------------------- UTILITY -------------------------------+
- | These functions are utility functions used to implement most of the |
- | handler's behavior. |
- | askRender - ask to render this item in specified RMF, called by catcher|
- +------------------------------------------------------------------------*/
- void
- askRender(const IWindow* pwndRenderWindow,
- const IWindowHandle& wndhSource,
- const IDropCatcher* pdrpctch,
- const IDragItem& drgitm,
- const IRMFsString& strRMFs,
- const IString& strRenderToName,
- const IDragOperationEvent::Operations& opCurrent,
- unsigned long ulTargetInfo=0) const;
-
- protected:
- /*-------------------------------- OVERRIDES -----------------------------+
- | This class overrides the following inherited functions: |
- | dispatchHandlerEvent - event dispatcher overload |
- +------------------------------------------------------------------------*/
- virtual Boolean
- dispatchHandlerEvent(IEvent& evt);
-
- // event processing
- /*------------------------- EVENT PROCESSING -----------------------------+
- | Functions used to process events. Used either internally or by |
- | subclasses which implement different sets of Drag&Drop events |
- | isDropAccepted - check wether a drop is accepted or not |
- | processDrop - process a drop event |
- | processRenderComplete - process a render_complete event |
- +------------------------------------------------------------------------*/
- IEDropFlag
- isDropAccepted(const IDragOverEvent& drgovevt);
-
- void
- processDrop(IDropOnEvent& drponevt),
- processRenderComplete(IRenderCompleteEvent& rendcompevt);
-
-
- /*-------------------------------- CALLBACKS -----------------------------+
- | These functions are intended to be overridden by the user to implement |
- | his own specific behavior |
- | checkItem - check items for acceptance, returns a catcher ptr accepted |
- | checkOperation - check that the current operation is supported an item |
- +------------------------------------------------------------------------*/
- virtual IDropCatcher*
- checkItem(const IDragItem& drgitem,
- const IDragOperationEvent& drgopevt,
- IEDropFlag& drpflg);
-
- virtual Boolean
- checkOperation(const IDragItem& drgitm,
- const IDragOperationEvent& drgopevt);
-
- private:
- /*------------------------------ UTILITY ---------------------------------+
- | Private utility functions |
- | doRender - send the actual DM_RENDER message |
- | transferComplete - process error from DM_RENDER or DM_RENDERCOMPLETE |
- +------------------------------------------------------------------------*/
- Boolean
- doRender(const IUDragDropRender& udrgdrpevt);
- void
- transferComplete(void* pdragtransfer,
- Boolean bRenderOK,
- const IRenderCompleteEvent& rendcompevt);
-
- /*------------------------------ DATA MEMBERS ----------------------------+
- | bClPartialDrop - true if partial drop enabled |
- | drpcthsetCl - set of drop catchers for this handler |
- | dxassetCl - set of associations between dragtransfers and items |
- +------------------------------------------------------------------------*/
- Boolean bClPartialDrop;
- IDropCatcherSet drpcthsetCl;
- IDxferAssocSet dxassetCl;
-
- /*---------------------- ASSOC SET MANAGEMENT ----------------------------+
- | Private utility functions to deal with the set of assoc |
- | The set and functions will be deported in an outside class later |
- +------------------------------------------------------------------------*/
- IDxferAssoc*
- findXfer(const void* pdragtransfer,
- IDxferAssocSet::Cursor& dxascurs) const;
-
- void
- associateXfer(const void* pdragtransfer,
- IWindowHandle wndhSource,
- const IDropCatcher* pdrpctch) const;
-
- IWindowHandle
- sourceWindowXfer(const void* pdragtransfer) const;
-
- IDropCatcher*
- catcherXfer(const void* pdragtransfer) const;
-
- Boolean
- removeXfer(const void* pdragtransfer) const;
-
- }; // IDragTargetHandler
-
- #endif /* def _IDRGTGTH_ */