CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::TUIViewController< TViewType, TParentViewControllerType > Class Template Reference

A templated UIViewController sub-class that specializes it for a specific view type. More...

#include <CeresEngine/UI/UIViewController.hpp>

Inheritance diagram for CeresEngine::TUIViewController< TViewType, TParentViewControllerType >:
CeresEngine::UIViewController CeresEngine::UIResponder CeresEngine::RefCounted< UIViewController >

Public Types

using ViewType = TViewType
 The type of view controlled by the UIViewController.
 
using ParentViewControllerType = TParentViewControllerType
 The parent type of the view controller, usually UIViewController.
 

Public Member Functions

template<typename... Args>
 TUIViewController (Args &&... args)
 Creates a new TUIViewController and instantiates a new view of type ViewType by passing args to the view constructor.
 
 TUIViewController (ViewType *const view)
 Creates a new TUIViewController from an existing view instance.
 
ViewTypegetView () const
 The view controller’s primary view.
 
UIViewPtr createView () override
 Instantiates a view.
 
void loadView (UIView &view) final
 Instantiates a view.
 
virtual void loadView (ViewType &view)
 Instantiates a view.
 
- Public Member Functions inherited from CeresEngine::UIViewController
 UIViewController ()=default
 
 UIViewController (UIView &view)
 
 UIViewController (UIView *view)
 
 ~UIViewController () override
 
UIViewgetView () const
 The view controller’s primary view.
 
bool isViewLoaded () const noexcept
 A Boolean value indicating whether the view controller’s view is loaded into memory.
 
virtual void didLoad ()
 Called after the view controller’s view has been loaded into memory.
 
virtual void willAppear ()
 Called after the view controller’s view has been loaded into memory is about to be added to the view hierarchy in the window.
 
virtual void didAppear ()
 Called when the view controller’s view is fully transitioned onto the screen.
 
virtual void willDisappear ()
 Called when the view controller’s view is about to be removed from the view hierarchy in the window.
 
virtual void didDisappear ()
 Called after the view controller’s view is removed from the view hierarchy in a window.
 
virtual void willLayout ()
 Called just before the layout method of the view controller's view is called.
 
virtual void didLayout ()
 Called immediately after the layout method of the view controller's view is called.
 
virtual void didAddChildViewController (UIViewController *const childViewController)
 Called immediately after a child UIViewController is added to the hierarchy.
 
virtual void didRemoveChildViewController (UIViewController *const childViewController)
 Called immediately after a child UIViewController is removed from the hierarchy.
 
UIViewControllergetParentViewController () const noexcept
 The immediate ancestor view controller of the view controller.
 
const Vector< UIViewControllerPtr > & getChildViewControllers () const noexcept
 An array of view controllers that are hierarchical children of the view controller.
 
void addChildViewController (UIViewController *childViewController)
 A convenience method for adding a child view controller at the end of the childViewControllers array.
 
void addChildViewController (const UIViewControllerPtr &childViewController)
 A convenience method for adding a child view controller at the end of the childViewControllers array.
 
void removeChildViewController (UIViewController *childViewController)
 A convenience method for removing a child view controller from the childViewControllers array.
 
void removeChildViewController (const UIViewControllerPtr &childViewController)
 A convenience method for removing a child view controller from the childViewControllers array.
 
void removeFromParentViewController ()
 Removes the called view controller from its parent view controller.
 
const AnygetRepresentedObject () const noexcept
 The object whose value is presented in the receiver’s primary view.
 
void setRepresentedObject (const Any &representedObject)
 The object whose value is presented in the receiver’s primary view.
 
UIRespondergetNextResponder () const final
 The next responder after this one, or nil if it has none.
 
- Public Member Functions inherited from CeresEngine::UIResponder
virtual ~UIResponder ()=default
 
virtual bool acceptsFirstResponder () const
 A Boolean value that indicates whether the responder accepts first responder status.
 
virtual bool becomeFirstResponder ()
 Notifies the receiver that it's about to become first responder in its window.
 
virtual bool resignFirstResponder ()
 Notifies the receiver that it's been asked to relinquish its status as first responder in its window.
 
virtual void mouseDown (const UIMouseEvent &event)
 Informs the receiver that the user has pressed the left mouse button.
 
virtual void mouseDragged (const UIMouseEvent &event)
 Informs the receiver that the user has moved the mouse with the left button pressed.
 
virtual void mouseUp (const UIMouseEvent &event)
 Informs the receiver that the user has released the left mouse button.
 
virtual void mouseMoved (const UIMouseEvent &event)
 Informs the receiver that the mouse has moved.
 
virtual void mouseEntered (const UIMouseEvent &event)
 Informs the receiver that the cursor has entered a tracking rectangle.
 
virtual void mouseExited (const UIMouseEvent &event)
 Informs the receiver that the cursor has exited a tracking rectangle.
 
virtual void rightMouseDown (const UIMouseEvent &event)
 Informs the receiver that the user has pressed the right mouse button.
 
virtual void rightMouseDragged (const UIMouseEvent &event)
 Informs the receiver that the user has moved the mouse with the right button pressed.
 
