2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dnd.h
|
2008-04-20 21:40:12 -04:00
|
|
|
// Purpose: interface of wxDropSource and wx*DropTarget
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-04-29 19:22:18 -04:00
|
|
|
/**
|
|
|
|
Possible flags for drag and drop operations.
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxDrag_CopyOnly = 0, ///< Allow only copying.
|
|
|
|
wxDrag_AllowMove = 1, ///< Allow moving too (copying is always allowed).
|
|
|
|
wxDrag_DefaultMove = 3 ///< Allow moving and make it default operation.
|
|
|
|
};
|
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
/**
|
|
|
|
Result returned from a wxDropSource::DoDragDrop() call.
|
|
|
|
*/
|
|
|
|
enum wxDragResult
|
|
|
|
{
|
|
|
|
wxDragError, ///< Error prevented the D&D operation from completing.
|
|
|
|
wxDragNone, ///< Drag target didn't accept the data.
|
|
|
|
wxDragCopy, ///< The data was successfully copied.
|
|
|
|
wxDragMove, ///< The data was successfully moved (MSW only).
|
|
|
|
wxDragLink, ///< Operation is a drag-link.
|
|
|
|
wxDragCancel ///< The operation was cancelled by user (not an error).
|
|
|
|
};
|
|
|
|
|
2012-05-03 19:30:33 -04:00
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxDropTarget
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
This class represents a target for a drag and drop operation. A
|
|
|
|
wxDataObject can be associated with it and by default, this object will be
|
|
|
|
filled with the data from the drag source, if the data formats supported by
|
|
|
|
the data object match the drag source data format.
|
|
|
|
|
|
|
|
There are various virtual handler functions defined in this class which may
|
|
|
|
be overridden to give visual feedback or react in a more fine-tuned way,
|
|
|
|
e.g. by not accepting data on the whole window area, but only a small
|
|
|
|
portion of it. The normal sequence of calls is OnEnter(), OnDragOver()
|
|
|
|
possibly many times, OnDrop() and finally OnData().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{dnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
@see @ref overview_dnd, @ref overview_dataobject, wxDropSource,
|
|
|
|
wxTextDropTarget, wxFileDropTarget, wxDataFormat, wxDataObject
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxDropTarget
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Constructor. @a data is the data to be associated with the drop target.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxDropTarget(wxDataObject* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor. Deletes the associated data object, if any.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxDropTarget();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
This method may only be called from within OnData(). By default, this
|
|
|
|
method copies the data from the drop source to the wxDataObject
|
|
|
|
associated with this drop target, calling its wxDataObject::SetData()
|
|
|
|
method.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-05-03 19:30:33 -04:00
|
|
|
virtual bool GetData();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Called after OnDrop() returns @true. By default this will usually
|
2012-05-03 19:30:33 -04:00
|
|
|
GetData() and will return the suggested default value @a defResult.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-05-03 19:30:33 -04:00
|
|
|
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult defResult) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Called when the mouse is being dragged over the drop target. By
|
2012-05-03 19:30:33 -04:00
|
|
|
default, this calls functions return the suggested return value @a defResult.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
The x coordinate of the mouse.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
The y coordinate of the mouse.
|
2012-05-03 19:30:33 -04:00
|
|
|
@param defResult
|
2008-04-20 21:40:12 -04:00
|
|
|
Suggested value for return value. Determined by SHIFT or CONTROL
|
|
|
|
key states.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return The desired operation or wxDragNone. This is used for optical
|
2008-04-20 21:40:12 -04:00
|
|
|
feedback from the side of the drop source, typically in form
|
|
|
|
of changing the icon.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-05-03 19:30:33 -04:00
|
|
|
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult defResult);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Called when the user drops a data object on the target. Return @false
|
|
|
|
to veto the operation.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
The x coordinate of the mouse.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
The y coordinate of the mouse.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true to accept the data, or @false to veto the operation.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-05-03 19:30:33 -04:00
|
|
|
virtual bool OnDrop(wxCoord x, wxCoord y);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Called when the mouse enters the drop target. By default, this calls
|
|
|
|
OnDragOver().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
The x coordinate of the mouse.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
The y coordinate of the mouse.
|
2012-05-03 19:30:33 -04:00
|
|
|
@param defResult
|
2008-04-20 21:40:12 -04:00
|
|
|
Suggested default for return value. Determined by SHIFT or CONTROL
|
|
|
|
key states.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return The desired operation or wxDragNone. This is used for optical
|
2008-04-20 21:40:12 -04:00
|
|
|
feedback from the side of the drop source, typically in form
|
|
|
|
of changing the icon.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-05-03 19:30:33 -04:00
|
|
|
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult defResult);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Called when the mouse leaves the drop target.
|
|
|
|
*/
|
|
|
|
virtual void OnLeave();
|
|
|
|
|
2012-09-08 20:44:03 -04:00
|
|
|
/**
|
|
|
|
Returns the data wxDataObject associated with the drop target
|
|
|
|
*/
|
|
|
|
wxDataObject *GetDataObject() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Sets the data wxDataObject associated with the drop target and deletes
|
|
|
|
any previously associated data object.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetDataObject(wxDataObject* data);
|
2012-05-03 19:30:33 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default action for drag and drop. Use wxDragMove or
|
2013-10-26 14:51:16 -04:00
|
|
|
wxDragCopy to set default action to move or copy and use wxDragNone
|
2020-06-27 14:19:59 -04:00
|
|
|
(default) to set default action specified by initialization of dragging
|
2012-05-03 19:30:33 -04:00
|
|
|
(see wxDropSource::DoDragDrop())
|
|
|
|
*/
|
|
|
|
void SetDefaultAction(wxDragResult action);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns default action for drag and drop or wxDragNone if this not
|
|
|
|
specified.
|
|
|
|
*/
|
|
|
|
wxDragResult GetDefaultAction();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxDropSource
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a source for a drag and drop operation.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{dnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
@see @ref overview_dnd, @ref overview_dataobject, wxDropTarget,
|
|
|
|
wxTextDropTarget, wxFileDropTarget
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxDropSource
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
This constructor requires that you must call SetData() later.
|
|
|
|
|
2008-11-08 10:17:16 -05:00
|
|
|
Note that the type of @a iconCopy and subsequent parameters
|
2012-01-12 13:15:12 -05:00
|
|
|
differs between different ports: these are cursors under Windows and OS
|
|
|
|
X but icons for GTK. You should use the macro wxDROP_ICON() in portable
|
2008-03-08 08:52:38 -05:00
|
|
|
programs instead of directly using either of these types.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-03-14 21:19:09 -04:00
|
|
|
@onlyfor{wxmsw,wxosx}
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
@param win
|
|
|
|
The window which initiates the drag and drop operation.
|
|
|
|
@param iconCopy
|
|
|
|
The icon or cursor used for feedback for copy operation.
|
|
|
|
@param iconMove
|
|
|
|
The icon or cursor used for feedback for move operation.
|
|
|
|
@param iconNone
|
|
|
|
The icon or cursor used for feedback when operation can't be done.
|
|
|
|
*/
|
|
|
|
wxDropSource(wxWindow* win = NULL,
|
2012-05-03 19:30:27 -04:00
|
|
|
const wxCursor& iconCopy = wxNullCursor,
|
|
|
|
const wxCursor& iconMove = wxNullCursor,
|
|
|
|
const wxCursor& iconNone = wxNullCursor);
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
/**
|
2012-01-12 13:15:12 -05:00
|
|
|
The constructor taking a wxDataObject.
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
Note that the type of @a iconCopy and subsequent parameters
|
2012-01-12 13:15:12 -05:00
|
|
|
differs between different ports: these are cursors under Windows and OS
|
|
|
|
X but icons for GTK. You should use the macro wxDROP_ICON() in portable
|
2008-11-08 10:17:16 -05:00
|
|
|
programs instead of directly using either of these types.
|
|
|
|
|
2009-03-14 21:19:09 -04:00
|
|
|
@onlyfor{wxmsw,wxosx}
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
@param data
|
|
|
|
The data associated with the drop source.
|
|
|
|
@param win
|
|
|
|
The window which initiates the drag and drop operation.
|
|
|
|
@param iconCopy
|
|
|
|
The icon or cursor used for feedback for copy operation.
|
|
|
|
@param iconMove
|
|
|
|
The icon or cursor used for feedback for move operation.
|
|
|
|
@param iconNone
|
|
|
|
The icon or cursor used for feedback when operation can't be done.
|
|
|
|
*/
|
|
|
|
wxDropSource(wxDataObject& data, wxWindow* win = NULL,
|
2012-05-03 19:30:27 -04:00
|
|
|
const wxCursor& iconCopy = wxNullCursor,
|
|
|
|
const wxCursor& iconMove = wxNullCursor,
|
|
|
|
const wxCursor& iconNone = wxNullCursor);
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
This constructor requires that you must call SetData() later.
|
|
|
|
|
2012-01-12 13:15:12 -05:00
|
|
|
This is the wxGTK-specific version of the constructor taking wxIcon
|
|
|
|
instead of wxCursor as the other ports.
|
2008-11-08 10:17:16 -05:00
|
|
|
|
|
|
|
@onlyfor{wxgtk}
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param win
|
2008-03-09 08:33:59 -04:00
|
|
|
The window which initiates the drag and drop operation.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param iconCopy
|
2008-03-09 08:33:59 -04:00
|
|
|
The icon or cursor used for feedback for copy operation.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param iconMove
|
2008-03-09 08:33:59 -04:00
|
|
|
The icon or cursor used for feedback for move operation.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param iconNone
|
2008-03-09 08:33:59 -04:00
|
|
|
The icon or cursor used for feedback when operation can't be done.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxDropSource(wxWindow* win = NULL,
|
2012-05-03 19:30:27 -04:00
|
|
|
const wxIcon& iconCopy = wxNullIcon,
|
|
|
|
const wxIcon& iconMove = wxNullIcon,
|
|
|
|
const wxIcon& iconNone = wxNullIcon);
|
2008-10-04 16:49:51 -04:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
/**
|
2012-01-12 13:15:12 -05:00
|
|
|
The constructor taking a wxDataObject.
|
2008-10-04 16:49:51 -04:00
|
|
|
|
2012-01-12 13:15:12 -05:00
|
|
|
This is the wxGTK-specific version of the constructor taking wxIcon
|
|
|
|
instead of wxCursor as the other ports.
|
2008-04-20 21:40:12 -04:00
|
|
|
|
2008-11-08 10:17:16 -05:00
|
|
|
@onlyfor{wxgtk}
|
|
|
|
|
2008-10-04 16:49:51 -04:00
|
|
|
@param data
|
|
|
|
The data associated with the drop source.
|
2008-04-20 21:40:12 -04:00
|
|
|
@param win
|
|
|
|
The window which initiates the drag and drop operation.
|
|
|
|
@param iconCopy
|
|
|
|
The icon or cursor used for feedback for copy operation.
|
|
|
|
@param iconMove
|
|
|
|
The icon or cursor used for feedback for move operation.
|
|
|
|
@param iconNone
|
|
|
|
The icon or cursor used for feedback when operation can't be done.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxDropSource(wxDataObject& data, wxWindow* win = NULL,
|
2012-05-03 19:30:27 -04:00
|
|
|
const wxIcon& iconCopy = wxNullIcon,
|
|
|
|
const wxIcon& iconMove = wxNullIcon,
|
|
|
|
const wxIcon& iconNone = wxNullIcon);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Starts the drag-and-drop operation which will terminate when the user
|
|
|
|
releases the mouse. Call this in response to a mouse button press, for
|
|
|
|
example.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param flags
|
2012-04-29 19:22:18 -04:00
|
|
|
If ::wxDrag_AllowMove is included in the flags, data may be moved
|
|
|
|
and not only copied as is the case for the default
|
|
|
|
::wxDrag_CopyOnly. If ::wxDrag_DefaultMove is specified
|
|
|
|
(which includes the previous flag), moving is not only possible but
|
|
|
|
becomes the default operation.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return The operation requested by the user, may be ::wxDragCopy,
|
2008-04-20 21:40:12 -04:00
|
|
|
::wxDragMove, ::wxDragLink, ::wxDragCancel or ::wxDragNone if
|
2008-03-09 08:33:59 -04:00
|
|
|
an error occurred.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the wxDataObject object that has been assigned previously.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxDataObject* GetDataObject();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
You may give some custom UI feedback during the drag and drop operation
|
|
|
|
by overriding this function. It is called on each mouse move, so your
|
|
|
|
implementation must not be too slow.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param effect
|
2008-04-20 21:40:12 -04:00
|
|
|
The effect to implement. One of ::wxDragCopy, ::wxDragMove,
|
|
|
|
::wxDragLink and ::wxDragNone.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @false if you want default feedback, or @true if you implement
|
2008-09-03 16:36:54 -04:00
|
|
|
your own feedback. The return value is ignored under GTK.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual bool GiveFeedback(wxDragResult effect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the icon to use for a certain drag result.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param res
|
2008-03-09 08:33:59 -04:00
|
|
|
The drag result to set the icon for.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param cursor
|
2012-05-03 19:30:40 -04:00
|
|
|
The icon to show when this drag result occurs.
|
|
|
|
|
|
|
|
@onlyfor{wxmsw,wxosx}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetCursor(wxDragResult res, const wxCursor& cursor);
|
|
|
|
|
2012-05-03 19:30:40 -04:00
|
|
|
/**
|
|
|
|
Set the icon to use for a certain drag result.
|
|
|
|
|
|
|
|
@param res
|
|
|
|
The drag result to set the icon for.
|
|
|
|
@param icon
|
|
|
|
The icon to show when this drag result occurs.
|
|
|
|
|
|
|
|
@onlyfor{wxgtk}
|
|
|
|
*/
|
|
|
|
void SetIcon(wxDragResult res, const wxIcon& icon);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
Sets the data wxDataObject associated with the drop source. This will
|
|
|
|
not delete any previously associated data.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetData(wxDataObject& data);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2012-05-03 19:30:33 -04:00
|
|
|
/**
|
|
|
|
@class wxTextDropTarget
|
|
|
|
|
|
|
|
A predefined drop target for dealing with text data.
|
|
|
|
|
|
|
|
@library{wxcore}
|
|
|
|
@category{dnd}
|
|
|
|
|
|
|
|
@see @ref overview_dnd, wxDropSource, wxDropTarget, wxFileDropTarget
|
|
|
|
*/
|
|
|
|
class wxTextDropTarget : public wxDropTarget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxTextDropTarget();
|
|
|
|
|
|
|
|
/**
|
|
|
|
See wxDropTarget::OnDrop(). This function is implemented appropriately
|
|
|
|
for text, and calls OnDropText().
|
|
|
|
*/
|
|
|
|
virtual bool OnDrop(wxCoord x, wxCoord y);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Override this function to receive dropped text.
|
|
|
|
|
|
|
|
@param x
|
|
|
|
The x coordinate of the mouse.
|
|
|
|
@param y
|
|
|
|
The y coordinate of the mouse.
|
|
|
|
@param data
|
|
|
|
The data being dropped: a wxString.
|
|
|
|
|
|
|
|
Return @true to accept the data, or @false to veto the operation.
|
|
|
|
*/
|
|
|
|
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxFileDropTarget
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
This is a drop target which accepts files (dragged from File Manager or
|
|
|
|
Explorer).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{dnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-20 21:40:12 -04:00
|
|
|
@see @ref overview_dnd, wxDropSource, wxDropTarget, wxTextDropTarget
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFileDropTarget : public wxDropTarget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxFileDropTarget();
|
|
|
|
|
|
|
|
/**
|
2008-04-20 21:40:12 -04:00
|
|
|
See wxDropTarget::OnDrop(). This function is implemented appropriately
|
|
|
|
for files, and calls OnDropFiles().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual bool OnDrop(wxCoord x, wxCoord y);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Override this function to receive dropped files.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
The x coordinate of the mouse.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
The y coordinate of the mouse.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param filenames
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of filenames.
|
2008-04-20 21:40:12 -04:00
|
|
|
|
|
|
|
Return @true to accept the data, or @false to veto the operation.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual bool OnDropFiles(wxCoord x, wxCoord y,
|
2008-10-27 17:26:54 -04:00
|
|
|
const wxArrayString& filenames) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2009-01-05 15:48:06 -05:00
|
|
|
/** @addtogroup group_funcmacro_gdi */
|
2022-08-03 12:28:06 -04:00
|
|
|
///@{
|
2008-03-20 02:00:05 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
This macro creates either a cursor (MSW) or an icon (elsewhere) with the
|
|
|
|
given @a name (of type <tt>const char*</tt>). Under MSW, the cursor is
|
|
|
|
loaded from the resource file and the icon is loaded from XPM file under
|
|
|
|
other platforms.
|
|
|
|
|
|
|
|
This macro should be used with wxDropSource::wxDropSource().
|
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return wxCursor on MSW, otherwise returns a wxIcon
|
2008-03-20 02:00:05 -04:00
|
|
|
|
|
|
|
@header{wx/dnd.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
#define wxDROP_ICON(name)
|
|
|
|
|
2012-05-03 19:30:33 -04:00
|
|
|
/**
|
|
|
|
Returns true if res indicates that something was done during a DnD operation,
|
|
|
|
i.e. is neither error nor none nor cancel.
|
|
|
|
*/
|
|
|
|
bool wxIsDragResultOk(wxDragResult res);
|
|
|
|
|
2022-08-03 12:28:06 -04:00
|
|
|
///@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|