ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
TabViewController Struct Reference

TabViewControllers arrange and manage their child ViewControllers in a tab view interface. More...

#include <TabViewController.h>

Inheritance diagram for TabViewController:
ViewController

Public Member Functions

Class * _TabViewController (void)
 The TabViewController archetype.
 
TabViewControllerinit (TabViewController *)
 Initializes this TabViewController.
 
TabViewItemtabForViewController (const TabViewController *, const ViewController *)
 Returns the TabViewItem for the specified child ViewController, or NULL.
 
ViewControllerviewControllerForTab (const TabViewController *, const TabViewItem *)
 Returns the child ViewController for the specified child TabViewItem, or NULL.
 
- Public Member Functions inherited from ViewController
Class * _ViewController (void)
 The ViewController archetype.
 
void addChildViewController (ViewController *self, ViewController *childViewController)
 Adds the specified child ViewController to this ViewController.
 
ViewControllerinit (ViewController *self)
 Initializes this ViewController.
 
void loadView (ViewController *self)
 Loads this ViewController's View.
 
void loadViewIfNeeded (ViewController *self)
 Loads this ViewController's View if it is not already loaded.
 
void moveToParentViewController (ViewController *self, ViewController *parentViewController)
 Moves this ViewController to the specified parent.
 
void removeChildViewController (ViewController *self, ViewController *childViewController)
 Removes the specified child ViewController from this ViewController.
 
void removeFromParentViewController (ViewController *self)
 Removes this ViewController from its parent.
 
void renderDeviceDidReset (ViewController *self)
 Informs this ViewController that the render device has reset.
 
void renderDeviceWillReset (ViewController *self)
 Informs this ViewController that the render device will reset.
 
void respondToEvent (ViewController *self, const SDL_Event *event)
 Responds to the given event.
 
void setView (ViewController *self, View *view)
 Sets this ViewController's View.
 
void viewDidAppear (ViewController *self)
 This method is invoked after this ViewController's View is added to the View hierarchy.
 
void viewDidDisappear (ViewController *self)
 This method is invoked after this ViewController's View is removed to the View hierarchy.
 
void viewWillAppear (ViewController *self)
 This method is invoked before this ViewController's View is added to the View hierarchy.
 
void viewWillDisappear (ViewController *self)
 This method is invoked before this ViewController's View is removed from the View hierarchy.
 

Data Fields

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

Protected Attributes

TabViewControllerInterface * interface
 The interface.
 

Detailed Description

TabViewControllers arrange and manage their child ViewControllers in a tab view interface.

Tabs are added to the tab view interface by adding child ViewControllers to a TabViewController.

Definition at line 45 of file TabViewController.h.

Member Function Documentation

◆ _TabViewController()

Class * _TabViewController ( void  )

The TabViewController archetype.

Returns
The TabViewController Class.

Definition at line 169 of file TabViewController.c.

169 {
170 static Class *clazz;
171 static Once once;
172
173 do_once(&once, {
174 clazz = _initialize(&(const ClassDef) {
175 .name = "TabViewController",
176 .superclass = _ViewController(),
177 .instanceSize = sizeof(TabViewController),
178 .interfaceOffset = offsetof(TabViewController, interface),
179 .interfaceSize = sizeof(TabViewControllerInterface),
181 });
182 });
183
184 return clazz;
185}
static void initialize(Class *clazz)
Definition Box.c:123
TabViewControllers arrange and manage their child ViewControllers in a tab view interface.
TabViewControllerInterface * interface
The interface.
Class * _ViewController(void)
The ViewController archetype.

◆ init()

Initializes this TabViewController.

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

Definition at line 99 of file TabViewController.c.

99 {
100 return (TabViewController *) super(ViewController, self, init);
101}
TabViewController * init(TabViewController *)
Initializes this TabViewController.
A ViewController manages a View and its descendants.

◆ tabForViewController()

TabViewItem * tabForViewController ( const TabViewController self,
const ViewController viewController 
)

Returns the TabViewItem for the specified child ViewController, or NULL.

Parameters
selfThe TabViewController.
viewControllerThe child ViewController.
Returns
The TabViewItem associated with the specified child ViewController.

Definition at line 114 of file TabViewController.c.

114 {
115
116 assert(viewController);
117
118 if (viewController->view) {
119 return $((Array *) self->tabView->tabs, find, tabForViewController_predicate, (ident) viewController->view);
120 }
121
122 return NULL;
123}
static bool tabForViewController_predicate(const ident obj, ident data)
Predicate for tabViewItemFor.
ViewController viewController
The superclass.
TabView * tabView
The TabView.
Array * tabs
The TabViewItems.
Definition TabView.h:115
View * view
The main view.

◆ viewControllerForTab()

ViewController * viewControllerForTab ( const TabViewController self,
const TabViewItem tab 
)

Returns the child ViewController for the specified child TabViewItem, or NULL.

Parameters
selfThe TabViewController.
tabThe TabViewItem.
Returns
The child ViewController associated with the specified TabViewItem.

Definition at line 136 of file TabViewController.c.

136 {
137
138 assert(tab);
139
140 if (tab->view) {
141 return $((Array *) self->viewController.childViewControllers, find, viewControllerForTab_predicate, tab->view);
142 }
143
144 return NULL;
145}
static bool viewControllerForTab_predicate(const ident obj, ident data)
Predicate for viewControllerForTab.
View * view
The View this TabViewItem embeds.
Definition TabViewItem.h:82
Array * childViewControllers
The child view controllers.

Field Documentation

◆ interface

TabViewControllerInterface* TabViewController::interface
protected

The interface.

Definition at line 56 of file TabViewController.h.

◆ tabView

TabView* TabViewController::tabView

The TabView.

Definition at line 61 of file TabViewController.h.

◆ viewController

ViewController TabViewController::viewController

The superclass.

Definition at line 50 of file TabViewController.h.


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