virtual void rightMouseUp (const UIMouseEvent &event)
 Informs the receiver that the user has released the right mouse button.
 
virtual void otherMouseDown (const UIMouseEvent &event)
 Informs the receiver that the user has pressed a mouse button other than the left or right one.
 
virtual void otherMouseDragged (const UIMouseEvent &event)
 Informs the receiver that the user has moved the mouse with a button other than the left or right button pressed.
 
virtual void otherMouseUp (const UIMouseEvent &event)
 Informs the receiver that the user has released a mouse button other than the left or right button.
 
virtual void scrollWheel (const UIMouseEvent &event)
 Informs the receiver that the mouse's scroll wheel has moved.
 
virtual void keyDown (const UIKeyEvent &event)
 Informs the receiver that the user has pressed a key.
 
virtual void keyUp (const UIKeyEvent &event)
 Informs the receiver that the user has released a key.
 
virtual void interpretKeyEvents (const Vector< UIKeyEvent > &events)
 Handles a series of key events.
 
virtual bool performKeyEquivalent (const UIKeyEvent &event)
 Handle a key equivalent.
 
virtual void flushBufferedKeyEvents ()
 Clears any unprocessed key events when overridden by subclasses.
 
virtual void cursorUpdate (const UIEvent &event)
 Informs the receiver that the mouse cursor has moved into a cursor rectangle.
 
virtual void flagsChanged (const UIEvent &event)
 Informs the receiver that the user has pressed or released a modifier key (Shift, Control, and so on).
 
- Public Member Functions inherited from CeresEngine::RefCounted< UIViewController >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Private Types

using super = TParentViewControllerType
 

Additional Inherited Members

- Static Public Member Functions inherited from CeresEngine::UIResponder
static void dispatch (UIResponder *const firstResponder, const UIEvent &event)
 Dispatches a UIEvent to the given first responder.
 

Detailed Description

template<typename TViewType, typename TParentViewControllerType = UIViewController>
class CeresEngine::TUIViewController< TViewType, TParentViewControllerType >

A templated UIViewController sub-class that specializes it for a specific view type.

The view of TViewType is automatically instantiated when constructing the view controller.

Template Parameters
TViewTypeThe type of view to be controlled by the controller.
TParentViewControllerTypeThe UIViewController type to sub-class from.

Member Typedef Documentation

◆ ParentViewControllerType

The parent type of the view controller, usually UIViewController.

◆ super

◆ ViewType

Constructor & Destructor Documentation

◆ TUIViewController() [1/2]

template<typename TViewType , typename TParentViewControllerType = UIViewController>
template<typename... Args>
CeresEngine::TUIViewController< TViewType, TParentViewControllerType >::TUIViewController ( Args &&...  args)
inlineexplicit

Creates a new TUIViewController and instantiates a new view of type ViewType by passing args to the view constructor.

◆ TUIViewController() [2/2]

template<typename TViewType , typename TParentViewControllerType = UIViewController>
CeresEngine::TUIViewController< TViewType, TParentViewControllerType >::TUIViewController ( ViewType *const  view)
inlineexplicit

Creates a new TUIViewController from an existing view instance.

Member Function Documentation

◆ createView()

template<typename TViewType , typename TParentViewControllerType = UIViewController>
UIViewPtr CeresEngine::TUIViewController< TViewType, TParentViewControllerType >::createView ( )
inlineoverridevirtual

Instantiates a view.

This method is called by the system, and is exposed in this class so you can override it to add behavior or replace the created view.

Do not call this method. If you require this method to be called, access the view property.

Do not invoke this method from other objects unless you take care to avoid redundant invocations. The default implementation of the loadView method handles redundant invocations correctly, but a view controller subclass might not. To be safe, other objects should instead access a view controller’s view property.

Reimplemented from CeresEngine::UIViewController.

◆ getView()

The view controller’s primary view.

If this property’s value is not already set when you access it, the view controller invokes the loadView() method. That method, in turn, will create a new view for the controller.

If you want to set a view controller’s view directly, set this property’s value immediately after creating the view controller.

◆ loadView() [1/2]

template<typename TViewType , typename TParentViewControllerType = UIViewController>
void CeresEngine::TUIViewController< TViewType, TParentViewControllerType >::loadView ( UIView view)
inlinefinalvirtual

Instantiates a view.

This method is called by the system, and is exposed in this class so you can override it to add behavior or replace the created view.

Do not call this method. If you require this method to be called, access the view property.

Do not invoke this method from other objects unless you take care to avoid redundant invocations. The default implementation of the loadView method handles redundant invocations correctly, but a view controller subclass might not. To be safe, other objects should instead access a view controller’s view property.

Reimplemented from CeresEngine::UIViewController.

◆ loadView() [2/2]

Instantiates a view.

This method is called by the system, and is exposed in this class so you can override it to add behavior or replace the created view.

Do not call this method. If you require this method to be called, access the view property.

Do not invoke this method from other objects unless you take care to avoid redundant invocations. The default implementation of the loadView method handles redundant invocations correctly, but a view controller subclass might not. To be safe, other objects should instead access a view controller’s view property.

Reimplemented in CeresEngine::UIViewportViewController.


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