API: support for callbacks on entry switch for collections

Added addToCollectionWithCallbacks which behaves like addToCollection except it accepts two callbacks.
Those callbacks are invoked when switching views in a collection.

This change is backwards compatible.