infrastructure to implement a custom and context-sensitive contextmenu