Specifically in regard to a drag and drop operation, how does a button, text box or whatever know that it has been clicked (or vice versa how does the display manager know what it clicked).
I read some about the COM way of dragging and dropping and I think I get the general idea: on MouseDown, detect what was clicked.
While mouse is still down and cursor position moves a certain amount store the data associated with the drag source.
When the MouseUp event fires, drop the data if the mouse cursor is over a drop target. If it is not a drop target then cancel the operation.
You can expand this to the scenario where you click and drag to select multiple files.. how does the UI know what files it selected?
Does the display manager have a calculated pixel range for every element and compare mouse position clicks to that? If so, how does the display manager know this?
If the answer is too long or difficult to explain here, can you point me to some resources that I could read? I understand that you store data on a mouse click event, but that is a higher level "just call these API functions" view of it.