Refactor widget rendering

Widgets are now classes which use inheritance to adjust their
parameters.

Fixes issue #190
Move widget tests to separate module