10255f411SMichael Pfeiffer/*
25b788d58SAxel Dörfler * Copyright 2008-2010, Haiku, Inc. All rights reserved.
30255f411SMichael Pfeiffer * Distributed under the terms of the MIT License.
45b788d58SAxel Dörfler *
51059b4e7SMichael Pfeiffer * Authors:
61059b4e7SMichael Pfeiffer *		Michael Pfeiffer <laplace@users.sourceforge.net>
70255f411SMichael Pfeiffer */
80255f411SMichael Pfeiffer#ifndef WIZARD_CONTROLLER_H
90255f411SMichael Pfeiffer#define WIZARD_CONTROLLER_H
100255f411SMichael Pfeiffer
110255f411SMichael Pfeiffer
120255f411SMichael Pfeiffer#include <SupportDefs.h>
130255f411SMichael Pfeiffer
145b788d58SAxel Dörfler
150255f411SMichael Pfeifferclass WizardView;
160255f411SMichael Pfeifferclass WizardPageView;
170255f411SMichael Pfeiffer
180255f411SMichael Pfeiffer
195b788d58SAxel Dörflerclass WizardController {
200255f411SMichael Pfeifferpublic:
215b788d58SAxel Dörfler								WizardController();
225b788d58SAxel Dörfler	virtual						~WizardController();
230255f411SMichael Pfeiffer
245b788d58SAxel Dörfler	virtual	void				Initialize(WizardView* wizard);
255b788d58SAxel Dörfler	virtual	void				Next(WizardView* wizard);
265b788d58SAxel Dörfler	virtual	void				Previous(WizardView* wizard);
270255f411SMichael Pfeiffer
280255f411SMichael Pfeifferprotected:
295b788d58SAxel Dörfler	virtual	int32				InitialState() = 0;
305b788d58SAxel Dörfler	virtual	int32				NextState(int32 state) = 0;
315b788d58SAxel Dörfler	virtual	WizardPageView*		CreatePage(int32 state, WizardView* wizard) = 0;
320255f411SMichael Pfeiffer
335675f44eSAxel Dörfler			int32				CurrentState() const;
345675f44eSAxel Dörfler
350255f411SMichael Pfeifferprivate:
360255f411SMichael Pfeiffer	class StateStack {
375b788d58SAxel Dörfler	public:
385b788d58SAxel Dörfler		StateStack(int32 state, StateStack* next)
395b788d58SAxel Dörfler			:
405b788d58SAxel Dörfler			fState(state),
415b788d58SAxel Dörfler			fNext(next)
425b788d58SAxel Dörfler		{
435b788d58SAxel Dörfler		}
445b788d58SAxel Dörfler
455b788d58SAxel Dörfler		int32 State()
465b788d58SAxel Dörfler		{
475b788d58SAxel Dörfler			return fState;
485b788d58SAxel Dörfler		}
495b788d58SAxel Dörfler
505b788d58SAxel Dörfler		StateStack* Next()
515b788d58SAxel Dörfler		{
525b788d58SAxel Dörfler			return fNext;
535b788d58SAxel Dörfler		}
545b788d58SAxel Dörfler
555b788d58SAxel Dörfler		void MakeEmpty();
565b788d58SAxel Dörfler
575b788d58SAxel Dörfler	private:
585b788d58SAxel Dörfler		int32 fState;
595b788d58SAxel Dörfler		StateStack* fNext;
600255f411SMichael Pfeiffer	};
610255f411SMichael Pfeiffer
625b788d58SAxel Dörfler			void				_PushState(int32 state);
635b788d58SAxel Dörfler			void				_ShowPage(WizardView* wizard);
645b788d58SAxel Dörfler
655b788d58SAxel Dörflerprivate:
665b788d58SAxel Dörfler			StateStack*			fStack;
670255f411SMichael Pfeiffer};
680255f411SMichael Pfeiffer
690255f411SMichael Pfeiffer
700255f411SMichael Pfeiffer#endif	// WIZARD_CONTROLLER_H
71