home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WDRAG.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
7KB
|
267 lines
#ifndef _WDRAG_HPP_INCLUDED
#define _WDRAG_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WPOINT_HPP_INCLUDED
# include "wpoint.hpp"
#endif
#ifndef _WEVENTD_HPP_INCLUDED
# include "weventd.hpp"
#endif
#ifndef _WSTRING_HPP_INCLUDED
# include "wstring.hpp"
#endif
#ifndef _WIMAGELIST_HPP_INCLUDED
# include "wimglist.hpp"
#endif
class WImageList;
class WWindow;
class WDragInfo;
struct _wWPIUnknown;
struct _wWPIDataObject;
//
// WDragInfo -- This class is used for very fine control over
// drag and drop.
//
class WCMCLASS WDragInfo {
public:
// Number of bytes in structure
WUShort cb;
// If TRUE, we are in an OLE drag
WBool isOleDrag;
// Pointers to the OLE objects
const _wWPIUnknown *oleSourceObject;
const _wWPIDataObject *oleDataObject;
// Feedback data
WBool drawFeedback;
WPoint pickPoint;
WPoint size;
// The drop effect as defined by the target
WULong dropEffect;
// Was the escape key pressed?
WBool escapePressed;
// Starting key/button state
WULong kbOldState;
// Current key/button state
WULong kbState;
// ItemID
WULong itemID;
// Mouse positions (in absolute coordinates)
WPoint startPosition; // where drag started
WPoint currentPosition;
// Current drop target's window handle
WWindow *dragTarget;
WWindowHandle dragTargetWindow;
// Where the drag started
WWindow *dragSource; // where drag started
WWindowHandle dragSourceWindow;
// User-defined data
void *userData; // user-defined data
// Imagelist to use
WImageList *imageList;
void *imageData; // reserved
WPoint hotSpot; // hotspot for the image
WBool deleteImageList; // delete when done?
public:
/************************************************************
* Methods
************************************************************/
// Prepare structure for non-OLE drag
void Initialize( WWindow *drgsrc );
// Update state
void Update();
// Prepare the image list
WBool PrepareImageList();
/************************************************************
* Constructors and destructors
************************************************************/
WDragInfo();
~WDragInfo();
};
/* Define the various drag effects */
#define WDROPEFFECT_NONE 0x00000000
#define WDROPEFFECT_COPY 0x00000001
#define WDROPEFFECT_MOVE 0x00000002
#define WDROPEFFECT_LINK 0x00000004
#define WDROPEFFECT_ALL (WDROPEFFECT_COPY|WDROPEFFECT_MOVE|\
WDROPEFFECT_LINK)
#define WDROPEFFECT_SCROLL 0x80000000
typedef unsigned long WDropEffect;
//
// Event structures
//
struct WCMCLASS WDragEventData : public WEventData {
WDragInfo *draginfo; // advanced information
WBool delDragInfo; // delete it or not...
WString tag; // string that identifies the drag
WStringArray strings; // list of strings
WULongArray items; // list of values
WImageList images; // images to display when dragging
WPoint startPoint; // starting x,y (screen)
WPoint currentPoint; // current x,y (screen)
WObject *source; // pointer to source object
WDropEffect sourceOps; // allowable op(s) from the source
WDropEffect targetOps; // what the target can accept
WDropEffect currentOp; // the current operation
WDWord button; // which button was pressed
WBool escapePressed; // TRUE if user pressed escape
void *userData; // user-defined data
WDragEventData();
~WDragEventData();
};
typedef WDragEventData WDragContinueEventData;
typedef WDragEventData WDragFeedbackEventData;
typedef WDragEventData WDragEnterEventData;
typedef WDragEventData WDragOverEventData;
typedef WDragEventData WDragLeaveEventData;
typedef WDragEventData WDragDropEventData;
typedef WDragEventData WDragScrollEventData;
typedef WULong WDragResult;
/* General errors */
#define WDRAG_E_OUTOFMEMORY 0x8007000EL
#define WDRAG_E_INVALIDARG 0x80070057L
#define WDRAG_E_UNEXPECTED 0x8000FFFFL
/* Return this from OnDragStart to let WClass to the dragging */
#define WDRAG_DEFAULT_START 0x00000001L
/* Return this from OnDragStart if you handled the drag */
#define WDRAG_HANDLED_START 0x00000002L
/* Return this from OnDragStart if the parent should handle things */
#define WDRAG_PARENT_START 0x00000004L
/* Return this from OnDragFeedback for default behaviour */
#define WDRAG_DEFAULT_FEEDBACK 0x00040102L
/* Return this from OnDragFeedback if you handled pointer setting */
#define WDRAG_HANDLED_FEEDBACK (0x00000000L)
/* Return this from OnDragContinue if the drag should continue */
#define WDRAG_CONTINUE_DRAG (0x00000000L)
/* Return this from OnDragContinue if a drop should occur */
#define WDRAG_DROP 0x00040100L
/* Return this from OnDragContinue/OnDragStart to cancel the drag without dropping */
#define WDRAG_CANCEL_DRAG 0x00040101L
/* Define the cursors */
enum WOleCursorID {
WOLE_CURCOPY,
WOLE_CURLINK,
WOLE_CURMOVE,
WOLE_CURNONE,
};
/* Define identifiers for the mouse/key states */
#define WMK_NONE 0x0000
#define WMK_LBUTTON 0x0001
#define WMK_RBUTTON 0x0002
#define WMK_SHIFT 0x0004
#define WMK_CONTROL 0x0008
#define WMK_MBUTTON 0x0010
#define WMK_ALT 0x0020
/* Define the size of the edge zone for scrolling, in pixels */
#define WDD_DEFSCROLLINSET 11
/* Delay before scrolling begins, milliseconds */
#define WDD_DEFSCROLLDELAY 50
/* Scrolling interval, milliseconds */
#define WDD_DEFSCROLLINTERVAL 50
/* Delay before dragging starts, milliseconds */
#define WDD_DEFDRAGDELAY 200
/* Minimum distance before dragging starts, pixels */
#define WDD_DEFDRAGMINDIST 2
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WDRAG_HPP_INCLUDED