Add event handler attaching functions to graphical primitives (see #143)