You.i Engine
YiAbstractScreenViewController.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_ABSTRACT_SCREEN_VIEW_CONTROLLER_H_
3 #define _YI_ABSTRACT_SCREEN_VIEW_CONTROLLER_H_
4 
5 #include "framework/YiApp.h"
8 #include "utility/YiBundle.h"
10 
39 {
40 public:
42  {
43  All,
44  Last,
45  None
46  };
47 
56 
65  CYIAbstractScreenViewController(CYISceneManager *pSceneManager, CYIApp *pApplication);
66 
70  void SetTitle(const CYIString &title);
71 
77  CYIString GetTitle() const;
78 
94  virtual void Init() override;
95 
103  void PreloadValidate(CYIBundle bundle);
104 
115  void Preload(CYIBundle bundle, const CYIPersistentStore &StateData);
116 
128  void Load(const CYIPersistentStore &StateData);
129 
136  void StartLoadAnimations();
137 
144  void StartUnloadAnimations();
145 
155  void Unload(CYIPersistentStore &StateData);
156 
165  bool IsLoaded() const;
166 
175  bool IsInitialized() const;
176 
183  void SetBackNavigationEnabled(bool enabled);
184 
190  bool IsBackNavigationEnabled() const;
191 
201  void SetInboundActivityIndicatorEnabled(bool enabled);
202 
207 
220 
225 
232 
237 
244  void SetClearNavigationHistory(bool clear);
245 
249  bool ShouldClearNavigationHistory() const;
250 
262 
267 
279 
284 
293 
302 
311 
319 
328 
337 
338 protected:
346  void SetScreenLoaded(bool isLoaded);
347 
357  void SetInitialized(bool isInitialized);
358 
365  virtual void OnInitScreen() {}
366 
379  virtual void OnPreloadValidateScreen(CYIBundle bundle)
380  {
381  YI_UNUSED(bundle);
382  PreloadValidateSucceeded.Emit(this);
383  }
384 
395  virtual void OnPreloadScreen(CYIBundle bundle, const CYIPersistentStore &StateData)
396  {
397  YI_UNUSED(bundle);
398  YI_UNUSED(StateData);
399  PreloadFinished.Emit(this);
400  }
401 
411  virtual void OnLoadScreen(const CYIPersistentStore &StateData) { YI_UNUSED(StateData); }
412 
422  virtual void OnUnloadScreen(CYIPersistentStore &StateData) { YI_UNUSED(StateData); }
423 
438  virtual void OnStageScreen() = 0;
439 
452  virtual void OnUnstageScreen() = 0;
453 
454 private:
455  virtual void OnBeginAnimationComplete() override;
456  virtual void OnEndAnimationComplete() override;
457 
458  CYIString m_Title;
459  bool m_isBackNavigationEnabled;
460  bool m_isInboundActivityIndicatorEnabled;
461  bool m_isLoaded;
462  CYIScreenProperty::Orientation m_screenOrientation;
463  NavigationHistoryRule m_navigationHistoryRule;
464  bool m_shouldClearNavigationHistory;
465  CYIScreenProperty::StatusBar m_statusBarVisibility;
466  CYIScreenProperty::NavigationBar m_navigationBarVisibility;
467  bool m_isInitialized;
468 };
469 
472 #endif // _YI_ABSTRACT_SCREEN_VIEW_CONTROLLER_H_
The CYIAbstractScreenViewController serves as the base to create application screen view controllers...
Definition: YiAbstractScreenViewController.h:38
The CYIPersistentStore class manages storing and retrieving application state data.
Definition: YiPersistentStore.h:61
void SetBackNavigationEnabled(bool enabled)
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:82
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
void Preload(CYIBundle bundle, const CYIPersistentStore &StateData)
virtual void OnUnloadScreen(CYIPersistentStore &StateData)
Definition: YiAbstractScreenViewController.h:422
CYISignal< CYIAbstractScreenViewController * > UnloadingAnimationCompleted
Definition: YiAbstractScreenViewController.h:301
NavigationHistoryRule GetNavigationHistoryRule() const
CYIBundle represents a collection of key-value pairs.
Definition: YiBundle.h:46
virtual void OnLoadScreen(const CYIPersistentStore &StateData)
Definition: YiAbstractScreenViewController.h:411
void PreloadValidate(CYIBundle bundle)
bool ShouldClearNavigationHistory() const
The base class for a view controller, responsible for displaying a view.
Definition: YiViewController.h:22
void Unload(CYIPersistentStore &StateData)
Orientation
Definition: YiScreenProperty.h:15
CYISignal< CYIAbstractScreenViewController * > LoadingAnimationCompleted
Definition: YiAbstractScreenViewController.h:292
virtual void OnUnstageScreen()=0
CYIScreenProperty::NavigationBar GetNavigationBarVisibility() const
void SetInboundActivityIndicatorEnabled(bool enabled)
virtual void Init() override
NavigationBar
Definition: YiScreenProperty.h:32
bool IsInboundActivityIndicatorEnabled() const
void SetClearNavigationHistory(bool clear)
#define YI_UNUSED(param)
Definition: YiPredef.h:45
virtual void OnInitScreen()
Definition: YiAbstractScreenViewController.h:365
NavigationHistoryRule
Definition: YiAbstractScreenViewController.h:41
StatusBar
Definition: YiScreenProperty.h:26
void Emit(const typename std::decay< SignalTypes >::type &... params) const
void Load(const CYIPersistentStore &StateData)
void SetNavigationBarVisibility(CYIScreenProperty::NavigationBar visibility)
void SetOrientation(CYIScreenProperty::Orientation orientation)
void SetScreenLoaded(bool isLoaded)
void SetStatusBarVisibility(CYIScreenProperty::StatusBar visibility)
virtual void OnPreloadScreen(CYIBundle bundle, const CYIPersistentStore &StateData)
Definition: YiAbstractScreenViewController.h:395
CYISignal< CYIAbstractScreenViewController * > PreloadFinished
Definition: YiAbstractScreenViewController.h:318
CYISignal< CYIAbstractScreenViewController *, CYIBundle > PreloadValidateFailed
Definition: YiAbstractScreenViewController.h:336
CYISignal< CYIAbstractScreenViewController * > PreloadValidateSucceeded
Definition: YiAbstractScreenViewController.h:327
void SetTitle(const CYIString &title)
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:169
virtual void OnPreloadValidateScreen(CYIBundle bundle)
Definition: YiAbstractScreenViewController.h:379
void SetNavigationHistoryRule(NavigationHistoryRule rule)
The base class for all applications.
Definition: YiApp.h:43
CYISignal< CYIAbstractScreenViewController * > UnloadCompleted
Definition: YiAbstractScreenViewController.h:310
void SetInitialized(bool isInitialized)
CYIScreenProperty::StatusBar GetStatusBarVisibility() const
CYIScreenProperty::Orientation GetOrientation() const