CSelectionConsistencyControllerComp.h
Go to the documentation of this file.
1 #ifndef iwiz_CSelectionConsistencyController_included
2 #define iwiz_CSelectionConsistencyController_included
3 
4 
5 // ACF includes
7 
8 #include "icomp/CComponentBase.h"
9 
10 #include "iprm/ISelectionParam.h"
11 
12 #include "iproc/IStateController.h"
13 
14 
15 namespace iwiz
16 {
17 
18 
23  public icomp::CComponentBase,
24  virtual public iproc::IStateController,
26 {
27 public:
29 
30  I_BEGIN_COMPONENT(CSelectionConsistencyControllerComp);
31  I_REGISTER_INTERFACE(iproc::IStateController);
32  I_REGISTER_INTERFACE(istd::IChangeable);
33  I_ASSIGN_MULTI_0(m_enterDependenciesCompPtr, "Dependencies", "List of states must be valid before this state can be entered", false);
34  I_ASSIGN_TO(m_enterDependenciesModelCompPtr, m_enterDependenciesCompPtr, false);
35  I_ASSIGN_MULTI_0(m_leaveCondParamsCompPtr, "LeaveConditionParams", "List of selection parameters, needed to be consistent to allow state leaving", false);
36  I_ASSIGN_TO(m_leaveCondParamModelsCompPtr, m_leaveCondParamsCompPtr, false);
37  I_END_COMPONENT;
38 
39  // reimplemented (iproc::IStateController)
40  virtual bool IsStateEnabled() const;
41  virtual bool IsStateActive() const;
42  virtual bool IsEnterAllowed(bool isActionAllowed = true, const IStateController* prevStatePtr = NULL) const;
43  virtual bool IsLeaveAllowed(bool isActionAllowed = true, const IStateController* nextStatePtr = NULL) const;
44  virtual bool TryEnterState(bool isActionAllowed = true, const IStateController* prevStatePtr = NULL);
45  virtual bool TryLeaveState(bool isActionAllowed = true, const IStateController* nextStatePtr = NULL);
46  virtual bool IsResetAllowed() const;
47 
48 protected:
49  void EnsureCacheValid() const;
50 
51  bool CheckParamConsistency(const iprm::ISelectionParam& param) const;
52 
53  // reimplemented (icomp::CComponentBase)
54  void OnComponentCreated();
55  void OnComponentDestroyed();
56 
57  // reimplemented (imod::IObserver)
58  virtual void BeforeUpdate(imod::IModel* modelPtr, int updateFlags, istd::IPolymorphic* updateParamsPtr);
59  virtual void AfterUpdate(imod::IModel* modelPtr, int updateFlags, istd::IPolymorphic* updateParamsPtr);
60 
61 private:
62  I_MULTIREF(iproc::IStateController, m_enterDependenciesCompPtr);
63  I_MULTIREF(imod::IModel, m_enterDependenciesModelCompPtr);
64  I_MULTIREF(iprm::ISelectionParam, m_leaveCondParamsCompPtr);
65  I_MULTIREF(imod::IModel, m_leaveCondParamModelsCompPtr);
66 
67  bool m_isStateActive;
68 
69  mutable bool m_isCacheValid;
70 
71  // cached values
72  mutable bool m_isEnterAllowed;
73  mutable bool m_isLeaveAllowed;
74 };
75 
76 
77 } // namespace iwiz
78 
79 
80 #endif // !iwiz_CSelectionConsistencyController_included
81 
82 
virtual void AfterUpdate(imod::IModel *modelPtr, int updateFlags, istd::IPolymorphic *updateParamsPtr)
Component implementation of a wizard controller.
Interface for a wizard page status info.
bool CheckParamConsistency(const iprm::ISelectionParam &param) const
virtual bool IsEnterAllowed(bool isActionAllowed=true, const IStateController *prevStatePtr=NULL) const
virtual void BeforeUpdate(imod::IModel *modelPtr, int updateFlags, istd::IPolymorphic *updateParamsPtr)
I_ASSIGN_TO(m_enterDependenciesModelCompPtr, m_enterDependenciesCompPtr, false)
virtual bool IsStateEnabled() const
Check if state is enabled.
virtual bool IsLeaveAllowed(bool isActionAllowed=true, const IStateController *nextStatePtr=NULL) const
virtual bool IsStateActive() const
Check if this state is active.
virtual bool TryEnterState(bool isActionAllowed=true, const IStateController *prevStatePtr=NULL)
virtual bool TryLeaveState(bool isActionAllowed=true, const IStateController *nextStatePtr=NULL)
virtual bool IsResetAllowed() const
Check if reseting is allowed.

© 2007-2011 Witold Gantzke and Kirill Lepskiy