draggable collisions

draggable collisions


is there a method for making draggables collisionable?
so for example i have 4 windows.
all these windows are draggable.
these windows can only snap to each other but not cross.
so some kind of collision system which detects if a position in the
"grid/space" is still available.
thnx for the help