gwenhywfar
4.6.0beta
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
html
htmlprops.c
Go to the documentation of this file.
1
/***************************************************************************
2
begin : Sat Feb 20 2010
3
copyright : (C) 2010 by Martin Preuss
4
email : martin@libchipcard.de
5
6
***************************************************************************
7
* Please see toplevel file COPYING for license details *
8
***************************************************************************/
9
10
#ifdef HAVE_CONFIG_H
11
# include <config.h>
12
#endif
13
14
#define DISABLE_DEBUGLOG
15
16
17
#include "htmlprops_p.h"
18
19
#include <gwenhywfar/misc.h>
20
21
#include <assert.h>
22
23
24
25
26
HTML_PROPS
*
HtmlProps_new
(
void
) {
27
HTML_PROPS
*pr;
28
29
GWEN_NEW_OBJECT
(
HTML_PROPS
, pr);
30
pr->refCount=1;
31
pr->foregroundColor=
HTML_PROPS_NOCOLOR
;
32
pr->backgroundColor=
HTML_PROPS_NOCOLOR
;
33
34
return
pr;
35
}
36
37
38
39
void
HtmlProps_free
(
HTML_PROPS
*pr) {
40
if
(pr) {
41
assert(pr->refCount);
42
if
(pr->refCount>1) {
43
pr->refCount--;
44
}
45
else
{
46
HtmlFont_free
(pr->font);
47
pr->refCount=0;
48
GWEN_FREE_OBJECT
(pr);
49
}
50
}
51
}
52
53
54
55
HTML_PROPS
*
HtmlProps_dup
(
const
HTML_PROPS
*pro) {
56
HTML_PROPS
*pr;
57
58
pr=
HtmlProps_new
();
59
pr->font=pro->font;
60
if
(pr->font)
61
HtmlFont_Attach
(pr->font);
62
pr->foregroundColor=pro->foregroundColor;
63
pr->backgroundColor=pro->backgroundColor;
64
65
return
pr;
66
}
67
68
69
70
void
HtmlProps_Attach
(
HTML_PROPS
*pr) {
71
assert(pr);
72
assert(pr->refCount);
73
pr->refCount++;
74
}
75
76
77
78
HTML_FONT
*
HtmlProps_GetFont
(
const
HTML_PROPS
*pr) {
79
assert(pr);
80
assert(pr->refCount);
81
return
pr->font;
82
}
83
84
85
86
void
HtmlProps_SetFont
(
HTML_PROPS
*pr,
HTML_FONT
*fnt) {
87
assert(pr);
88
assert(pr->refCount);
89
HtmlFont_Attach
(fnt);
90
HtmlFont_free
(pr->font);
91
pr->font=fnt;
92
}
93
94
95
96
uint32_t
HtmlProps_GetForegroundColor
(
const
HTML_PROPS
*pr) {
97
assert(pr);
98
assert(pr->refCount);
99
return
pr->foregroundColor;
100
}
101
102
103
104
void
HtmlProps_SetForegroundColor
(
HTML_PROPS
*pr, uint32_t c) {
105
assert(pr);
106
assert(pr->refCount);
107
pr->foregroundColor=c;
108
}
109
110
111
112
uint32_t
HtmlProps_GetBackgroundColor
(
const
HTML_PROPS
*pr) {
113
assert(pr);
114
assert(pr->refCount);
115
return
pr->backgroundColor;
116
}
117
118
119
120
void
HtmlProps_SetBackgroundColor
(
HTML_PROPS
*pr, uint32_t c) {
121
assert(pr);
122
assert(pr->refCount);
123
pr->backgroundColor=c;
124
}
125
126
127
128
129
130
131
Generated on Sun May 26 2013 16:42:54 for gwenhywfar by
1.8.1.2