xref: /haiku/src/apps/bootmanager/WizardController.h (revision 5675f44e8462b10aa718b2bcceb72f9ac60eca87)
1 /*
2  * Copyright 2008-2010, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7  */
8 #ifndef WIZARD_CONTROLLER_H
9 #define WIZARD_CONTROLLER_H
10 
11 
12 #include <SupportDefs.h>
13 
14 
15 class WizardView;
16 class WizardPageView;
17 
18 
19 class WizardController {
20 public:
21 								WizardController();
22 	virtual						~WizardController();
23 
24 	virtual	void				Initialize(WizardView* wizard);
25 	virtual	void				Next(WizardView* wizard);
26 	virtual	void				Previous(WizardView* wizard);
27 
28 protected:
29 	virtual	int32				InitialState() = 0;
30 	virtual	int32				NextState(int32 state) = 0;
31 	virtual	WizardPageView*		CreatePage(int32 state, WizardView* wizard) = 0;
32 
33 			int32				CurrentState() const;
34 
35 private:
36 	class StateStack {
37 	public:
StateStack(int32 state,StateStack * next)38 		StateStack(int32 state, StateStack* next)
39 			:
40 			fState(state),
41 			fNext(next)
42 		{
43 		}
44 
State()45 		int32 State()
46 		{
47 			return fState;
48 		}
49 
Next()50 		StateStack* Next()
51 		{
52 			return fNext;
53 		}
54 
55 		void MakeEmpty();
56 
57 	private:
58 		int32 fState;
59 		StateStack* fNext;
60 	};
61 
62 			void				_PushState(int32 state);
63 			void				_ShowPage(WizardView* wizard);
64 
65 private:
66 			StateStack*			fStack;
67 };
68 
69 
70 #endif	// WIZARD_CONTROLLER_H
71