Toolbar items with different states

This code snippet shows how to create a toolbar with items that can have different states. Switching between states is done by callback. At the end of the callback it is necessary to deselect the item, so that it can be clicked again.