ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Public Member Functions | Data Fields | Protected Attributes
NavigationViewController Struct Reference

Navigation controllers arrange their child controllers as a stack to facilitate navigation between them. More...

#include <NavigationViewController.h>

Inheritance diagram for NavigationViewController:
ViewController

Public Member Functions

Class * _NavigationViewController (void)
 The NavigationViewController archetype. More...
 
NavigationViewControllerinit (NavigationViewController *self)
 Initializes this NavigationViewController. More...
 
void popToRootViewController (NavigationViewController *self)
 Pops all ViewControllers on the stack except for the root ViewController. More...
 
void popToViewController (NavigationViewController *self, const ViewController *viewController)
 Pops the top ViewController from the stack until the specified ViewController is visible. More...
 
void popViewController (NavigationViewController *self)
 Pops the top ViewController from the stack. More...
 
void pushViewController (NavigationViewController *self, ViewController *viewController)
 Pushes the specified ViewController to the top of the stack. More...
 
ViewController rootViewController (const NavigationViewController *self)
 
ViewController topViewController (const NavigationViewController *self)
 
- Public Member Functions inherited from ViewController
Class * _ViewController (void)
 The ViewController archetype. More...
 
void addChildViewController (ViewController *self, ViewController *childViewController)
 Adds the specified child ViewController to this ViewController. More...
 
void handleNotification (ViewController *self, const Notification *notification)
 Handles a broadcast notification. More...
 
ViewControllerinit (ViewController *self)
 Initializes this ViewController. More...
 
void loadView (ViewController *self)
 Loads this ViewController's View. More...
 
void loadViewIfNeeded (ViewController *self)
 Loads this ViewController's View if it is not already loaded. More...
 
void moveToParentViewController (ViewController *self, ViewController *parentViewController)
 Moves this ViewController to the specified parent. More...
 
void removeChildViewController (ViewController *self, ViewController *childViewController)
 Removes the specified child ViewController from this ViewController. More...
 
void removeFromParentViewController (ViewController *self)
 Removes this ViewController from its parent. More...
 
void respondToEvent (ViewController *self, const SDL_Event *event)
 Responds to the given event. More...
 
void setView (ViewController *self, View *view)
 Sets this ViewController's View. More...
 
void viewDidAppear (ViewController *self)
 This method is invoked after this ViewController's View is added to the View hierarchy. More...
 
void viewDidDisappear (ViewController *self)
 This method is invoked after this ViewController's View is removed to the View hierarchy. More...
 
void viewWillAppear (ViewController *self)
 This method is invoked before this ViewController's View is added to the View hierarchy. More...
 
void viewWillDisappear (ViewController *self)
 This method is invoked before this ViewController's View is removed from the View hierarchy. More...
 

Data Fields

ViewController viewController
 The superclass. More...
 
- Data Fields inherited from ViewController
MutableArray * childViewControllers
 The child view controllers. More...
 
ViewControllerInterface * interface
 The interface. More...
 
Object object
 The superclass. More...
 
ViewControllerparentViewController
 The parent view controller. More...
 
Viewview
 The main view. More...
 

Protected Attributes

NavigationViewControllerInterface * interface
 The interface. More...
 

Detailed Description

Navigation controllers arrange their child controllers as a stack to facilitate navigation between them.

Definition at line 43 of file NavigationViewController.h.

Member Function Documentation

◆ _NavigationViewController()

Class * _NavigationViewController ( void  )

The NavigationViewController archetype.

Returns
The NavigationViewController Class.

Definition at line 150 of file NavigationViewController.c.

150 {
151 static Class *clazz;
152 static Once once;
153
154 do_once(&once, {
155 clazz = _initialize(&(const ClassDef) {
156 .name = "NavigationViewController",
157 .superclass = _ViewController(),
158 .instanceSize = sizeof(NavigationViewController),
159 .interfaceOffset = offsetof(NavigationViewController, interface),
160 .interfaceSize = sizeof(NavigationViewControllerInterface),
162 });
163 });
164
165 return clazz;
166}
static void initialize(Class *clazz)
Navigation controllers arrange their child controllers as a stack to facilitate navigation between th...
NavigationViewControllerInterface * interface
The interface.
Class * _ViewController(void)
The ViewController archetype.

◆ init()

Initializes this NavigationViewController.

