|
|
A widget for drag support.
If you require only drop support you dont need this widget, you just need KDndDropZone.
| |
Constructor.
| ~ |
[virtual]
Destructor.
| void |
[virtual]
Start a drag.
Call this function when you notice that the user wants to drag something around, usually from a dndMouseMoveEvent.
Parameters:
| _icon | The icon that the user can drag around. |
| _data | A pointer to the data being dragged. A deep copy is made of this data, so you don't need to maintain its value after you call this function. |
| _size | The length of the data pointed to by _data. |
| _type | The type of the data that is being dragged, eg DndURL. |
| _dx | ,_dy The difference between the icons upper left corner and the mouse pointer. For example when the user clicks the mouse over the middle of a pixmap, _dx and _dy would be ' - pixmap.width() / 2 ' and ' - pixmap.height() / 2 '. This is just provided for look and feel. |
| Window |
[protected virtual]
Finds the root window belonging to the global point p.
| void |
[protected virtual]
This function MUST be called by your implementation if you overload it.
In nearly all cases, you probably mean to call dndMouseMoveEvent().
| void |
[protected virtual]
This function MUST be called by your implementation if you overload it.
In nearly all cases, you probably mean to call dndMouseReleaseEvent().
| void |
[protected virtual]
A root drop occurred.
At the point (_x,_y) the user dropped the icon. If there is now window below this point, this function is called. Usually it emits a XEvent, so that every application gets informed about this. This function is only called if the drag started in this widget.
See KApplication for details on receiving root drop events.
| void |
[protected virtual]
Perform internal housekeeping after a root drop event.
If you must overload rootDropEvent(...), call this function at the end to do some clean up.
| void |
[protected virtual]
Called when a drag is ended.
This function is only called if the drag started in this widget. Overload it to do your own clean up.
| void |
[protected virtual]
Overload this instead of mouseMoveEvent. Ususally drags are started in this functions. A implementation might look like this:
void KFileView::dndMouseMoveEvent( QMouseEvent * _mouse )
{
// 'pressed' is set in mousePressedEvent(...)
if ( !pressed )
return;
int x = _mouse->pos().x();
int y = _mouse->pos().y();
if ( abs( x - press_x ) > Dnd_X_Precision || abs( y - press_y ) > Dnd_Y_Precision )
{
QString data = "Transfer me";
QPoint p = mapToGlobal( _mouse->pos() );
QPixmap pixmap = typ->getPixmap( filename );
int dx = - pixmap.width() / 2;
int dy = - pixmap.height() / 2;
startDrag( new KDNDIcon( pixmap, p.x() + dx, p.y() + dy ), data.data(), data.length(), DndText, dx, dy );
}
else
{
Do something different
}
The function is only called if the mouse movement was not part of a drag process.
| void |
[protected virtual]
Your mouse release event function.
Usually you will only set 'pressed' ( see dndMouseMoveEvent) to FALSE here. The function is only called if the release event had nothing to do with DND.
| bool |
[protected]
Are we just doing DND ?
| char * |
[protected]
The data that is currently dragged.
| int |
[protected]
data size
| int |
[protected]
data type
| int |
[protected]
The offset we got from 'startDrag'
| int |
[protected]
The offset we got from 'startDrag'
| KDNDIcon * |
[protected]
The icon we are moving around
| Window |
[protected]
The last window we entered with the mouse pointer.