ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Style.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for OpenGL, SDL2 and GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
26#include <Objectively/Enum.h>
27#include <Objectively/Dictionary.h>
28
30
36typedef struct StyleInterface StyleInterface;
37
43struct Style {
44
48 Object object;
49
54 StyleInterface *interface;
55
59 Dictionary *attributes;
60
64 Array *selectors;
65};
66
70struct StyleInterface {
71
75 ObjectInterface objectInterface;
76
86 void (*addAttribute)(Style *self, const char *attr, ident value);
87
95 void (*addAttributes)(Style *self, const Dictionary *attributes);
96
105 void (*addBoolAttribute)(Style *self, const char *attr, _Bool value);
106
115 void (*addCharactersAttribute)(Style *self, const char *attr, const char *value);
116
125 void (*addColorAttribute)(Style *self, const char *attr, const SDL_Color *color);
126
135 void (*addDoubleAttribute)(Style *self, const char *attr, double value);
136
146 void (*addEnumAttribute)(Style *self, const char *attr, const EnumName *names, int value);
147
156 void (*addFloatAttribute)(Style *self, const char *attr, float value);
157
166 void (*addIntegerAttribute)(Style *self, const char *attr, int value);
167
176 void (*addPointAttribute)(Style *self, const char *attr, const SDL_Point *value);
177
186 void (*addRectangleAttribute)(Style *self, const char *attr, const SDL_Rect *value);
187
195 void (*addSelector)(Style *self, Selector *selector);
196
205 void (*addSizeAttribute)(Style *self, const char *attr, const SDL_Size *value);
206
214 ident (*attributeValue)(const Style *self, const char *attr);
215
225 Style *(*initWithAttributes)(Style *self, const Dictionary *attributes);
226
236 Style *(*initWithRules)(Style *self, const char *rules);
237
248 _Bool (*isComputedEqual)(const Style *self, const Style *other);
249
258 Array *(*parse)(const char *css);
259
266 void (*removeAllAttributes)(Style *self);
267
275 void (*removeAttribute)(Style *self, const char *attr);
276};
277
284OBJECTIVELYMVC_EXPORT Class *_Style(void);
The Selector type.
static void addAttribute(Style *self, const char *attr, ident value)
Definition: Style.c:102
static void addDoubleAttribute(Style *self, const char *attr, double value)
Definition: Style.c:173
static void addIntegerAttribute(Style *self, const char *attr, int value)
Definition: Style.c:207
static void addEnumAttribute(Style *self, const char *attr, const EnumName *names, int value)
Definition: Style.c:186
static void addCharactersAttribute(Style *self, const char *attr, const char *value)
Definition: Style.c:138
static void removeAttribute(Style *self, const char *attr)
Definition: Style.c:487
static void addSizeAttribute(Style *self, const char *attr, const SDL_Size *value)
Definition: Style.c:266
static void removeAllAttributes(Style *self)
Definition: Style.c:495
static void addColorAttribute(Style *self, const char *attr, const SDL_Color *color)
Definition: Style.c:151
static ident attributeValue(const Style *self, const char *attr)
Definition: Style.c:284
static void addRectangleAttribute(Style *self, const char *attr, const SDL_Rect *value)
Definition: Style.c:233
static void addBoolAttribute(Style *self, const char *attr, _Bool value)
Definition: Style.c:130
static void addSelector(Style *self, Selector *selector)
Definition: Style.c:255
static void addFloatAttribute(Style *self, const char *attr, float value)
Definition: Style.c:199
static void addPointAttribute(Style *self, const char *attr, const SDL_Point *value)
Definition: Style.c:215
static void addAttributes(Style *self, const Dictionary *attributes)
Definition: Style.c:119
static _Bool isComputedEqual(const Style *self, const Style *other)
Definition: Style.c:331
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
The SDL_Size type.
Definition: Types.h:62
Selectors are comprised of one or more SelectorSequences.
Definition: Selector.h:49
The Style type.
Definition: Style.h:43
Object object
The superclass.
Definition: Style.h:48
Array * selectors
The Selectors.
Definition: Style.h:64
StyleInterface * interface
The interface.
Definition: Style.h:54
Dictionary * attributes
Definition: Style.h:59
Class * _Style(void)
The Style archetype.
Definition: Style.c:537