26#include <Objectively/JSONSerialization.h>
44 release(this->stylesheets);
56 $((MutableArray *) 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 = $$(MutableArray, arrayWithCapacity, 8);
136 $((MutableArray *) self->
stylesheets, removeObject, stylesheet);
155#pragma mark - Class lifecycle
162 ((ObjectInterface *) clazz->interface)->dealloc =
dealloc;
164 ((ThemeInterface *) clazz->interface)->addStylesheet =
addStylesheet;
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 ident computeStyle_reduce(const ident obj, ident accumulator, ident data)
Reducer for computeStyle.
static void dealloc(Object *self)
static void initialize(Class *clazz)
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
A WindowController manages a ViewController and its descendants within an SDL_Window.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
Selectors are comprised of one or more SelectorSequences.
_Bool matchesView(const Selector *self, View *view)
void addSelector(Style *self, Selector *selector)
Adds the given Selector to this Style.
Style * initWithAttributes(Style *self, const Dictionary *attributes)
Initializes this Style with the given attributes.
void addAttributes(Style *self, const Dictionary *attributes)
Adds or replaces the attribtues in attributes to this Style.
ident attributeValue(const Style *self, const char *attr)
Stylesheets are comprised of Selectors and Styles.
Stylesheet * defaultStylesheet(void)
Array * selectors
The Selectors, ordered by specificity.
Style * computeStyle(const Theme *self, View *view)
MutableArray * stylesheets
The Stylesheets, in order of priority.
void removeStylesheet(Theme *self, Stylesheet *stylesheet)
Removes the given Stylesheet from this Theme.
void addStylesheet(Theme *self, Stylesheet *stylesheet)
Adds the specified Stylesheet to this Theme.
Theme * theme(SDL_Window *window)
Class * _Theme(void)
The Theme archetype.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
A WindowController manages a ViewController and its descendants within an SDL_Window.
WindowController * windowController(SDL_Window *window)