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 
11 #ifndef HTMLOBJECT_BE_H
12 #define HTMLOBJECT_BE_H
13 
14 
15 #include <gwenhywfar/tree.h>
16 #include <gwenhywfar/inherit.h>
17 #include <gwenhywfar/xmlctx.h>
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 
25 typedef struct HTML_OBJECT HTML_OBJECT;
26 GWEN_TREE_FUNCTION_LIB_DEFS(HTML_OBJECT, HtmlObject, GWENHYWFAR_API)
27 GWEN_INHERIT_FUNCTION_LIB_DEFS(HTML_OBJECT, GWENHYWFAR_API)
28 
29 
30 #define HTML_OBJECT_FLAGS_START_ON_NEWLINE 0x00000001
31 #define HTML_OBJECT_FLAGS_END_WITH_NEWLINE 0x00000002
32 
33 #define HTML_OBJECT_FLAGS_JUSTIFY_LEFT     0x00000000
34 #define HTML_OBJECT_FLAGS_JUSTIFY_RIGHT    0x00000004
35 #define HTML_OBJECT_FLAGS_JUSTIFY_HCENTER  0x00000008
36 #define HTML_OBJECT_FLAGS_JUSTIFY_TOP      0x00000000
37 #define HTML_OBJECT_FLAGS_JUSTIFY_BOTTOM   0x00000010
38 #define HTML_OBJECT_FLAGS_JUSTIFY_VCENTER  0x00000020
39 
40 
41 typedef int (*HTML_OBJECT_LAYOUT_FN)(HTML_OBJECT *o);
42 
43 typedef enum {
44   HtmlObjectType_Unknown=0,
45   HtmlObjectType_Box,
46   HtmlObjectType_Word,
47   HtmlObjectType_OrderedList,
48   HtmlObjectType_UnorderedList,
49   HtmlObjectType_ListEntry,
50   HtmlObjectType_Grid,
51   HtmlObjectType_GridEntry,
52   HtmlObjectType_Control,
53   HtmlObjectType_Image,
54 
55   HtmlObjectType_Count
56 } HTML_OBJECT_TYPE;
57 
58 
59 #include <gwenhywfar/htmlprops_be.h>
60 #include <gwenhywfar/htmlctx_be.h>
61 
62 
63 GWENHYWFAR_API HTML_OBJECT *HtmlObject_new(GWEN_XML_CONTEXT *ctx, HTML_OBJECT_TYPE t);
64 GWENHYWFAR_API void HtmlObject_free(HTML_OBJECT *o);
65 GWENHYWFAR_API void HtmlObject_Attach(HTML_OBJECT *o);
66 
67 GWENHYWFAR_API GWEN_XML_CONTEXT *HtmlObject_GetXmlCtx(const HTML_OBJECT *o);
68 
69 GWENHYWFAR_API HTML_OBJECT_TYPE HtmlObject_GetObjectType(const HTML_OBJECT *o);
70 GWENHYWFAR_API void HtmlObject_SetObjectType(HTML_OBJECT *o, HTML_OBJECT_TYPE t);
71 
72 GWENHYWFAR_API HTML_PROPS *HtmlObject_GetProperties(const HTML_OBJECT *o);
73 GWENHYWFAR_API void HtmlObject_SetProperties(HTML_OBJECT *o, HTML_PROPS *pr);
74 
75 GWENHYWFAR_API int HtmlObject_GetX(const HTML_OBJECT *o);
76 GWENHYWFAR_API void HtmlObject_SetX(HTML_OBJECT *o, int i);
77 
78 GWENHYWFAR_API int HtmlObject_GetY(const HTML_OBJECT *o);
79 GWENHYWFAR_API void HtmlObject_SetY(HTML_OBJECT *o, int i);
80 
81 GWENHYWFAR_API int HtmlObject_GetWidth(const HTML_OBJECT *o);
82 GWENHYWFAR_API void HtmlObject_SetWidth(HTML_OBJECT *o, int i);
83 
84 GWENHYWFAR_API int HtmlObject_GetHeight(const HTML_OBJECT *o);
85 GWENHYWFAR_API void HtmlObject_SetHeight(HTML_OBJECT *o, int i);
86 
87 GWENHYWFAR_API int HtmlObject_GetConfiguredWidth(const HTML_OBJECT *o);
88 GWENHYWFAR_API void HtmlObject_SetConfiguredWidth(HTML_OBJECT *o, int i);
89 
90 GWENHYWFAR_API int HtmlObject_GetConfiguredHeight(const HTML_OBJECT *o);
91 GWENHYWFAR_API void HtmlObject_SetConfiguredHeight(HTML_OBJECT *o, int i);
92 
93 GWENHYWFAR_API const char *HtmlObject_GetText(const HTML_OBJECT *o);
94 GWENHYWFAR_API void HtmlObject_SetText(HTML_OBJECT *o, const char *s);
95 
96 GWENHYWFAR_API int HtmlObject_Layout(HTML_OBJECT *o);
97 
98 GWENHYWFAR_API uint32_t HtmlObject_GetFlags(const HTML_OBJECT *o);
99 GWENHYWFAR_API void HtmlObject_SetFlags(HTML_OBJECT *o, uint32_t fl);
100 GWENHYWFAR_API void HtmlObject_AddFlags(HTML_OBJECT *o, uint32_t fl);
101 GWENHYWFAR_API void HtmlObject_SubFlags(HTML_OBJECT *o, uint32_t fl);
102 
103 
104 GWENHYWFAR_API HTML_OBJECT_LAYOUT_FN HtmlObject_SetLayoutFn(HTML_OBJECT *o,
105                                                             HTML_OBJECT_LAYOUT_FN fn);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 
112 #endif
113 
114