ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Theme.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/Array.h>
27#include <Objectively/Dictionary.h>
28
29#include <ObjectivelyMVC/Font.h>
32
46typedef struct Theme Theme;
47typedef struct ThemeInterface ThemeInterface;
48
54struct Theme {
55
59 Object object;
60
65 ThemeInterface *interface[0];
66
71 Dictionary *fontCache;
72
77 Dictionary *imageCache;
78
84 ImageAtlas *icons;
85
90};
91
95struct ThemeInterface {
96
100 ObjectInterface objectInterface;
101
109 void (*addStylesheet)(Theme *self, Stylesheet *stylesheet);
110
125 AtlasImage *(*addIcon)(Theme *self, const char *name, Image *image);
126
134 Style *(*computeStyle)(const Theme *self, const View *view);
135
145 Image *(*image)(Theme *self, const char *name, float pixelDensity);
146
160 Font *(*font)(Theme *self, const FontAttributes *attributes, float pixelDensity);
161
169 AtlasImage *(*icon)(Theme *self, const char *name);
170
183 ImageAtlas *(*icons)(Theme *self);
184
192 Theme *(*init)(Theme *self);
193
201 void (*removeStylesheet)(Theme *self, Stylesheet *stylesheet);
202
209 void (*renderDeviceDidReset)(Theme *self);
210
220 void (*renderDeviceWillReset)(Theme *self);
221
229 Theme *(*theme)(SDL_Window *window);
230};
231
238OBJECTIVELYMVC_EXPORT Class *_Theme(void);
static String * name(const Font *self)
Definition Font.c:303
TrueType fonts.
Packs many Images into one sheet, backed by one Texture.
The Stylesheet type.
OBJECTIVELYMVC_EXPORT Class * _Theme(void)
Definition Theme.c:334
#define OBJECTIVELYMVC_EXPORT
Definition Types.h:40
An Image packed into an ImageAtlas.
Definition AtlasImage.h:41
The family, size and style attributes that identify a Font, independent of the pixel density at which...
Definition Font.h:64
TrueType fonts.
Definition Font.h:88
Packs many Images into one sheet, backed by one Texture.
Definition ImageAtlas.h:49
Image loading.
Definition Image.h:41
The Style type.
Definition Style.h:43
Stylesheets are comprised of Selectors and Styles.
Definition Stylesheet.h:44
The Theme type.
Definition Theme.h:54
Object object
The superclass.
Definition Theme.h:59
ThemeInterface * interface[0]
The interface type.
Definition Theme.h:65
Array * stylesheets
The Stylesheets, in order of priority.
Definition Theme.h:89
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition View.h:225