gwenhywfar 5.14.1
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
27{
28 HTML_PROPS *pr;
29
31 pr->refCount=1;
32 pr->foregroundColor=HTML_PROPS_NOCOLOR;
33 pr->backgroundColor=HTML_PROPS_NOCOLOR;
34
35 return pr;
36}
37
38
39
41{
42 if (pr) {
43 assert(pr->refCount);
44 if (pr->refCount>1) {
45 pr->refCount--;
46 }
47 else {
48 HtmlFont_free(pr->font);
49 pr->refCount=0;
51 }
52 }
53}
54
55
56
58{
59 HTML_PROPS *pr;
60
61 pr=HtmlProps_new();
62 pr->font=pro->font;
63 if (pr->font)
64 HtmlFont_Attach(pr->font);
65 pr->foregroundColor=pro->foregroundColor;
66 pr->backgroundColor=pro->backgroundColor;
67
68 return pr;
69}
70
71
72
74{
75 assert(pr);
76 assert(pr->refCount);
77 pr->refCount++;
78}
79
80
81
83{
84 assert(pr);
85 assert(pr->refCount);
86 return pr->font;
87}
88
89
90
92{
93 assert(pr);
94 assert(pr->refCount);
95 HtmlFont_Attach(fnt);
96 HtmlFont_free(pr->font);
97 pr->font=fnt;
98}
99
100
101
103{
104 assert(pr);
105 assert(pr->refCount);
106 return pr->foregroundColor;
107}
108
109
110
112{
113 assert(pr);
114 assert(pr->refCount);
115 pr->foregroundColor=c;
116}
117
118
119
121{
122 assert(pr);
123 assert(pr->refCount);
124 return pr->backgroundColor;
125}
126
127
128
130{
131 assert(pr);
132 assert(pr->refCount);
133 pr->backgroundColor=c;
134}
135
136
137
138
139
140
141
void HtmlFont_Attach(HTML_FONT *fnt)
Definition htmlfont.c:58
void HtmlFont_free(HTML_FONT *fnt)
Definition htmlfont.c:39
struct HTML_FONT HTML_FONT
Definition htmlfont_be.h:23
HTML_PROPS * HtmlProps_dup(const HTML_PROPS *pro)
Definition htmlprops.c:57
HTML_FONT * HtmlProps_GetFont(const HTML_PROPS *pr)
Definition htmlprops.c:82
void HtmlProps_SetBackgroundColor(HTML_PROPS *pr, uint32_t c)
Definition htmlprops.c:129
uint32_t HtmlProps_GetBackgroundColor(const HTML_PROPS *pr)
Definition htmlprops.c:120
void HtmlProps_SetFont(HTML_PROPS *pr, HTML_FONT *fnt)
Definition htmlprops.c:91
void HtmlProps_free(HTML_PROPS *pr)
Definition htmlprops.c:40
void HtmlProps_SetForegroundColor(HTML_PROPS *pr, uint32_t c)
Definition htmlprops.c:111
void HtmlProps_Attach(HTML_PROPS *pr)
Definition htmlprops.c:73
uint32_t HtmlProps_GetForegroundColor(const HTML_PROPS *pr)
Definition htmlprops.c:102
HTML_PROPS * HtmlProps_new(void)
Definition htmlprops.c:26
struct HTML_PROPS HTML_PROPS
#define HTML_PROPS_NOCOLOR
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55