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