You.i Engine
CYIViewController Class Referenceabstract

Detailed Description

The base class for a view controller, responsible for displaying a view.

This base class for a view controller is used to display a view and is responsible for controlling the functionality of the view by building the view and its timelines. The view managed by this controller is intended to be displayed on its own and is a seperate entity from the screen management system. If transitions between screens are desired the CYIAbstractScreenViewController class should be used in conjunction with CYIScreenTransitionManager.

#include <screen/YiViewController.h>

Inheritance diagram for CYIViewController:

Classes

class  TimelineHelper
 Helper class used to start the begin and end animations of the CYIViewController. More...
 

Public Member Functions

 CYIViewController (CYISceneManager *pSceneManager)
 
 CYIViewController (CYISceneManager *pSceneManager, CYISceneView *pView)
 
virtual ~CYIViewController ()
 
virtual void Init ()
 
virtual void UpdateView ()
 
virtual void Begin ()
 
virtual void End ()
 
void SetViewLoaded (bool isLoaded)
 
virtual bool IsViewLoaded () const
 
void SetClearFocus (bool clearFocus)
 
bool ShouldClearFocus () const
 
virtual CYISceneNodeGetSceneRoot () const
 
virtual void OnBeginAnimationComplete ()
 
virtual void OnEndAnimationComplete ()
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Protected Member Functions

virtual void BuildTimelines ()
 
void SetBeginAnimation (CYIAbstractTimeline *pAnimation, TimelineHelper::AnimationDirection direction)
 
void SetEndAnimation (CYIAbstractTimeline *pAnimation, TimelineHelper::AnimationDirection direction)
 

Protected Attributes

CYISceneManagerm_pSceneManager
 
CYISceneViewm_pView
 
CYIAbstractTimelinem_pAnimationIn
 
CYIAbstractTimelinem_pAnimationOut
 

Constructor & Destructor Documentation

◆ CYIViewController() [1/2]

CYIViewController::CYIViewController ( CYISceneManager pSceneManager)

Constructs a CYIViewController with pSceneManager. The view will be nullptr until Init() is called.

Warning
pSceneManager must not be nullptr.

◆ CYIViewController() [2/2]

CYIViewController::CYIViewController ( CYISceneManager pSceneManager,
CYISceneView pView 
)

Constructs a CYIViewController with pSceneManager and pre-built pView.

Warning
pSceneManager must not be nullptr.

◆ ~CYIViewController()

virtual CYIViewController::~CYIViewController ( )
virtual

Member Function Documentation

◆ Begin()

virtual void CYIViewController::Begin ( )
virtual

Calls Init() if the CYISceneView this controller manages has not been initalized, and animates it using the 'In' timeline.

Reimplemented in CYIActivityIndicatorViewController.

◆ BuildTimelines()

virtual void CYIViewController::BuildTimelines ( )
protectedvirtual

Builds the default 'In' and 'Out' timelines and sets them as the begin and end animations for this view. If the 'In' or 'Out' timeline does not exist, the controller will fallback to 'AnimationIn' and/or 'AnimationOut'. Subclasses can override this if different begin and end animations are required.

Reimplemented in CYIActivityIndicatorViewController.

◆ End()

virtual void CYIViewController::End ( )
virtual

Animates the view out using the 'Out' timeline. By default this will also clear focus if the currently focused view is contained within this view controller.

See also
SetClearFocus

Reimplemented in CYIActivityIndicatorViewController.

◆ GetSceneRoot()

virtual CYISceneNode* CYIViewController::GetSceneRoot ( ) const
virtual

Returns the root node representing this scene. The default implementation will return m_pView but subclasses may override this behaviour if they do their own view management

◆ Init()

virtual void CYIViewController::Init ( )
virtual

Initializes the CYISceneView which this controller manages. This initialization process builds the view and the timelines related to the view.

See also
BuildTimelines

Reimplemented in CYIAbstractScreenViewController.

◆ IsViewLoaded()

virtual bool CYIViewController::IsViewLoaded ( ) const
virtual

Returns true when the view has been loaded. The view will be loaded after a call to Begin() and unloaded after a call to End().

◆ OnBeginAnimationComplete()

virtual void CYIViewController::OnBeginAnimationComplete ( )
virtual

Called when the begin animation has completed.

See also
Begin

◆ OnEndAnimationComplete()

virtual void CYIViewController::OnEndAnimationComplete ( )
virtual

Called when the end animation has completed.

See also
End

◆ SetBeginAnimation()

void CYIViewController::SetBeginAnimation ( CYIAbstractTimeline pAnimation,
TimelineHelper::AnimationDirection  direction 
)
protected

Sets the begin animation for the view controller. The animation will be played in the direction. This will replace the timelines set by BuildTimelines().

See also
Begin

◆ SetClearFocus()

void CYIViewController::SetClearFocus ( bool  clearFocus)

Sets whether focus should be cleared when the view is unloaded.

See also
End

◆ SetEndAnimation()

void CYIViewController::SetEndAnimation ( CYIAbstractTimeline pAnimation,
TimelineHelper::AnimationDirection  direction 
)
protected

Sets the end animation for the view controller. The animation will be played in the direction. This will replace the timelines set by BuildTimelines().

See also
End

◆ SetViewLoaded()

void CYIViewController::SetViewLoaded ( bool  isLoaded)

Sets whether the view is currently loaded.

See also
IsViewLoaded()

◆ ShouldClearFocus()

bool CYIViewController::ShouldClearFocus ( ) const
See also
SetClearFocus

◆ UpdateView()

virtual void CYIViewController::UpdateView ( )
virtual

Implement to update the view with new information such as changes in the view's dimensions.

Note
This method has no default implementation.

Member Data Documentation

◆ m_pAnimationIn

CYIAbstractTimeline* CYIViewController::m_pAnimationIn
protected

◆ m_pAnimationOut

CYIAbstractTimeline* CYIViewController::m_pAnimationOut
protected

◆ m_pSceneManager

CYISceneManager* CYIViewController::m_pSceneManager
protected

◆ m_pView

CYISceneView* CYIViewController::m_pView
protected

The documentation for this class was generated from the following file: