as suggested by CuteAlien in my thread about my editor (Y.A.I.S.E.) I tried to implement drag / drop function for the Tree View. It works as far as I can tell, but I have the habit (or weakness) to rarely see any side-effects of what I implement (would save me a lot of work

New GUI events:
- new GUI event "EGET_TREEVIEW_NODE_DRAG" which is fired when a node is dragged (i.e. left button is down and mouse is no longer on the node dragged)
- new GUI event "EGET_TREEVIEW_NODE_WILL_DROP": this is fired right before the actual movement in the tree happens. Listening to this event and calling the new method "cancelNodeDrag" will cancel dragging. This way dropping a node can be prevented
- new GUI event "EGET_TREEVIEW_NODE_DROP": an event triggered when the actual drop happens
- last new GUI event: "EGET_TREEVIEW_DRAG_CANCELED" is fired when dragging is canceled, i.e. when the programmer cancels the drag with the method mentioned before or when the node is dropped on a node which isn't possible, i.e. one of it's own children
- draggingAllowed(bool): by default drag / drop is not active, it needs to be activated calling this method
- cancelNodeDrag(void): tell the tree that you don't want the dragging which is in progress to continue
- getNodeAt(position2di): get the tree node underneath the mouse. This method doesn't need to be exposed, but I think it might be handy for many people
- The "CGUITreeViewNode" got a new method "addChildNode" which takes a node given as parameter and adds it as a child of the current node
- Added new members "Dragged" (the node which is dragged), "DragCandidate" (the node clicked on which might be dragged later on) and "AllowDragDrop", a flag to (de)activate the functionality. For the next points I assume that the flag is "true"
- if a left mouse click is detected the node under the mouse pointer becomes the "DragCandidate"
- if the mouse is moved and hovers another node of the tree the "DragCandidate" becomes the "Dragged" member, "DragCandidate" is reset to "0". The event "EGET_TREEVIEW_NODE_DRAG" is fired and the "LastEventNode" member is set to the dragged node
- if the left mouse button is left up and "Dragged" is not "0" the following happens:
- the node underneath the mouse cursor becomes the "dropCandidate"
- if the "dropCandidate" equals the dragged node nothing happens, dragging is canceled silently
- if the "dropCandidate" is a child of "Dragged" dragging is canceled and a "EGET_TREEVIEW_DRAG_CANCELED" event is fired. "Dragged" is reset to "0". The dragged node is "LastEventNode". This does also happen if the node is not dropped on another node.
- if "Dragged" is still set (not "0") a "EGET_TREEVIEW_NODE_WILL_DROP" is triggered. The "LastEventNode" member is set to the drop target. Now the developer of the app can cancel the dragging if necessary
- if "Dragged" is still set (not "0") the dragged node is moved and becomes a child of the drop target. A "EGET_TREEVIEW_NODE_DROP" event is fired with the drop node as "LastEventNode"
Now it's up to you: what did I not think of, what did I break, what doesn't work? I think I'll give my changes a try next weekend and include it into "Y.A.I.S.E.".