Refactor most checkbox bits into StateButton.

This is in preparation for radio buttons.