27#include <Objectively/String.h>
31#define _Class _TabView
42 memset(&this->delegate, 0,
sizeof(this->delegate));
44 release(this->tabPageView);
45 release(this->tabSelectionView);
58 const String *identifier = $((Dictionary *) obj, objectForKeyPath,
"identifier");
69 $((
View *) data, bind, inlets, obj);
89 $(self, bind, inlets, dictionary);
91 const Array *tabs = $(dictionary, objectForKeyPath,
"tabs");
109 if (event->type == SDL_EVENT_MOUSE_BUTTON_UP) {
113 const Array *tabs = (Array *) this->tabs;
114 for (
size_t i = 0; i < tabs->count; i++) {
127#pragma mark - TabView
137 $(self->
tabs, addObject, tab);
163 self->
tabs = $$(Array, array);
193 $(self->
tabs, removeObject, tab);
212 int state = tab->
state;
214 if (tab == ((
TabView *) data)->selectedTab) {
217 state &= ~TabStateSelected;
231 const Array *tabs = (Array *) self->
tabs;
279#pragma mark - Class lifecycle
286 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
289 ((ViewInterface *) clazz->interface)->init =
init;
292 ((TabViewInterface *) clazz->interface)->addTab =
addTab;
293 ((TabViewInterface *) clazz->interface)->initWithFrame =
initWithFrame;
295 ((TabViewInterface *) clazz->interface)->selectTab =
selectTab;
308 clazz = _initialize(&(
const ClassDef) {
311 .instanceSize =
sizeof(
TabView),
312 .interfaceOffset = offsetof(
TabView, interface),
313 .interfaceSize =
sizeof(TabViewInterface),
static void setCurrentPage(PageView *self, View *currentPage)
static void removeSubview(View *self, View *subview)
static void addSubview(View *self, View *subview)
static void addTab(TabView *self, TabViewItem *tab)
static TabView * initWithFrame(TabView *self, const SDL_Rect *frame)
static View * init(View *self)
static void awakeWithDictionary(View *self, const Dictionary *dictionary)
static void respondToEvent(View *self, const SDL_Event *event)
static void awakeWithDictionary_tabs(const Array *array, ident obj, ident data)
ArrayEnumerator for awaking TabViewItems.
static void removeTab(TabView *self, TabViewItem *tab)
static void selectTab_enumerate(const Array *array, ident obj, ident data)
ArrayEnumerator for selectTab.
static void selectTab(TabView *self, TabViewItem *tab)
static bool tabWithIdentifier_predicate(const ident obj, ident data)
NULL-safe Predicate for tabWithIdentifier.
static void dealloc(Object *self)
static TabViewItem * tabWithIdentifier(const TabView *self, const char *identifier)
static void initialize(Class *clazz)
Tabbed pages within a single View.
static void setState(TabViewItem *self, int state)
static TableColumn * initWithIdentifier(TableColumn *self, const char *identifier)
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
static void addClassName(View *self, const char *className)
static bool didReceiveEvent(const View *self, const SDL_Event *event)
static void enumerate(View *self, ViewEnumerator enumerator, ident data)
Inlets enable inbound data binding of View attributes through JSON.
PageViews manage their subviews as pages in a book.
StackViews are containers that manage the arrangement of their subviews.
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.
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.
StackView * tabSelectionView
The tab selection container.
Array * tabs
The TabViewItems.
TabViewDelegate delegate
The TabViewDelegate.
TabViewItems embed Views in a TabView.
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.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
bool needsLayout
If true, this View will layout its subviews before it is drawn.
void respondToEvent(View *self, const SDL_Event *event)
Responds to the specified event.