ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Style.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for SDL3 and 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.
OBJECTIVELYMVC_EXPORT Class * _Style(void)
Definition Style.c:539
#define OBJECTIVELYMVC_EXPORT
Definition Types.h:40
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