gwenhywfar  4.8.0beta
htmlobject.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 "htmlobject_p.h"
18 
19 #include <gwenhywfar/misc.h>
20 #include <gwenhywfar/debug.h>
21 
22 #include <assert.h>
23 #include <string.h>
24 
25 
28 
29 
30 
32  HTML_OBJECT *o;
33 
35  o->refCount=1;
36  o->objectType=t;
37  o->xmlCtx=ctx;
40 
41  return o;
42 }
43 
44 
45 
47  if (o) {
48  assert(o->refCount);
49  if (o->refCount>1)
50  o->refCount--;
51  else {
54 
55  free(o->text);
56  HtmlProps_free(o->properties);
57 
58  o->refCount=0;
60  }
61  }
62 }
63 
64 
65 
67  assert(o);
68  assert(o->refCount);
69  o->refCount++;
70 }
71 
72 
73 
75  assert(o);
76  assert(o->refCount);
77  return o->xmlCtx;
78 }
79 
80 
81 
83  assert(o);
84  assert(o->refCount);
85  return o->objectType;
86 }
87 
88 
89 
91  assert(o);
92  assert(o->refCount);
93  o->objectType=t;
94 }
95 
96 
97 
99  assert(o);
100  assert(o->refCount);
101  return o->properties;
102 }
103 
104 
105 
107  assert(o);
108  assert(o->refCount);
109 
110  HtmlProps_Attach(pr);
111  HtmlProps_free(o->properties);
112  o->properties=pr;
113 }
114 
115 
116 
118  assert(o);
119  assert(o->refCount);
120  return o->x;
121 }
122 
123 
124 
125 void HtmlObject_SetX(HTML_OBJECT *o, int i) {
126  assert(o);
127  assert(o->refCount);
128  o->x=i;
129 }
130 
131 
132 
134  assert(o);
135  assert(o->refCount);
136  return o->y;
137 }
138 
139 
140 
141 void HtmlObject_SetY(HTML_OBJECT *o, int i) {
142  assert(o);
143  assert(o->refCount);
144  o->y=i;
145 }
146 
147 
148 
150  assert(o);
151  assert(o->refCount);
152  return o->width;
153 }
154 
155 
156 
158  assert(o);
159  assert(o->refCount);
160  o->width=i;
161 }
162 
163 
164 
166  assert(o);
167  assert(o->refCount);
168  return o->height;
169 }
170 
171 
172 
174  assert(o);
175  assert(o->refCount);
176  o->height=i;
177 }
178 
179 
180 
182  assert(o);
183  assert(o->refCount);
184  return o->configuredWidth;
185 }
186 
187 
188 
190  assert(o);
191  assert(o->refCount);
192  o->configuredWidth=i;
193 }
194 
195 
196 
198  assert(o);
199  assert(o->refCount);
200  return o->configuredHeight;
201 }
202 
203 
204 
206  assert(o);
207  assert(o->refCount);
208  o->configuredHeight=i;
209 }
210 
211 
212 
213 const char *HtmlObject_GetText(const HTML_OBJECT *o) {
214  assert(o);
215  assert(o->refCount);
216  return o->text;
217 }
218 
219 
220 
221 void HtmlObject_SetText(HTML_OBJECT *o, const char *s) {
222  assert(o);
223  assert(o->refCount);
224  free(o->text);
225  if (s) o->text=strdup(s);
226  else o->text=NULL;
227 }
228 
229 
230 
231 uint32_t HtmlObject_GetFlags(const HTML_OBJECT *o) {
232  assert(o);
233  assert(o->refCount);
234 
235  return o->flags;
236 }
237 
238 
239 
240 void HtmlObject_SetFlags(HTML_OBJECT *o, uint32_t fl) {
241  assert(o);
242  assert(o->refCount);
243 
244  o->flags=fl;
245 }
246 
247 
248 
249 void HtmlObject_AddFlags(HTML_OBJECT *o, uint32_t fl) {
250  assert(o);
251  assert(o->refCount);
252 
253  o->flags|=fl;
254 }
255 
256 
257 
258 void HtmlObject_SubFlags(HTML_OBJECT *o, uint32_t fl) {
259  assert(o);
260  assert(o->refCount);
261 
262  o->flags&=~fl;
263 }
264 
265 
266 
268  assert(o);
269  assert(o->refCount);
270  if (o->layoutFn)
271  return o->layoutFn(o);
272  else {
273  o->width=0;
274  o->height=0;
275  return 0;
276  }
277 }
278 
279 
280 
284 
285  of=o->layoutFn;
286  o->layoutFn=fn;
287  return of;
288 }
289 
290 
291