drawing the popover in code from PaintCode