I don't know if callbacks is the right term. Basically, I implemented a red-black tree data structure and I want to make a GUI application with animated insertion, deletion, traversal, etc. So every time an event happens (node is inserted or rotated or visited or its color changes) I want to send a message to the GUI to trigger an animation.
What's the best way of doing this without re-implementing the entire tree and doing GUI things in the tree itself?