wxPlayerDropTarget

A drag and drop target for Player data objects.  The class wxPlayerDropTarget is in actuality a Proxy design pattern class that takes a pointer to any IPlayerDropTarget-derived class and passes the drop target messages along.  This allows for wxPlayerDropTarget to have absolutely no knowledge of any particular UI object, but instead just forwards messages to the real drop target.

Derived From

wxDropTarget (see http://www.wxwindows.org/manuals/2.4.2/wx126.htm)

Project

Cities3D

Include

PlayerDataTarget.h

Summary
A drag and drop target for Player data objects.
The wxPlayerDropTarget constructor.
Handles a drop event.
Determines whether the dropped data should be accepted.
Handles a drag event over the drop target.
The target IPlayerDropTarget.

Public

Summary
The wxPlayerDropTarget constructor.
Handles a drop event.
Determines whether the dropped data should be accepted.
Handles a drag event over the drop target.

Constructors

wxPlayerDropTarget

wxPlayerDropTarget(IPlayerDropTarget *pTarget)

The wxPlayerDropTarget constructor.  Stores the given IPlayerDropTarget pointer for later use.

Parameters

pTargetThe IPlayerDropTarget-derived class that actually receives the drop messags.  Must not be NULL.

Virtual functions

OnData

virtual wxDragResult OnData(wxCoord x,
wxCoord y,
wxDragResult def)

Handles a drop event.  Retrieves the data from the internal wxPlayerDataObject and passes it along with the coordinates to the target IPlayerDropTarget.

Parameters

xThe x coordinate of the drop position.
yThe y coordinate of the drop position.
defThe suggested (by wxWidgets) return value.

Returns

The suggested return value given in def.

OnDrop

virtual bool OnDrop(wxCoord x,
wxCoord y)

Determines whether the dropped data should be accepted.  Always called immediately before OnData, and always returns true to accept the data.

Parameters

xThe x coordinate of the drop position.
yThe y coordinate of the drop position.

Returns

A bool indicating if the drop is accepted.  Always returns true.

OnDragOver

virtual wxDragResult OnDragOver(wxCoord x,
wxCoord y,
wxDragResult def)

Handles a drag event over the drop target.  Calls the similarly named function on the target IPlayerDropTarget so it can handle the drag over event.

Parameters

xThe x coordinate of the drag position.
yThe y coordinate of the drag position.
defThe suggested (by wxWidgets) return value.

Returns

The suggested return value given in def.

Private

Variables

mpTarget

IPlayerDropTarget *mpTarget

The target IPlayerDropTarget.  All important drag and drop messages are funneled to it.

Still volatile.
wxPlayerDropTarget(IPlayerDropTarget *pTarget)
The wxPlayerDropTarget constructor.
virtual wxDragResult OnData(wxCoord x,
wxCoord y,
wxDragResult def)
Handles a drop event.
virtual bool OnDrop(wxCoord x,
wxCoord y)
Determines whether the dropped data should be accepted.
virtual wxDragResult OnDragOver(wxCoord x,
wxCoord y,
wxDragResult def)
Handles a drag event over the drop target.
IPlayerDropTarget *mpTarget
The target IPlayerDropTarget.
An interface for Player data drag and drop operations.
Cities3D is a cross-platform implementation of the board game Settlers of Catan with all expansions, including Seafarers, and Cities & Knights.
A data object for Player drag and drop operations.