Add in HorizontalLegend.

Lists entries side-by-side in the available width, after which the
entries wrap onto the next row. If an entry is too wide it is
truncated. If there are too many entries some rows will not be shown.

Close #755.
this exact code exists several times in the codebase, and there is probably a way to abstract it out in all cases... by having the base class have a call for attaching listeners which then handles deregistration in the base class