27#include <Objectively/String.h>
31#define _Class _TabView
42 release(this->tabPageView);
43 release(this->tabSelectionView);
56 const String *identifier = $((Dictionary *) obj, objectForKeyPath,
"identifier");
87 $(self,
bind, inlets, dictionary);
89 const Array *tabs = $(dictionary, objectForKeyPath,
"tabs");
107 if (event->type == SDL_MOUSEBUTTONUP) {
111 const Array *tabs = (Array *) this->tabs;
112 for (
size_t i = 0; i < tabs->count; i++) {
125#pragma mark - TabView
135 $(self->
tabs, addObject, tab);
161 self->
tabs = $$(MutableArray, array);
191 $(self->
tabs, removeObject, tab);
210 int state = tab->
state;
212 if (tab == ((
TabView *) data)->selectedTab) {
215 state &= ~TabStateSelected;
229 const Array *tabs = (Array *) self->
tabs;
277#pragma mark - Class lifecycle
284 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
287 ((ViewInterface *) clazz->interface)->init =
init;
290 ((TabViewInterface *) clazz->interface)->addTab =
addTab;
291 ((TabViewInterface *) clazz->interface)->initWithFrame =
initWithFrame;
292 ((TabViewInterface *) clazz->interface)->removeTab =
removeTab;
293 ((TabViewInterface *) clazz->interface)->selectTab =
selectTab;
306 clazz = _initialize(&(
const ClassDef) {
309 .instanceSize =
sizeof(
TabView),
310 .interfaceOffset = offsetof(
TabView, interface),
311 .interfaceSize =
sizeof(TabViewInterface),
static _Bool tabWithIdentifier_predicate(const ident obj, ident data)
NULL-safe Predicate for tabWithIdentifier.
static void awakeWithDictionary_tabs(const Array *array, ident obj, ident data)
ArrayEnumerator for awaking TabViewItems.
static void selectTab_enumerate(const Array *array, ident obj, ident data)
ArrayEnumerator for selectTab.
static void dealloc(Object *self)
static void initialize(Class *clazz)
Tabbed pages within a single View.
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
Inlets enable inbound data binding of View attributes through JSON.
PageViews manage their subviews as pages in a book.
void setCurrentPage(PageView *self, View *currentPage)
Presents the specified subview as the current page of this PageView.
StackViews are containers that manage the arrangement of their subviews.
Class * _StackView(void)
The StackView archetype.
void(* didAddTab)(TabView *tabView, TabViewItem *tab)
Called when a tab is added.
void(* didSelectTab)(TabView *tabView, TabViewItem *tab)
Called when a tab is selected.
void(* willRemoveTab)(TabView *tabView, TabViewItem *tab)
Called when a tab is to be removed.
TabViews allow for the display of multiple pages of information within a single view.
Class * _TabView(void)
The TabView archetype.
void addTab(TabView *self, TabViewItem *tab)
Adds the specified TabViewItem to this TabView.
StackView stackView
The superclass.
PageView * tabPageView
The tab content container.
TabViewItem * selectedTab
The selected TabViewItem.
void removeTab(TabView *self, TabViewItem *tab)
Removes the specified TabViewItem from this TabView.
TabViewItem * tabWithIdentifier(const TabView *self, const char *identifier)
MutableArray * tabs
The TabViewItems.
StackView * tabSelectionView
The tab selection container.
TabViewDelegate delegate
The TabViewDelegate.
void selectTab(TabView *self, TabViewItem *tab)
Selects the specified TabViewItem.
TabViewItems embed Views in a TabView.
setState(TabViewItem *self, int state)
Sets this TabViewItem's state, which may alter its appearance.
int state
The bit mask of TabState.
View * view
The View this TabViewItem embeds.
Label * label
The Label used to select this tab.
char * identifier
The identifier.
TableColumn * initWithIdentifier(TableColumn *self, const char *identifier)
Initializes this TableColumn with the given identifier.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
_Bool bind(View *self, const Inlet *inlets, const Dictionary *dictionary)
Performs data binding for the Inlets described in dictionary.
_Bool needsLayout
If true, this View will layout its subviews before it is drawn.
void addSubview(View *self, View *subview)
Adds a subview to this view, to be drawn above its siblings.
void addClassName(View *self, const char *className)
Adds the given class name to this View.
_Bool didReceiveEvent(const View *self, const SDL_Event *event)
void respondToEvent(View *self, const SDL_Event *event)
Responds to the specified event.
void awakeWithDictionary(View *self, const Dictionary *dictionary)
Wakes this View with the specified Dictionary.
void removeSubview(View *self, View *subview)
Removes the given subview from this View.