28#include <Objectively.h>
104 free(this->identifier);
106 release(this->classNames);
107 release(this->computedStyle);
108 release(this->style);
109 release(this->stylesheet);
110 release(this->subviews);
111 release(this->warnings);
113 this->superview = NULL;
126 String *classNames = $((Object *) this->classNames,
description);
127 String *
description = str(
"%s@%p %s [%d, %d, %d, %d]",
128 this->identifier ?: classnameof(self),
163 String *
string = $$(String, stringWithCharacters, className);
188 assert(subview != other);
196 const Array *subviews = (Array *) self->
subviews;
197 const ssize_t index = $(subviews, indexOfObject, other);
200 if (index == (ssize_t) (subviews->count - 1)) {
201 $(self->
subviews, addObject, subview);
203 $(self->
subviews, insertObjectAtIndex, subview, index + 1);
206 $(self->
subviews, insertObjectAtIndex, subview, index);
209 $(self->
subviews, addObject, subview);
234 if (strcmp(identifier, view->
identifier) == 0) {
290 assert(computedStyle);
301 release(computedStyle);
355 Data *data = $$(Data, dataWithConstMemory, (uint8_t *) chars, strlen(chars));
368 JSONContext *ctx = $(alloc(JSONContext),
init);
369 Dictionary *dictionary = $(ctx, objectFromData, data, 0);
375 MVC_LogError(
"Failed to parse JSON for %s\n", classnameof(self));
396 $(self, bind, inlets, dictionary);
416 Resource *resource = $$(Resource, resourceWithName, name);
432 SDL_PropertiesID props = SDL_GetWindowProperties(self->
window);
443 SDL_SetPointerProperty(props,
"keyResponder", self);
456 SDL_PropertiesID props = SDL_GetWindowProperties(self->
window);
467 SDL_SetPointerProperty(props,
"touchResponder", self);
475static bool _bind(
View *self,
const Inlet *inlets,
const Dictionary *dictionary) {
494 const SDL_Size
size = $(self,
size);
517 if (last != subview) {
531 return (warning->
type & type) == 0;
563 if (SDL_GetRectIntersection(&
clippingFrame, &frame, &frame) ==
false) {
564 frame.w = frame.h = 0;
582 return (
bool) SDL_PointInRect(point, &frame);
602 if (strcmp(identifier, self->
identifier) == 0) {
603 return (
View *) self;
607 const Array *subviews = (Array *) self->
subviews;
608 for (
size_t i = 0; i < subviews->count; i++) {
610 const View *subview = subviews->elements[i];
660 switch (event->type) {
661 case SDL_EVENT_KEY_DOWN:
662 case SDL_EVENT_KEY_UP:
663 case SDL_EVENT_TEXT_INPUT:
672 switch (event->type) {
673 case SDL_EVENT_MOUSE_BUTTON_DOWN:
674 case SDL_EVENT_MOUSE_BUTTON_UP:
675 point = MakePoint(event->button.x, event->button.y);
677 case SDL_EVENT_MOUSE_MOTION:
678 point = MakePoint(event->motion.x, event->motion.y);
680 case SDL_EVENT_MOUSE_WHEEL: {
682 SDL_GetMouseState(&mx, &my);
683 point = MakePoint(mx, my);
713 if (self->
hidden ==
false) {
726 SDL_PushEvent((SDL_Event *) &(
const SDL_UserEvent) {
742 enumerator(self, data);
757 const ssize_t index = $(siblings, indexOfObject, (
const ident) self);
759 enumerator($(siblings, objectAtIndex, index - 1), data);
761 if (index < (ssize_t) (siblings->count - 1)) {
762 enumerator($(siblings, objectAtIndex, index + 1), data);
775 for (
View *view = self->
superview; view; view = view->superview) {
776 enumerator(view, data);
801 const Array *subviews = (Array *) self->
subviews;
802 for (
size_t i = 0; i < subviews->count; i++) {
804 View *subview = subviews->elements[i];
805 enumerator(subview, data);
822 for (
size_t i = 0; i < siblings->count; i++) {
823 View *sibling = siblings->elements[i];
824 if (sibling != self) {
825 enumerator(sibling, data);
839 const Array *subviews = (Array *) self->
subviews;
840 for (
size_t i = 0; i < subviews->count; i++) {
841 enumerator((
View *) subviews->elements[i], data);
868 enumerator(self, data);
870 const Array *subviews = (Array *) self->
subviews;
871 for (
size_t i = 0; i < subviews->count; i++) {
873 View *subview = subviews->elements[i];
882 return strcmp(((String *) obj)->chars, (
const char *) data) == 0;
945 if (self->
hidden ==
false) {
949 const Array *subviews = (Array *) self->
subviews;
950 for (
size_t i = subviews->count; i; i--) {
952 const View *subview = subviews->elements[i - 1];
955 return (
View *) view;
959 return (
View *) self;
980 self = (
View *) super(Object, self,
init);
984 self->
frame = *frame;
987 self->
classNames = $$(Set, setWithCapacity, 0);
993 self->
subviews = $$(Array, arrayWithCapacity, 0);
999 self->
warnings = $$(Array, arrayWithCapacity, 0);
1002 self->
maxSize = MakeSize(INT32_MAX, INT32_MAX);
1059 return SDL_GetPointerProperty(SDL_GetWindowProperties(self->
window),
"keyResponder", NULL) == self;
1072 return SDL_GetPointerProperty(SDL_GetWindowProperties(self->
window),
"touchResponder", NULL) == self;
1084 for (
const View *view = self; view; view = view->
superview) {
1132 const Array *subviews = (Array *) self->
subviews;
1133 for (
size_t i = 0; i < subviews->count; i++) {
1135 View *subview = subviews->elements[i];
1137 SDL_Size subviewSize = $(subview,
size);
1140 subviewSize.w =
bounds.w;
1144 subviewSize.h =
bounds.h;
1147 $(subview,
resize, &subviewSize);
1152 subview->
frame.x = 0;
1164 subview->
frame.y = 0;
1182 assert(simpleSelector);
1184 const char *pattern = simpleSelector->
pattern;
1186 switch (simpleSelector->
type) {
1194 const Class *clazz = classForName(pattern);
1196 return $((Object *) self, isKindOfClass, clazz);
1206 return strcmp(self->
identifier, pattern) == 0;
1212 if (strcmp(
"first-child", pattern) == 0) {
1216 }
else if (strcmp(
"last-child", pattern) == 0) {
1220 }
else if (strcmp(
"nth-child(even)", pattern) == 0) {
1222 return ($((Array *) self->
superview->
subviews, indexOfObject, (ident) self) & 1) == 0;
1224 }
else if (strcmp(
"nth-child(odd)", pattern) == 0) {
1228 }
else if (strcmp(
"hover", pattern) == 0) {
1230 SDL_GetMouseState(&mx, &my);
1231 SDL_Point point = MakePoint(mx, my);
1268 Array *parts = $$(Array, array);
1270 const View *view = self;
1273 Array *classNames = $((Set *) view->
classNames, allObjects);
1278 }
else if (classNames->count) {
1279 part = str(
".%s", ((String *) $(classNames, firstObject))->chars);
1281 part = str(
"%s", classnameof(view));
1284 release(classNames);
1286 $(parts, insertObjectAtIndex, part, 0);
1296 String *
path = $((Array *) parts, componentsJoinedByCharacters,
" > ");
1336 String *
string = $$(String, stringWithCharacters, className);
1371 $(self->
subviews, removeObject, subview);
1386 SDL_TriggerBreakpoint();
1446 SDL_Rect frame = self->
frame;
1448 const View *view = self;
1452 frame.x += superview->
frame.x;
1453 frame.y += superview->
frame.y;
1474 assert(replacement);
1492 SDL_SetPointerProperty(SDL_GetWindowProperties(self->
window),
"keyResponder", NULL);
1508 SDL_SetPointerProperty(SDL_GetWindowProperties(self->
window),
"touchResponder", NULL);
1521 if (self->
frame.w != w || self->
frame.h != h) {
1543 if (*outlet->view == NULL) {
1545 MVC_LogError(
"Failed to resolve outlet '%s' for %s", outlet->identifier, desc->chars);
1549 assert(*outlet->view);
1564 switch (event->type) {
1565 case SDL_EVENT_MOUSE_BUTTON_DOWN:
1568 case SDL_EVENT_MOUSE_BUTTON_UP:
1572 case SDL_EVENT_KEY_DOWN:
1575 case SDL_EVENT_KEY_UP:
1586 if (event->button.clicks) {
1592 if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
1615 Set *selection = $(selector, select, self);
1641 return MakeSize(self->
frame.w, self->
frame.h);
1650 const SDL_Size
size = $(self,
size);
1689 size = MakeSize(0, 0);
1692 for (
size_t i = 0; i < subviews->count; i++) {
1694 const View *subview = subviews->elements[i];
1696 SDL_Size subviewSize;
1702 subviewSize = $(subview,
size);
1705 SDL_Point subviewOrigin = MakePoint(0, 0);
1708 subviewOrigin = MakePoint(subview->
frame.x, subview->
frame.y);
1714 size.w = max(
size.w, subviewOrigin.x + subviewSize.w);
1715 size.h = max(
size.h, subviewOrigin.y + subviewSize.h);
1771 const Array *subviews = (Array *) self->
subviews;
1772 for (
size_t i = 0; i < subviews->count; i++) {
1774 View *subview = subviews->elements[i];
1777 if (strcmp(identifier, subview->
identifier) == 0) {
1820 Data *data = $$(Data, dataWithConstMemory, (ident) chars, strlen(chars));
1835 JSONContext *ctx = $(alloc(JSONContext),
init);
1836 Dictionary *dictionary = $(ctx, objectFromData, data, 0);
1841 release(dictionary);
1882 Resource *resource = $$(Resource, resourceWithName, name);
1916 va_start(args, fmt);
1926 $(self->
warnings, addObject, warning);
1944#pragma mark - View class methods
1951 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
1952 ((ObjectInterface *) clazz->interface)->description =
description;
1956 ((ViewInterface *) clazz->interface)->addClassName =
addClassName;
1957 ((ViewInterface *) clazz->interface)->addSubview =
addSubview;
1961 ((ViewInterface *) clazz->interface)->applyTheme =
applyTheme;
1965 ((ViewInterface *) clazz->interface)->awakeWithData =
awakeWithData;
1971 ((ViewInterface *) clazz->interface)->bind =
_bind;
1972 ((ViewInterface *) clazz->interface)->bounds =
bounds;
1974 ((ViewInterface *) clazz->interface)->clearWarnings =
clearWarnings;
1975 ((ViewInterface *) clazz->interface)->clippingFrame =
clippingFrame;
1976 ((ViewInterface *) clazz->interface)->containsPoint =
containsPoint;
1977 ((ViewInterface *) clazz->interface)->depth =
depth;
1980 ((ViewInterface *) clazz->interface)->didMoveToWindow =
didMoveToWindow;
1981 ((ViewInterface *) clazz->interface)->didReceiveEvent =
didReceiveEvent;
1982 ((ViewInterface *) clazz->interface)->draw =
draw;
1983 ((ViewInterface *) clazz->interface)->emitViewEvent =
emitViewEvent;
1984 ((ViewInterface *) clazz->interface)->enumerate =
enumerate;
1993 ((ViewInterface *) clazz->interface)->hasClassName =
hasClassName;
1994 ((ViewInterface *) clazz->interface)->hasOverflow =
hasOverflow;
1995 ((ViewInterface *) clazz->interface)->hitTest =
hitTest;
1996 ((ViewInterface *) clazz->interface)->
init =
init;
1999 ((ViewInterface *) clazz->interface)->isContainer =
isContainer;
2001 ((ViewInterface *) clazz->interface)->isKeyResponder =
isKeyResponder;
2003 ((ViewInterface *) clazz->interface)->isVisible =
isVisible;
2004 ((ViewInterface *) clazz->interface)->layoutIfNeeded =
layoutIfNeeded;
2005 ((ViewInterface *) clazz->interface)->layoutSubviews =
layoutSubviews;
2006 ((ViewInterface *) clazz->interface)->matchesSelector =
matchesSelector;
2007 ((ViewInterface *) clazz->interface)->moveToWindow =
moveToWindow;
2008 ((ViewInterface *) clazz->interface)->path =
path;
2011 ((ViewInterface *) clazz->interface)->removeClassName =
removeClassName;
2013 ((ViewInterface *) clazz->interface)->removeSubview =
removeSubview;
2014 ((ViewInterface *) clazz->interface)->render =
render;
2017 ((ViewInterface *) clazz->interface)->renderFrame =
renderFrame;
2018 ((ViewInterface *) clazz->interface)->replaceSubview =
replaceSubview;
2021 ((ViewInterface *) clazz->interface)->resize =
resize;
2022 ((ViewInterface *) clazz->interface)->resolve =
resolve;
2023 ((ViewInterface *) clazz->interface)->respondToEvent =
respondToEvent;
2024 ((ViewInterface *) clazz->interface)->select =
_select;
2025 ((ViewInterface *) clazz->interface)->selectFirst =
selectFirst;
2026 ((ViewInterface *) clazz->interface)->
size =
size;
2028 ((ViewInterface *) clazz->interface)->sizeThatFills =
sizeThatFills;
2029 ((ViewInterface *) clazz->interface)->sizeThatFits =
sizeThatFits;
2030 ((ViewInterface *) clazz->interface)->sizeToContain =
sizeToContain;
2031 ((ViewInterface *) clazz->interface)->sizeToFill =
sizeToFill;
2032 ((ViewInterface *) clazz->interface)->sizeToFit =
sizeToFit;
2035 ((ViewInterface *) clazz->interface)->viewport =
viewport;
2042 ((ViewInterface *) clazz->interface)->warn =
warn;
2057 static Class *clazz;
2061 clazz = _initialize(&(
const ClassDef) {
2063 .superclass = _Object(),
2064 .instanceSize =
sizeof(
View),
2065 .interfaceOffset = offsetof(
View, interface),
2066 .interfaceSize =
sizeof(ViewInterface),
View logging facilities via SDL_Log.
#define MVC_LogWarn(fmt,...)
#define MVC_LogDebug(fmt,...)
#define MVC_LogError(fmt,...)
static void drawView(Renderer *self, View *view)
static void drawRectFilled(const Renderer *self, const SDL_Rect *rect, const SDL_Color *color)
static void drawRect(const Renderer *self, const SDL_Rect *rect, const SDL_Color *color)
static Selector * initWithRule(Selector *self, const char *rule)
@ SimpleSelectorTypePseudo
@ SimpleSelectorTypeClass
@ SimpleSelectorTypeUniversal
static bool isComputedEqual(const Style *self, const Style *other)
static Style * initWithAttributes(Style *self, const Dictionary *attributes)
static void addAttributes(Style *self, const Dictionary *attributes)
static Theme * theme(SDL_Window *window)
static void addStylesheet(Theme *self, Stylesheet *stylesheet)
static Style * computeStyle(const Theme *self, const View *view)
static void removeStylesheet(Theme *self, Stylesheet *stylesheet)
ViewEvent
View event relay codes.
@ ViewEventMouseButtonUp
A View has received a mouse button up event.
@ ViewEventMouseButtonDown
A View has received a mouse button down event.
@ ViewEventKeyUp
A View has received a key up event.
@ ViewEventClick
A Control received one or more click events.
@ ViewEventKeyDown
A View has received a key down event.
void(* ViewEnumerator)(View *view, ident data)
A function type for View enumeration.
bool bindInlets(const Inlet *inlets, const Dictionary *dictionary)
Binds each Inlet specified in inlets to the data provided in dictionary.
#define BindInlet(inlet, obj)
Binds the Inlet to obj by invoking the appropriate InletBinding function.
#define MakeInlets(...)
Creates a null-termianted array of Inlets.
#define MakeInlet(name, type, dest, data)
Creates an Inlet with the specified parameters.
const EnumName ViewAlignmentNames[]
static SDL_Size size(const View *self)
static View * viewWithResource(const Resource *resource, Outlet *outlets)
static void removeClassName(View *self, const char *className)
static void addClassName(View *self, const char *className)
static View * selectFirst(View *self, const char *rule)
static bool isContainer(const View *self)
static void addSubviewRelativeTo(View *self, View *subview, View *other, ViewPosition position)
static void didMoveToWindow(View *self, SDL_Window *window)
static bool isDescendantOfView(const View *self, const View *view)
static bool filterViewEvents(void *data, SDL_Event *event)
static void becomeKeyResponder(View *self)
static String * path(const View *self)
static void resize(View *self, const SDL_Size *size)
static void detachStylesheet(View *self, SDL_Window *window)
static bool isTouchResponder(const View *self)
static void layoutIfNeeded(View *self)
static void sizeToContain(View *self)
static bool acceptsKeyResponder(const View *self)
static View * init(View *self)
static Set * _select(View *self, const char *rule)
static void enumerateAncestors(const View *self, ViewEnumerator enumerator, ident data)
static void clearWarnings(const View *self, WarningType type)
static void awakeWithDictionary(View *self, const Dictionary *dictionary)
static int depth(const View *self)
static void enumerateVisible(View *self, ViewEnumerator enumerator, ident data)
static void draw(View *self, Renderer *renderer)
static SDL_Size sizeThatFills(const View *self)
static void removeAllClassNames(View *self)
static void removeSubview(View *self, View *subview)
static void nullifySuperview(View *subview, ident data)
ViewEnumerator to null out superview pointers during parent dealloc.
static void updateBindings_enumerate(View *subview, ident data)
ViewEnumerator for updateBindings recursion.
static void enumerateSubviews(const View *self, ViewEnumerator enumerator, ident data)
static bool visibleSubviews_filter(ident obj, ident data)
Predicate for visibleSubviews.
static View * viewWithResourceName(const char *name, Outlet *outlets)
static void becomeTouchResponder(View *self)
static void removeAllSubviews_enumerate(const Array *array, ident obj, ident data)
ArrayEnumerator for removeAllSubviews.
static void enumerateSelection(View *self, const char *rule, ViewEnumerator enumerator, ident data)
static void respondToEvent(View *self, const SDL_Event *event)
static void applyStyle(View *self, const Style *style)
static bool isVisible(const View *self)
static void resignTouchResponder(View *self)
static void replaceSubview(View *self, View *subview, View *replacement)
static bool matchesSelector(const View *self, const SimpleSelector *simpleSelector)
static SDL_Size sizeThatFits(const View *self)
static void bringSubviewToFront(View *self, View *subview)
static bool didReceiveEvent(const View *self, const SDL_Event *event)
static View * subviewWithIdentifier(const View *self, const char *identifier)
static void _draw(View *view, ident data)
ViewEnumerator adapter for draw.
static String * description(const Object *self)
static bool hasOverflow(const View *self)
static Array * visibleSubviews(const View *self)
static void invalidateStyle(View *self)
static void sizeToFill(View *self)
static void warn(View *self, WarningType type, const char *fmt,...)
static void awakeWithCharacters(View *self, const char *chars)
static View * descendantWithIdentifier(const View *self, const char *identifier)
static void moveToWindow(View *self, SDL_Window *window)
static View * initWithFrame(View *self, const SDL_Rect *frame)
static void removeFromSuperview(View *self)
static bool hasClassName_predicate(const ident obj, ident data)
Predicate for hasClassName.
static void removeAllSubviews(View *self)
static SDL_Size sizeThatContains(const View *self)
static void applyTheme(View *self, const Theme *theme)
static void render(View *self, Renderer *renderer)
static void moveToWindow_enumerate(View *subview, ident data)
ViewEnumerator for moveToWindow recursion.
static void awakeWithResourceName(View *self, const char *name)
static void dealloc(Object *self)
static void invalidateStyle_enumerate(View *view, ident data)
ViewEnumerator for invalidateStyle.
static void addSubview(View *self, View *subview)
static SDL_Rect renderFrame(const View *self)
static void renderDeviceWillReset_enumerate(View *subview, ident data)
ViewEnumerator for renderDeviceWillReset recursion.
static void resignKeyResponder(View *self)
static View * viewWithData(const Data *data, Outlet *outlets)
static View * viewWithCharacters(const char *chars, Outlet *outlets)
static void initialize(Class *clazz)
const EnumName ViewAutoresizingNames[]
static bool acceptsTouchResponder(const View *self)
static void renderDeviceWillReset(View *self)
static bool _bind(View *self, const Inlet *inlets, const Dictionary *dictionary)
static bool clearWarnings_predicate(const ident obj, ident data)
Filter Predicate for clearWarnings.
static void _applyThemeIfNeeded(View *view, ident data)
ViewEnumerator adapter for applyThemeIfNeeded.
static void updateBindings(View *self)
static void willMoveToWindow(View *self, SDL_Window *window)
Uint32 MVC_NOTIFICATION_EVENT
static void attachStylesheet(View *self, SDL_Window *window)
static bool isKeyResponder(const View *self)
static void renderDeviceDidReset(View *self)
static void awakeWithResource(View *self, const Resource *resource)
static void hasOverflow_enumerate(View *view, ident data)
ViewEnumerator for hasOverflow.
static void enumerateSuperview(const View *self, ViewEnumerator enumerator, ident data)
static void renderDeviceDidReset_enumerate(View *subview, ident data)
ViewEnumerator for renderDeviceDidReset recursion.
static void layoutSubviews(View *self)
static void enumerate(View *self, ViewEnumerator enumerator, ident data)
static void enumerateAdjacent(const View *self, ViewEnumerator enumerator, ident data)
static SDL_Rect viewport(const View *self)
static void layoutIfNeeded_enumerate(View *subview, ident data)
ViewEnumerator for layoutIfNeeded recursion.
static View * hitTest(const View *self, const SDL_Point *point)
static bool hasClassName(const View *self, const char *className)
static void applyThemeIfNeeded(View *self, const Theme *theme)
static bool containsPoint(const View *self, const SDL_Point *point)
static void sizeToFit(View *self)
static SDL_Rect clippingFrame(const View *self)
static void enumerateSiblings(const View *self, ViewEnumerator enumerator, ident data)
static View * viewWithDictionary(const Dictionary *dictionary, Outlet *outlets)
static void awakeWithData(View *self, const Data *data)
static void enumerateDescendants(const View *self, ViewEnumerator enumerator, ident data)
static SDL_Rect bounds(const View *self)
static View * ancestorWithIdentifier(const View *self, const char *identifier)
static void resolve(View *self, Outlet *outlets)
static void emitViewEvent(View *self, ViewEvent code, ident data)
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
#define ViewAlignmentMaskBottom
#define ViewAlignmentMaskTop
#define ViewAlignmentMaskMiddle
#define ViewAlignmentMaskHorizontal
ViewPosition
Relative positioning of subviews within their superview.
#define ViewAlignmentMaskVertical
@ ViewAutoresizingContain
@ ViewAlignmentBottomRight
@ ViewAlignmentBottomLeft
@ ViewAlignmentMiddleCenter
@ ViewAlignmentMiddleRight
@ ViewAlignmentMiddleLeft
@ ViewAlignmentBottomCenter
A ViewController manages a View and its descendants.
static Warning * initWithVaList(Warning *self, WarningType type, const char *fmt, va_list args)
WarningType
Warning types.
SDL_Rect MVC_TransformToWindow(SDL_Window *window, const SDL_Rect *rect)
Transforms the specified rectangle to normalized device coordinates in window.
static View * keyResponder(const WindowController *self)
static View * touchResponder(const WindowController *self)
A WindowController manages a ViewController and its descendants within an SDL_Window.
Inlets enable inbound data binding of View attributes through JSON.
Outlets enable outbound data binding of Views through JSON.
const char * identifier
The View identifier.
Renderer extends Object with ObjectivelyMVC's UI rendering layer.
Selectors are comprised of one or more SelectorSequences.
SimpleSelectorType type
The SimpleSelectorType.
char * pattern
The pattern, as provided by the user.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Stylesheet * stylesheet
An optional Stylesheet.
bool clipsSubviews
If true, subviews will be clipped to this View's frame.
void updateBindings(View *self)
Updates data bindings, prompting the appropriate layout changes.
View * superview
The super View.
Array * subviews
The immediate subviews.
ViewController * viewController
The ViewController.
void invalidateStyle(View *self)
Invalidates the computed Style for this View and its descendants.
Style * style
The element-level Style of this View.
ViewAlignment alignment
The alignment.
SDL_Window * window
The window.
bool needsApplyTheme
If true, this View will apply the Theme before it is drawn.
View * viewWithResource(const Resource *resource, Outlet *outlets)
Instantiates a View initialized with the JSON data in resource.
Array * visibleSubviews(const View *self)
SDL_Color borderColor
The border color.
View * viewWithResourceName(const char *name, Outlet *outlets)
Instantiates a View initialized with the JSON Resource with the specified name.
void applyStyle(View *self, const Style *style)
Applies the given Style to this View.
int autoresizingMask
The ViewAutoresizing bitmask.
void detachStylesheet(View *self, SDL_Window *window)
Detaches this View's Stylesheet from the Theme associated with the given window.
View * nextResponder
The next responder, or event handler, in the chain.
bool needsLayout
If true, this View will layout its subviews before it is drawn.
char * identifier
An optional identifier.
Array * warnings
The Warnings this View generated.
SDL_Size size(const View *self)
ViewPadding padding
The padding.
int borderWidth
The border width.
SDL_Size minSize
The minimum size this View may be resized to during layout.
Style * computedStyle
The computed Style of this View.
Set * classNames
The class names.
View * viewWithData(const Data *data, Outlet *outlets)
Instantiates a View initialized with the contents of data.
SDL_Size maxSize
The maximum size this View may be resized to during layout.
View * init(View *self)
Initializes this View.
SDL_Color backgroundColor
The background color.
SDL_Rect frame
The frame, relative to the superview.
View * initWithFrame(View *self, const SDL_Rect *frame)
Initializes this View with the specified frame.
View * viewWithDictionary(const Dictionary *dictionary, Outlet *outlets)
Instantiates a View initialized with the attributes described in dictionary.
bool hidden
If true, this View is not drawn.
String * message
The message.
WarningType type
The WarningType.