Refactoring factories

This PR refactors the workspace, data, toolbox and settings widget factories, adding a macro for each that garanties the proper interface for each subtype.