A data object for Player drag and drop operations. All drag and drop operations in wxWidgets involve a wxDataObject-derived class of some kind. The base class wxDataObject provides an interface pure virtual functions that must be supplied for drag and drop to work with any user-defined data. However, there are many cases where a drag and drop object only needs to support just a single piece of user-defined data. The wxDataObjectSimple class narrows the wxDataObject interface down to the minimum set of functions that must be implemented for drag and drop to work.
The class wxPlayerDataObject is derived from wxDataObjectSimple and provides drag and drop support for the class Player, allowing Player objects to be dragged and dropped throughout the UI where this class is used. See http://www.wxwindows.org /manuals /2.4.2 /wx495.htm#wxdndoverview for a full overview of drag and drop in wxWidgets.
wxDataObjectSimple (see http://www.wxwindows.org/manuals/2.4.2/wx88.htm)
PlayerDataObject.h
A data object for Player drag and drop operations. | |
The wxPlayerDataObject constructor. | |
Returns the Player data associated with this object. | |
Returns the size of the data needing to be passed via drag and drop. | |
Retrieves the data object. | |
Stores the data object. | |
The internal data format. | |
The Player data associated with this drop object. |
The wxPlayerDataObject constructor. | |
Returns the Player data associated with this object. | |
Returns the size of the data needing to be passed via drag and drop. | |
Retrieves the data object. | |
Stores the data object. |
| virtual size_t GetDataSize() const |
Returns the size of the data needing to be passed via drag and drop.
The size of the Player data object.
|
Retrieves the data object. In normal wxWidgets drag and drop handling, this function is used to retrieve the outgoing dropped data and put it in the buffer provided. However, we cheat by just using a static Player instance to keep track of the data being passed around, a much simpler and easier to maintain solution.
| buf | The buffer data is supposed to be written to. Unused. |
A bool indicating success. Always returns true.
|
Stores the data object. In normal wxWidgets drag and drop handling, this function is used to set the incoming dropped data by giving the length of the data and a pointer to the raw bytes. However, we cheat by just keeping a static Player instance around, which is much simpler and easier to maintain.
| len | The length of the data. Unused. |
| buf | The raw data. Unused. |
A bool indicating success. Always returns true.
The internal data format. | |
The Player data associated with this drop object. |
| Player mPlayer |
The Player data associated with this drop object.
|
| const Player &GetPlayer() const |
| virtual size_t GetDataSize() const |
|
|
| wxDataFormat mDataFormat |
| Player mPlayer |