It seems like you just need a simple class hierarchy. You'd have some base abstract WizardPage
class and subclasses for each essential wizard page case, like WizardWelcomePage
, WizardLastPage
, WizardIntermediatePage
. A wizard is then defined as a collection of wizard pages and each page knows which buttons it should show. Not a particular design pattern, simple OOP.
One other variation of this idea, making things more flexible would be to make the base WizardPage
to accept a collection of WizardButton
instances in its constructor (and WizardCancelButton
, WizardAcceptButton
, WizardNextButton
would be the subclasses). This will allow you to have separate hierarchies (variations) for wizard pages and wizard buttons. I think this can be considered as a Bridge pattern then. Each of the button subclasses would ask for another interface in their constructor so that when they are clicked they can send this information to the WizardEngine
which will make the appropriate action: move to the next page, cancel or accept. You will probably also need another chain of events going from each WizardPage
to indicate when the content became valid or invalid, so that the appropriate buttons can be enabled\disabled by the WizardEngine
.