ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Public Member Functions | Data Fields | Protected Attributes
Theme Struct Reference

The Theme type. More...

#include <Theme.h>

Inheritance diagram for Theme:

Public Member Functions

Class * _Theme (void)
 The Theme archetype. More...
 
void addStylesheet (Theme *self, Stylesheet *stylesheet)
 Adds the specified Stylesheet to this Theme. More...
 
void apply (const Theme *self, const View *view)
 Applies this Theme to the given View. More...
 
StylecomputeStyle (const Theme *self, View *view)
 
Themeinit (Theme *self)
 Initializes this Theme. More...
 
void removeStylesheet (Theme *self, Stylesheet *stylesheet)
 Removes the given Stylesheet from this Theme. More...
 
Themetheme (SDL_Window *window)
 

Data Fields

Object object
 The superclass. More...
 
MutableArray * stylesheets
 The Stylesheets, in order of priority. More...
 

Protected Attributes

ThemeInterface * interface
 The interface. More...
 

Detailed Description

The Theme type.

Definition at line 51 of file Theme.h.

Member Function Documentation

◆ _Theme()

Class * _Theme ( void  )

The Theme archetype.

Returns
The Theme Class.

Definition at line 175 of file Theme.c.

175 {
176 static Class *clazz;
177 static Once once;
178
179 do_once(&once, {
180 clazz = _initialize(&(const ClassDef) {
181 .name = "Theme",
182 .superclass = _Object(),
183 .instanceSize = sizeof(Theme),
184 .interfaceOffset = offsetof(Theme, interface),
185 .interfaceSize = sizeof(ThemeInterface),
187 });
188 });
189
190 return clazz;
191}
static void initialize(Class *clazz)
Definition: Theme.c:160
The Theme type.
Definition: Theme.h:51
ThemeInterface * interface
The interface.
Definition: Theme.h:62

◆ addStylesheet()

void addStylesheet ( Theme self,
Stylesheet stylesheet 
)

Adds the specified Stylesheet to this Theme.

Parameters
selfThe Theme.
stylesheetThe Stylesheet.

Definition at line 55 of file Theme.c.

55 {
56 $((MutableArray *) self->stylesheets, addObject, stylesheet);
57}
MutableArray * stylesheets
The Stylesheets, in order of priority.
Definition: Theme.h:67

◆ apply()

void apply ( const Theme self,
const View view 
)

Applies this Theme to the given View.

Parameters
selfThe Theme.
viewThe View.

◆ computeStyle()

Style * computeStyle ( const Theme self,
View view 
)

◆ init()

Theme * init ( Theme self)

Initializes this Theme.

Parameters
selfThe Theme.
Returns
The initialized Theme, or NULL on error.

Definition at line 117 of file Theme.c.

117 {
118
119 self = (Theme *) super(Object, self, init);
120 if (self) {
121
122 self->stylesheets = $$(MutableArray, arrayWithCapacity, 8);
123 assert(self->stylesheets);
124
126 }
127
128 return self;
129}
static Stylesheet * defaultStylesheet(void)
Definition: Stylesheet.c:95
Stylesheets are comprised of Selectors and Styles.
Definition: Stylesheet.h:44
Theme * init(Theme *self)
Initializes this Theme.
Definition: Theme.c:117
void addStylesheet(Theme *self, Stylesheet *stylesheet)
Adds the specified Stylesheet to this Theme.
Definition: Theme.c:55

◆ removeStylesheet()

void removeStylesheet ( Theme self,
Stylesheet stylesheet 
)

Removes the given Stylesheet from this Theme.

Parameters
selfThe Theme.
stylesheetThe Stylesheet.

Definition at line 135 of file Theme.c.

135 {
136 $((MutableArray *) self->stylesheets, removeObject, stylesheet);
137}

◆ theme()

Theme * theme ( SDL_Window *  window)
Parameters
windowThe window.
Returns
The Theme for the given window.

Definition at line 143 of file Theme.c.

143 {
144
145 assert(window);
146
148 if (windowController) {
149 return windowController->theme;
150 }
151
152 return NULL;
153}
static WindowController * windowController(SDL_Window *window)
A WindowController manages a ViewController and its descendants within an SDL_Window.
Theme * theme
The Theme.

Field Documentation

◆ interface

ThemeInterface* Theme::interface
protected

The interface.

Definition at line 62 of file Theme.h.

◆ object

Object Theme::object

The superclass.

Definition at line 56 of file Theme.h.

◆ stylesheets

MutableArray* Theme::stylesheets

The Stylesheets, in order of priority.

Definition at line 67 of file Theme.h.


The documentation for this struct was generated from the following files: