|
CeresEngine 0.2.0
A game development framework
|
A controller that manages a view. More...
#include <CeresEngine/UI/UIViewController.hpp>
Public Member Functions | |
| UIViewController ()=default | |
| UIViewController (UIView &view) | |
| UIViewController (UIView *view) | |
| ~UIViewController () override | |
| UIView * | getView () 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. | |
| UIViewController * | getParentViewController () 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 Any & | getRepresentedObject () 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. | |
| UIResponder * | getNextResponder () 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. | |
Protected Member Functions | |
| virtual UIViewPtr | createView () |
| Instantiates a view. | |
| virtual void | loadView (UIView &view) |
| Instantiates a view. | |
Private Member Functions | |
| void | instantiateView () |
Private Attributes | |
| UIViewPtr | mView = nullptr |
| The view controller’s primary view. | |
| bool | mViewLoaded = false |
| A Boolean value indicating whether the view controller’s view is loaded into memory. | |
| UIViewController * | mParentViewController |
| The immediate ancestor view controller of the view controller. | |
| Vector< UIViewControllerPtr > | mChildViewControllers |
| An array of view controllers that are hierarchical children of the view controller. | |
| Any | mRepresentedObject |
| The object whose value is presented in the receiver’s primary view. | |
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. | |
A controller that manages a view.
|
default |
|
explicit |
|
explicit |
|
override |
|
inline |
A convenience method for adding a child view controller at the end of the childViewControllers array.
| childViewController | The view controller to be added to the end of the childViewControllers array. |
| void CeresEngine::UIViewController::addChildViewController | ( | UIViewController * | childViewController | ) |
A convenience method for adding a child view controller at the end of the childViewControllers array.
| childViewController | The view controller to be added to the end of the childViewControllers array. |
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::TUIViewController< TViewType, TParentViewControllerType >, CeresEngine::TUIViewController< UISplitView >, and CeresEngine::TUIViewController< UIViewport >.
|
inlinevirtual |
Called immediately after a child UIViewController is added to the hierarchy.
You can override this method to perform tasks to follow the addition of a new child view controller. If you override this method, call the parent implementation at some point in your implementation in case a superclass also overrides this method.
| childViewController | A reference to the newly added child view controller. |
Reimplemented in CeresEngine::UISplitViewController.
Called when the view controller’s view is fully transitioned onto the screen.
This method is called after the completion of any drawing and animations involved in the initial appearance of the view. You can override this method to perform tasks appropriate for that time, such as work that should not interfere with the presentation animation, or starting an animation that you want to begin after the view appears.
If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
Called after the view controller’s view is removed from the view hierarchy in a window.
You can override this method to perform tasks associated with removing the view controller’s view from the window’s view hierarchy, such as releasing resources not needed when the view is not visible or no longer part of the window.
If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
Called immediately after the layout method of the view controller's view is called.
You can override this method to perform tasks to follow the completion of layout of the view controller’s view. If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
Called after the view controller’s view has been loaded into memory.
You can override this method to perform tasks to immediately follow the setting of the view property.
Typically, your override would perform one-time instantiation and initialization of the contents of the view controller’s view. If you override this method, call this method on the base-class at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
|
inlinevirtual |
Called immediately after a child UIViewController is removed from the hierarchy.
You can override this method to perform tasks to follow the removal of a child view controller. If you override this method, call the parent implementation at some point in your implementation in case a superclass also overrides this method.
| childViewController | A reference to the removed child view controller. |
Reimplemented in CeresEngine::UISplitViewController.
|
inlinenoexcept |
An array of view controllers that are hierarchical children of the view controller.
You can add or remove child view controllers by using this property. When you do, the addChildViewController() or removeFromParentViewController() method gets called accordingly.
|
finalvirtual |
The next responder after this one, or nil if it has none.
The next responder must be an object that inherits, directly or indirectly, from UIResponder.
Reimplemented from CeresEngine::UIResponder.
|
inlinenoexcept |
The immediate ancestor view controller of the view controller.
The value of this property is nullptr if the view controller has no parent view controller, such as if the view controller is a window's content view controller.
The object whose value is presented in the receiver’s primary view.
| UIView * CeresEngine::UIViewController::getView | ( | ) | const |
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.
|
private |
|
inlinenoexcept |
A Boolean value indicating whether the view controller’s view is loaded into memory.
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::TUIViewController< TViewType, TParentViewControllerType >, CeresEngine::TUIViewController< UISplitView >, and CeresEngine::TUIViewController< UIViewport >.
|
inline |
A convenience method for removing a child view controller from the childViewControllers array.
| childViewController | The view controller to be removed from the childViewControllers array. |
| void CeresEngine::UIViewController::removeChildViewController | ( | UIViewController * | childViewController | ) |
A convenience method for removing a child view controller from the childViewControllers array.
| childViewController | The view controller to be removed from the childViewControllers array. |
| void CeresEngine::UIViewController::removeFromParentViewController | ( | ) |
Removes the called view controller from its parent view controller.
Use this method to remove a child view controller from its parent view controller.
The object whose value is presented in the receiver’s primary view.
Called after the view controller’s view has been loaded into memory is about to be added to the view hierarchy in the window.
You can override this method to perform tasks prior to a view controller’s view getting added to view hierarchy, such as setting the view’s highlight color. This method is called when:
If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
Called when the view controller’s view is about to be removed from the view hierarchy in the window.
You can override this method to perform tasks that are to precede the disappearance of the view controller’s view, such as stopping a continuous animation that you started in response to the viewDidAppear method call. This method is called when:
If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
Called just before the layout method of the view controller's view is called.
You can override this method to perform tasks to precede the layout of the view controller’s view. If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.
The default implementation of this method does nothing.
|
private |
An array of view controllers that are hierarchical children of the view controller.
You can add or remove child view controllers by using this property. When you do, the addChildViewController() or removeFromParentViewController() method gets called accordingly.
|
private |
The immediate ancestor view controller of the view controller.
The value of this property is nullptr if the view controller has no parent view controller, such as if the view controller is a window's content view controller.
|
private |
The object whose value is presented in the receiver’s primary view.
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.
A Boolean value indicating whether the view controller’s view is loaded into memory.