Parameters
selfThe NavigationViewController.
Returns
The initialized NavigationViewController, or NULL on error.

Definition at line 38 of file NavigationViewController.c.

38 {
39
40 return (NavigationViewController *) super(ViewController, self, init);
41}
NavigationViewController * init(NavigationViewController *self)
Initializes this NavigationViewController.
A ViewController manages a View and its descendants.

◆ popToRootViewController()

void popToRootViewController ( NavigationViewController self)

Pops all ViewControllers on the stack except for the root ViewController.

Parameters
selfThe NavigationViewController.

Definition at line 68 of file NavigationViewController.c.

68 {
69
73 }
74}
void popToViewController(NavigationViewController *self, const ViewController *viewController)
Pops the top ViewController from the stack until the specified ViewController is visible.
ViewController rootViewController(const NavigationViewController *self)

◆ popToViewController()

void popToViewController ( NavigationViewController self,
const ViewController viewController 
)

Pops the top ViewController from the stack until the specified ViewController is visible.

Parameters
selfThe NavigationViewController.
viewControllerThe ViewController to remain at the top of the stack.

Definition at line 80 of file NavigationViewController.c.

80 {
81
83 while ((topViewController = $(self, topViewController))) {
84
86 break;
87 }
88
89 $(self, popViewController);
90 }
91}
void popViewController(NavigationViewController *self)
Pops the top ViewController from the stack.
ViewController viewController
The superclass.
ViewController topViewController(const NavigationViewController *self)

◆ popViewController()

void popViewController ( NavigationViewController self)

Pops the top ViewController from the stack.

Parameters
selfThe NavigationViewController.

Definition at line 97 of file NavigationViewController.c.

97 {
98
100 if (topViewController) {
102 }
103
104 ViewController *this = (ViewController *) self;
105 ViewController *that = $(self, topViewController);
106
107 if (that) {
108 $(that, viewWillAppear);
109 $(this->view, addSubview, that->view);
110 $(that, viewDidAppear);
111 }
112}
static void addSubview(View *self, View *subview)
Definition: PageView.c:35
View * view
The main view.
void viewWillAppear(ViewController *self)
This method is invoked before this ViewController's View is added to the View hierarchy.
void removeChildViewController(ViewController *self, ViewController *childViewController)
Removes the specified child ViewController from this ViewController.
void viewDidAppear(ViewController *self)
This method is invoked after this ViewController's View is added to the View hierarchy.

◆ pushViewController()

void pushViewController ( NavigationViewController self,
ViewController viewController 
)

Pushes the specified ViewController to the top of the stack.

Parameters
selfThe NavigationViewController.
viewControllerThe ViewController.

Definition at line 47 of file NavigationViewController.c.

47 {
48
49 assert(viewController);
50
51 ViewController *this = (ViewController *) self;
52
55
57 $(this->view, removeSubview, topViewController->view);
59 }
60
62}
static void removeSubview(View *self, View *subview)
Definition: PageView.c:58
void addChildViewController(ViewController *self, ViewController *childViewController)
Adds the specified child ViewController to this ViewController.
void viewDidDisappear(ViewController *self)
This method is invoked after this ViewController's View is removed to the View hierarchy.
void viewWillDisappear(ViewController *self)
This method is invoked before this ViewController's View is removed from the View hierarchy.

◆ rootViewController()

ViewController rootViewController ( const NavigationViewController self)
Parameters
selfThe NavigationViewController.
Returns
The root ViewController on the stack.

Definition at line 118 of file NavigationViewController.c.

118 {
119 return (ViewController *) $((Array *) self->viewController.childViewControllers, firstObject);
120}
MutableArray * childViewControllers
The child view controllers.

◆ topViewController()

ViewController topViewController ( const NavigationViewController self)
Parameters
selfThe NavigationViewController.
Returns
The top ViewController on the stack.

Definition at line 126 of file NavigationViewController.c.

126 {
127 return (ViewController *) $((Array *) self->viewController.childViewControllers, lastObject);
128}

Field Documentation

◆ interface

NavigationViewControllerInterface* NavigationViewController::interface
protected

The interface.

Definition at line 54 of file NavigationViewController.h.

◆ viewController

ViewController NavigationViewController::viewController

The superclass.

Definition at line 48 of file NavigationViewController.h.


The documentation for this struct was generated from the following files: