26#include <Objectively/JSONContext.h>
44 release(this->stylesheets);
56 $((Array *) self->
stylesheets, addObject, stylesheet);
66 const View *view = data;
68 const Array *selectors = (Array *) stylesheet->
selectors;
69 for (
size_t i = 0; i < selectors->count; i++) {
71 Selector *selector = $(selectors, objectAtIndex, i);
74 assert(selector->
style);
88 SDL_TriggerBreakpoint();
119 self = (
Theme *) super(Object, self,
init);
122 self->
stylesheets = $$(Array, arrayWithCapacity, 8);
136 $((Array *) self->
stylesheets, removeObject, stylesheet);
155#pragma mark - Class lifecycle
162 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
165 ((ThemeInterface *) clazz->interface)->computeStyle =
computeStyle;
166 ((ThemeInterface *) clazz->interface)->init =
init;
168 ((ThemeInterface *) clazz->interface)->theme =
theme;
180 clazz = _initialize(&(
const ClassDef) {
182 .superclass = _Object(),
183 .instanceSize =
sizeof(
Theme),
184 .interfaceOffset = offsetof(
Theme, interface),
185 .interfaceSize =
sizeof(ThemeInterface),
static String * description(const Object *self)
View logging facilities via SDL_Log.
#define MVC_LogVerbose(fmt,...)
#define MVC_LogEnabled(priority)
static bool matchesView(const Selector *self, const View *view)
static Style * initWithAttributes(Style *self, const Dictionary *attributes)
static ident attributeValue(const Style *self, const char *attr)
static void addSelector(Style *self, Selector *selector)
static void addAttributes(Style *self, const Dictionary *attributes)
static Stylesheet * defaultStylesheet(void)
static ident computeStyle_reduce(const ident obj, ident accumulator, ident data)
Reducer for computeStyle.
static Theme * theme(SDL_Window *window)
static void dealloc(Object *self)
static void addStylesheet(Theme *self, Stylesheet *stylesheet)
static Style * computeStyle(const Theme *self, const View *view)
static void removeStylesheet(Theme *self, Stylesheet *stylesheet)
static void initialize(Class *clazz)
static Theme * init(Theme *self)
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
static WindowController * windowController(SDL_Window *window)
A WindowController manages a ViewController and its descendants within an SDL_Window.
Selectors are comprised of one or more SelectorSequences.
Stylesheets are comprised of Selectors and Styles.
Array * selectors
The Selectors, ordered by specificity.
void removeStylesheet(Theme *self, Stylesheet *stylesheet)
Removes the given Stylesheet from this Theme.
Array * stylesheets
The Stylesheets, in order of priority.
void addStylesheet(Theme *self, Stylesheet *stylesheet)
Adds the specified Stylesheet to this Theme.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
A WindowController manages a ViewController and its descendants within an SDL_Window.