Redesigned context menu support

Context menu is now an internal command. Submenus supported and click
events are now handled by scripts.