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) {
567 String *superdesc = $((Object *) superview,
description);
569 MVC_LogVerbose(
"%s is clipped by %s\n", desc->chars, superdesc->chars);
575 frame.w = frame.h = 0;
593 return (
bool) SDL_PointInRect(point, &frame);
613 if (strcmp(identifier, self->
identifier) == 0) {
614 return (
View *) self;
618 const Array *subviews = (Array *) self->
subviews;
619 for (
size_t i = 0; i < subviews->count; i++) {
621 const View *subview = subviews->elements[i];
671 switch (event->type) {
672 case SDL_EVENT_KEY_DOWN:
673 case SDL_EVENT_KEY_UP:
674 case SDL_EVENT_TEXT_INPUT:
683 switch (event->type) {
684 case SDL_EVENT_MOUSE_BUTTON_DOWN:
685 case SDL_EVENT_MOUSE_BUTTON_UP:
686 point = MakePoint(event->button.x, event->button.y);
688 case SDL_EVENT_MOUSE_MOTION:
689 point = MakePoint(event->motion.x, event->motion.y);
691 case SDL_EVENT_MOUSE_WHEEL: {
693 SDL_GetMouseState(&mx, &my);
694 point = MakePoint(mx, my);
724 if (self->
hidden ==
false) {
737 SDL_PushEvent((SDL_Event *) &(
const SDL_UserEvent) {
753 enumerator(self, data);
768 const ssize_t index = $(siblings, indexOfObject, (
const ident) self);
770 enumerator($(siblings, objectAtIndex, index - 1), data);
772 if (index < (ssize_t) (siblings->count - 1)) {
773 enumerator($(siblings, objectAtIndex, index + 1), data);
786 for (
View *view = self->
superview; view; view = view->superview) {
787 enumerator(view, data);
812 const Array *subviews = (Array *) self->
subviews;
813 for (
size_t i = 0; i < subviews->count; i++) {
815 View *subview = subviews->elements[i];
816 enumerator(subview, data);
833 for (
size_t i = 0; i < siblings->count; i++) {
834 View *sibling = siblings->elements[i];
835 if (sibling != self) {
836 enumerator(sibling, data);
850 const Array *subviews = (Array *) self->
subviews;
851 for (
size_t i = 0; i < subviews->count; i++) {
852 enumerator((
View *) subviews->elements[i], data);
879 enumerator(self, data);
881 const Array *subviews = (Array *) self->
subviews;
882 for (
size_t i = 0; i < subviews->count; i++) {
884 View *subview = subviews->elements[i];
893 return strcmp(((String *) obj)->chars, (
const char *) data) == 0;
956 if (self->
hidden ==
false) {
960 const Array *subviews = (Array *) self->
subviews;
961 for (
size_t i = subviews->count; i; i--) {
963 const View *subview = subviews->elements[i - 1];
966 return (
View *) view;
970 return (
View *) self;
991 self = (
View *) super(Object, self,
init);
995 self->
frame = *frame;
998 self->
classNames = $$(Set, setWithCapacity, 0);
1004 self->
subviews = $$(Array, arrayWithCapacity, 0);
1008 assert(self->
style);
1010 self->
warnings = $$(Array, arrayWithCapacity, 0);
1013 self->
maxSize = MakeSize(INT32_MAX, INT32_MAX);
1070 return SDL_GetPointerProperty(SDL_GetWindowProperties(self->
window),
"keyResponder", NULL) == self;
1083 return SDL_GetPointerProperty(SDL_GetWindowProperties(self->
window),
"touchResponder", NULL) == self;
1095 for (
const View *view = self; view; view = view->
superview) {
1143 const Array *subviews = (Array *) self->
subviews;
1144 for (
size_t i = 0; i < subviews->count; i++) {
1146 View *subview = subviews->elements[i];
1148 SDL_Size subviewSize = $(subview,
size);
1151 subviewSize.w =
bounds.w;
1155 subviewSize.h =
bounds.h;
1158 $(subview,
resize, &subviewSize);
1163 subview->
frame.x = 0;
1175 subview->
frame.y = 0;
1193 assert(simpleSelector);
1195 const char *pattern = simpleSelector->
pattern;
1197 switch (simpleSelector->
type) {
1205 const Class *clazz = classForName(pattern);
1207 return $((Object *) self, isKindOfClass, clazz);
1217 return strcmp(self->
identifier, pattern) == 0;
1223 if (strcmp(
"first-child", pattern) == 0) {
1227 }
else if (strcmp(
"last-child", pattern) == 0) {
1231 }
else if (strcmp(
"nth-child(even)", pattern) == 0) {
1233 return ($((Array *) self->
superview->
subviews, indexOfObject, (ident) self) & 1) == 0;
1235 }
else if (strcmp(
"nth-child(odd)", pattern) == 0) {
1239 }
else if (strcmp(
"hover", pattern) == 0) {
1241 SDL_GetMouseState(&mx, &my);
1242 SDL_Point point = MakePoint(mx, my);
1279 Array *parts = $$(Array, array);
1281 const View *view = self;
1284 Array *classNames = $((Set *) view->
classNames, allObjects);
1289 }
else if (classNames->count) {
1290 part = str(
".%s", ((String *) $(classNames, firstObject))->chars);
1292 part = str(
"%s", classnameof(view));
1295 release(classNames);
1297 $(parts, insertObjectAtIndex, part, 0);
1307 String *
path = $((Array *) parts, componentsJoinedByCharacters,
" > ");
1347 String *
string = $$(String, stringWithCharacters, className);
1382 $(self->
subviews, removeObject, subview);
1397 SDL_TriggerBreakpoint();
1457 SDL_Rect frame = self->
frame;
1459 const View *view = self;
1463 frame.x += superview->
frame.x;
1464 frame.y += superview->
frame.y;
1485 assert(replacement);
1503 SDL_SetPointerProperty(SDL_GetWindowProperties(self->
window),
"keyResponder", NULL);
1519 SDL_SetPointerProperty(SDL_GetWindowProperties(self->
window),
"touchResponder", NULL);
1532 if (self->
frame.w != w || self->
frame.h != h) {
1554 if (*outlet->view == NULL) {
1556 MVC_LogError(
"Failed to resolve outlet '%s' for %s", outlet->identifier, desc->chars);
1560 assert(*outlet->view);
1575 switch (event->type) {
1576 case SDL_EVENT_MOUSE_BUTTON_DOWN:
1579 case SDL_EVENT_MOUSE_BUTTON_UP:
1583 case SDL_EVENT_KEY_DOWN:
1586 case SDL_EVENT_KEY_UP:
1597 if (event->button.clicks) {
1603 if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
1626 Set *selection = $(selector, select, self);
1652 return MakeSize(self->
frame.w, self->
frame.h);
1661 const SDL_Size
size = $(self,
size);
1700 size = MakeSize(0, 0);
1703 for (
size_t i = 0; i < subviews->count; i++) {
1705 const View *subview = subviews->elements[i];
1707 SDL_Size subviewSize;
1713 subviewSize = $(subview,
size);
1716 SDL_Point subviewOrigin = MakePoint(0, 0);
1719 subviewOrigin = MakePoint(subview->
frame.x, subview->
frame.y);
1725 size.w = max(
size.w, subviewOrigin.x + subviewSize.w);
1726 size.h = max(
size.h, subviewOrigin.y + subviewSize.h);
1782 const Array *subviews = (Array *) self->
subviews;
1783 for (
size_t i = 0; i < subviews->count; i++) {
1785 View *subview = subviews->elements[i];
1788 if (strcmp(identifier, subview->
identifier) == 0) {
1831 Data *data = $$(Data, dataWithConstMemory, (ident) chars, strlen(chars));
1846 JSONContext *ctx = $(alloc(JSONContext),
init);
1847 Dictionary *dictionary = $(ctx, objectFromData, data, 0);
1852 release(dictionary);
1893 Resource *resource = $$(Resource, resourceWithName, name);
1927 va_start(args, fmt);
1937 $(self->
warnings, addObject, warning);
1955#pragma mark - View class methods
1962 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
1963 ((ObjectInterface *) clazz->interface)->description =
description;
1967 ((ViewInterface *) clazz->interface)->addClassName =
addClassName;
1968 ((ViewInterface *) clazz->interface)->addSubview =
addSubview;
1972 ((ViewInterface *) clazz->interface)->applyTheme =
applyTheme;
1976 ((ViewInterface *) clazz->interface)->awakeWithData =
awakeWithData;
1982 ((ViewInterface *) clazz->interface)->bind =
_bind;
1983 ((ViewInterface *) clazz->interface)->bounds =
bounds;
1985 ((ViewInterface *) clazz->interface)->clearWarnings =
clearWarnings;
1986 ((ViewInterface *) clazz->interface)->clippingFrame =
clippingFrame;
1987 ((ViewInterface *) clazz->interface)->containsPoint =
containsPoint;
1988 ((ViewInterface *) clazz->interface)->depth =
depth;
1991 ((ViewInterface *) clazz->interface)->didMoveToWindow =
didMoveToWindow;
1992 ((ViewInterface *) clazz->interface)->didReceiveEvent =
didReceiveEvent;
1993 ((ViewInterface *) clazz->interface)->draw =
draw;
1994 ((ViewInterface *) clazz->interface)->emitViewEvent =
emitViewEvent;
1995 ((ViewInterface *) clazz->interface)->enumerate =
enumerate;
2004 ((ViewInterface *) clazz->interface)->hasClassName =
hasClassName;
2005 ((ViewInterface *) clazz->interface)->hasOverflow =
hasOverflow;
2006 ((ViewInterface *) clazz->interface)->hitTest =
hitTest;
2007 ((ViewInterface *) clazz->interface)->
init =
init;
2010 ((ViewInterface *) clazz->interface)->isContainer =
isContainer;
2012 ((ViewInterface *) clazz->interface)->isKeyResponder =
isKeyResponder;
2014 ((ViewInterface *) clazz->interface)->isVisible =
isVisible;
2015 ((ViewInterface *) clazz->interface)->layoutIfNeeded =
layoutIfNeeded;
2016 ((ViewInterface *) clazz->interface)->layoutSubviews =
layoutSubviews;
2017 ((ViewInterface *) clazz->interface)->matchesSelector =
matchesSelector;
2018 ((ViewInterface *) clazz->interface)->moveToWindow =
moveToWindow;
2019 ((ViewInterface *) clazz->interface)->path =
path;
2022 ((ViewInterface *) clazz->interface)->removeClassName =
removeClassName;
2024 ((ViewInterface *) clazz->interface)->removeSubview =
removeSubview;
2025 ((ViewInterface *) clazz->interface)->render =
render;
2028 ((ViewInterface *) clazz->interface)->renderFrame =
renderFrame;
2029 ((ViewInterface *) clazz->interface)->replaceSubview =
replaceSubview;
2032 ((ViewInterface *) clazz->interface)->resize =
resize;
2033 ((ViewInterface *) clazz->interface)->resolve =
resolve;
2034 ((ViewInterface *) clazz->interface)->respondToEvent =
respondToEvent;
2035 ((ViewInterface *) clazz->interface)->select =
_select;
2036 ((ViewInterface *) clazz->interface)->selectFirst =
selectFirst;
2037 ((ViewInterface *) clazz->interface)->
size =
size;
2039 ((ViewInterface *) clazz->interface)->sizeThatFills =
sizeThatFills;
2040 ((ViewInterface *) clazz->interface)->sizeThatFits =
sizeThatFits;
2041 ((ViewInterface *) clazz->interface)->sizeToContain =
sizeToContain;
2042 ((ViewInterface *) clazz->interface)->sizeToFill =
sizeToFill;
2043 ((ViewInterface *) clazz->interface)->sizeToFit =
sizeToFit;
2046 ((ViewInterface *) clazz->interface)->viewport =
viewport;
2053 ((ViewInterface *) clazz->interface)->warn =
warn;
2068 static Class *clazz;
2072 clazz = _initialize(&(
const ClassDef) {
2074 .superclass = _Object(),
2075 .instanceSize =
sizeof(
View),
2076 .interfaceOffset = offsetof(
View, interface),
2077 .interfaceSize =
sizeof(ViewInterface),
View logging facilities via SDL_Log.
#define MVC_LogVerbose(fmt,...)
#define MVC_LogWarn(fmt,...)
#define MVC_LogDebug(fmt,...)
#define MVC_LogError(fmt,...)
#define MVC_LogEnabled(priority)
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.