26#include <Objectively/MutableString.h>
32#include "debug.json.h"
34#define _Class _DebugViewController
36#pragma mark - Selectors
45 return this->
debug->computedStyle->selectors->count;
58 return $(this->
debug->computedStyle->selectors, objectAtIndex, row);
78#pragma mark - Computed Style
87 return this->
debug->computedStyle->attributes->count;
104 if (strcmp(
"Attribute", column->
identifier) == 0) {
105 array = $(this->
debug->computedStyle->attributes, allKeys);
107 array = $(this->
debug->computedStyle->attributes, allObjects);
110 value = $(array, objectAtIndex, row);
133#pragma mark - Warnings
142 return this->
debug->warnings->array.count;
157 value = $((Array *) this->
debug->warnings, objectAtIndex, row);
177#pragma mark - ViewController
193 MakeOutlet(
"computedStyle", &this->computedStyle),
203 this->selectors->dataSource.self = self;
206 this->selectors->delegate.self = self;
209 this->computedStyle->dataSource.self = self;
212 this->computedStyle->delegate.self = self;
215 this->warnings->dataSource.self = self;
218 this->warnings->delegate.self = self;
222#pragma mark - DebugViewController
232 this->visibleViews++;
235 if (view == this->
debug) {
244 const Array *warnings = (Array *) view->
warnings;
245 if (warnings->count) {
250 $(this->renderer,
drawRect, &frame);
261 if (view != self->
debug) {
302 if (SDL_GetTicks() - self->
timestamp >= 1000) {
319#pragma mark - Class lifecycle
326 ((ViewControllerInterface *) clazz->interface)->loadView =
loadView;
328 ((DebugViewControllerInterface *) clazz->interface)->debug =
debug;
329 ((DebugViewControllerInterface *) clazz->interface)->init =
init;
341 clazz = _initialize(&(
const ClassDef) {
342 .name =
"DebugViewController",
346 .interfaceSize =
sizeof(DebugViewControllerInterface),
static void debugEnumerate(View *view, ident data)
static TableCellView * selectors_cellForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static ident warnings_valueForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static ident computedStyle_valueForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static TableCellView * warnings_cellForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static size_t computedStyle_numberOfRows(const TableView *tableView)
static TableCellView * computedStyle_cellForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static size_t selectors_numberOfRows(const TableView *tableView)
static void initialize(Class *clazz)
static ident selectors_valueForColumnAndRow(const TableView *tableView, const TableColumn *column, size_t row)
static size_t warnings_numberOfRows(const TableView *tableView)
The DebugViewController type.
static String * description(const Object *self)
#define MakeOutlet(identifier, view)
Creates an Outlet with the specified parameters.
#define MakeOutlets(...)
Creates a NULL-termianted array of Outlets.
A WindowController manages a ViewController and its descendants within an SDL_Window.
Box * initWithFrame(Box *self, const SDL_Rect *frame)
Initializes this Box with the given frame.
void reloadData(CollectionView *self)
Reloads this CollectionView's visible items.
CollectionView * init(CollectionView *self, const SDL_Rect *frame)
Initializes this CollectionView with the specified frame and style.
#define MakeColor(r, g, b, a)
Creates an SDL_Color with the given components.
The DebugViewController type.
Class * _DebugViewController(void)
The DebugViewController archetype.
TableView * selectors
The CSS selectors matching the View.
const View * debug
The View to debug.
TableView * computedStyle
The computed style of the View.
int visibleViews
The count of visibile Views.
Renderer * renderer
A weak referece to the current WindowController's renderer.
TableView * warnings
The warnings generated by the View.
void debug(DebugViewController *self, const View *view, Renderer *renderer)
Debugs the given View.
Text * description
The View description.
const View * root
The root ancestor of the debug View.
Text * path
The path to the debug View.
Outlets enable outbound data binding of Views through JSON.
The Renderer is responsible for rasterizing the View hierarchy of a WindowController.
void setClippingFrame(Renderer *self, const SDL_Rect *clippingFrame)
Sets the clipping frame for draw operations.
void drawRectFilled(const Renderer *self, const SDL_Rect *rect)
Fills a rectangle using glRecti.
void drawRect(const Renderer *self, const SDL_Rect *rect)
Draws a rectangle using GL_LINE_LOOP.
void setDrawColor(Renderer *self, const SDL_Color *color)
Sets the primary color for drawing operations.
Selectors are comprised of one or more SelectorSequences.
char * rule
The rule, as provided by the user.
Stylesheets are comprised of Selectors and Styles.
Stylesheet * stylesheetWithCharacters(const char *chars)
Instantiates a new Stylesheet with the given CSS definitions.
Each row in a TableView is comprised of TableCellViews.
Columns provide alignment, spacing and sorting hints for TableView instances.
char * identifier
The identifier.
ident self
The data source self-reference.
ident(* valueForColumnAndRow)(const TableView *tableView, const TableColumn *column, size_t row)
Called by the TableView for the associated value of a cell.
TableViews provide sortable, tabular presentations of data.
TableViewDataSource dataSource
The data source.
void setTextWithFormat(Text *self, const char *fmt,...)
Sets this Text's text with the given format string.
void setText(Text *self, const char *text)
Sets this Text's text.
A ViewController manages a View and its descendants.
Class * _ViewController(void)
The ViewController archetype.
void loadView(ViewController *self)
Loads this ViewController's View.
void setView(ViewController *self, View *view)
Sets this ViewController's View.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Stylesheet * stylesheet
An optional Stylesheet.
String * path(const View *self)
_Bool isVisible(const View *self)
View * superview
The super View.
MutableArray * warnings
The warnings this View generated.
View * viewWithCharacters(const char *chars, Outlet *outlets)
Instantiates a View initialized with the given null-terminated JSON C string.
SDL_Rect renderFrame(const View *self)
void enumerate(const View *self, ViewEnumerator enumerator, ident data)
void sizeToFit(View *self)
Resizes this View to fit its subviews.