home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IDMSRCH.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
14KB
|
241 lines
#ifndef _IDMSRCH_
#define _IDMSRCH_
/*******************************************************************************
* FILE NAME: idmsrch.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IDMSourceHandler - Direct manipulation source window handler. *
* *
* 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 _IDMCOMM_
#include <idmcomm.hpp>
#endif
#ifndef _IDMHNDLR_
#include <idmhndlr.hpp>
#endif
#ifndef _IDMSRCOP_
#include <idmsrcop.hpp>
#endif
#ifndef _IDMSRCRN_
#include <idmsrcrn.hpp>
#endif
#ifndef _IDMITEM_
#include <idmitem.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
/* Forward Declarations */
class IWindow;
class IEntryField;
class IMultiLineEdit;
class IContainerControl;
class IDMSourceBeginEvent;
class IDMSourcePrepareEvent;
class IDMSourceRenderEvent;
class IDMSourceEndEvent;
class IDMSourceDiscardEvent;
class IDMSourcePrintEvent;
class IDMSourceHandler : public IDMHandler {
typedef IDMHandler
Inherited;
typedef IDM::DragImageStyle
DragImageStyle;
/*******************************************************************************
* Objects of the IDMSourceHandler class handle events that occur in the source *
* window during a direct manipulation operation. An instance of this class *
* must be added to a window so that it can support the dragging of object(s). *
* It does not allow objects to be dropped on a window. See the *
* IDMTargetHandler class for information about dropping objects on a window. *
*------------------------------------------------------------------------------*
* *
* Two examples are provided. Note that both achieve the same goal: *
* *
* Example 1: *
* // Create frame window object ... *
* IFrameWindow *
* frame( "ICLUI Direct Manipulation Sample" ); *
* *
* // Create client entry field and entry field extension objects ... *
* IEntryField *
* client( 0, &frame, &frame ), *
* ext ( 0, &frame, &frame ); *
* *
* // Define source handler for the entry field ... *
* IDMSourceHandler *
* source( &client ); *
* *
* // Reuse drag item provider in the extension that was instantiated *
* // for the client and configure the extension as a source handler *
* ext.setItemProvider(client.itemProvider()); *
* source.handleEventsFor( &ext ); *
*------------------------------------------------------------------------------*
* *
* Example 2: *
* // Create frame window object ... *
* IFrameWindow *
* frame( "ICLUI Direct Manipulation Sample" ); *
* *
* // Create client entry field and entry field extension objects ... *
* IEntryField *
* client( 0, &frame, &frame ), *
* ext ( 0, &frame, &frame ); *
* *
* // Enable both entry fields to allow dragging of text ... *
* IDMHandler::enableDragFrom( &client ); *
* IDMHandler::enableDragFrom( &ext ); *
* *
*******************************************************************************/
public:
/*----------------------- Constructor/Destructor -------------------------------
| You can construct objects of this class by providing one of the following |
| items: |
| o A pointer to an IWindow object |
| o A pointer to an entry field |
| o A pointer to an MLE |
| o A pointer to an container control |
| o No arguments |
| |
| Note: If any of the first 4 constructors are used, this handler will |
| automatically be attached to the specified window. |
------------------------------------------------------------------------------*/
IDMSourceHandler ( IWindow *window );
IDMSourceHandler ( IEntryField *entryField );
IDMSourceHandler ( IMultiLineEdit *multiLineEdit );
IDMSourceHandler ( IContainerControl *containerControl );
IDMSourceHandler ( );
virtual
~IDMSourceHandler ( );
/*--------------------------------- Overrides ----------------------------------
| The following functions override the rendering functions defined in the |
| base IDMHandler class. They provide a means of accessing the |
| IDMSourceRenderer objects involved in the direct manipulation operation |
| described by instances of this class. These objects will be used to handle |
| the rendering of dragged objects that are compatible with the supported |
| renderering mechanisms and formats: |
| numberOfRenderers - Returns the number of renderers |
| renderer - Returns the renderer with the given position |
| replaceRenderer - Replaces a given IDMSourceRenderer with another |
| addRenderer - Adds another IDMSourceRenderer to this source |
| operation |
| removeRenderer - Removes an IDMSourceRenderer from this source |
| operation |
| setRenderer - Sets the renderer for this source operation Removes |
| any existing renderers. |
| |
| Note: Renderers are maintained positionally, which is 1-based. |
------------------------------------------------------------------------------*/
virtual unsigned
numberOfRenderers ( );
virtual IDMSourceRenderer
*renderer ( unsigned position );
virtual IDMSourceHandler
&replaceRenderer ( unsigned position,
const IDMSourceRenderer &replacement ),
&addRenderer ( const IDMSourceRenderer &newRenderer ),
&removeRenderer ( const IDMSourceRenderer &rendererToRemove ),
&setRenderer ( const IDMSourceRenderer &newRenderer );
protected:
/*------------------------------ Event Handling --------------------------------
| The following functions are dispatched in response to specific direct |
| manipulation source events: |
| sourceBegin - Called to process the initiation of a drag operation |
| and subsequently start a drag operation in response |
| to a system begin drag event. |
| sourcePrepare - Called to indicate to the source window that rendering |
| is about to start. |
| sourceRender - Called to initiate the rendering of a given drag item |
| by the source renderer. |
| sourceEnd - Called to indicate that a given item has been |
| processed by the target renderer. |
| sourceDiscard - Called to indicate that an item or items have been |
| dropped on a shredder object. |
| sourcePrint - Called to indicate that an item or items have been |
| dropped on a printer object. |
------------------------------------------------------------------------------*/
virtual Boolean
sourceBegin ( IDMSourceBeginEvent &event ),
sourcePrepare ( IDMSourcePrepareEvent &event ),
sourceRender ( IDMSourceRenderEvent &event ),
sourceEnd ( IDMSourceEndEvent &event ),
sourceDiscard ( IDMSourceDiscardEvent &event ),
sourcePrint ( IDMSourcePrintEvent &event );
/*------------------------------ Implementation --------------------------------
| The following utility functions are used to implement the behavior of |
| this class: |
| allocateOperation - Creates an instance of the IDMSourceOperation class |
| and returns a pointer to it. |
| findRenderersFor - Called to find the appropriate source renderers |
| for the operation. |
| findRendererFor - Called to find the appropriate source renderer |
| for the item. Returns the position of the renderer, |
| 0 if none found. |
------------------------------------------------------------------------------*/
virtual IDMSourceOperation::Handle
allocateOperation ( IDMSourceBeginEvent &event,
DragImageStyle dragItemStyle) const;
virtual Boolean
findRenderersFor ( const IDMSourceOperation::Handle &sourceOperation );
virtual unsigned
findRendererFor ( const IDMItem::Handle &item );
/*-------------------------------- Overrides -----------------------------------
| This class overrides the inherited dispatchHandlerEvent function, which |
| handles source drag events. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent &event );
private: /*------------------------ PRIVATE ----------------------------------*/
virtual IDMHandler
&replaceRenderer ( unsigned position,
const IDMRenderer &replacement ),
&addRenderer ( const IDMRenderer &newRenderer ),
&removeRenderer ( unsigned position ),
&removeRenderer ( const IDMRenderer &rendererToRemove ),
&setRenderer ( const IDMRenderer &newRenderer );
void
resolveRMFConflict (IDMItem::Handle &item,
IDMSourceRenderer* pIDMSrcRenderer);
}; //IDMSourceHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif //_IDMSRCH_