Enable users to provide custom implementation for the Dialog.

This is a preliminary work to provide a Factory-based class which abstracts much of under-the-hood implementation in the library. A first implementation deals with Dialogs.