00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __CR_BOX_H__
00024 #define __CR_BOX_H__
00025
00026 #include "cr-style.h"
00027 #include "libxml/tree.h"
00028
00029
00030
00031
00032
00033 G_BEGIN_DECLS
00034
00035
00036
00037
00038
00039 enum CRBoxContentType
00040 {
00041 NO_CONTENT_TYPE,
00042 TEXT_CONTENT_TYPE,
00043 IMAGE_CONTENT_TYPE
00044 } ;
00045
00046 typedef struct _CRImageContentDesc CRImageContentDesc ;
00047 struct _CRImageContentDesc
00048 {
00049 guchar *img_buf ;
00050 gulong *len ;
00051 guchar *img_path ;
00052 } ;
00053
00054 typedef struct _CRBoxContent CRBoxContent ;
00055 struct _CRBoxContent
00056 {
00057 enum CRBoxContentType type ;
00058 union
00059 {
00060 guchar *text ;
00061 CRImageContentDesc *img_desc ;
00062 } u ;
00063
00064
00065
00066
00067
00068
00069
00070
00071 gpointer content_cache ;
00072 } ;
00073
00074 typedef struct _CRBoxEdge CRBoxEdge ;
00075
00076
00077
00078
00079
00080
00081
00082
00083 struct _CRBoxEdge
00084 {
00085 gulong x, y, width, max_width,
00086 height, x_offset, y_offset,
00087 child_rmost_x ;
00088 } ;
00089
00090
00091 enum CRBoxType
00092 {
00093 BOX_TYPE_UNDEFINED,
00094 BOX_TYPE_BOX_MODEL,
00095 BOX_TYPE_BLOCK,
00096 BOX_TYPE_ANONYMOUS_BLOCK,
00097 BOX_TYPE_INLINE,
00098 BOX_TYPE_ANONYMOUS_INLINE,
00099 BOX_TYPE_COMPACT,
00100 BOX_TYPE_RUN_IN
00101 } ;
00102
00103 typedef struct _CRBoxData CRBoxData ;
00104
00105
00106
00107
00108
00109
00110 struct _CRBoxData
00111 {
00112
00113
00114
00115
00116
00117 xmlNode *xml_node ;
00118 } ;
00119
00120 CRBoxData *
00121 cr_box_data_new (xmlNode *a_node) ;
00122
00123 void
00124 cr_box_data_destroy (CRBoxData *a_this) ;
00125
00126 typedef struct _CRBoxModel CRBoxModel ;
00127 typedef struct _CRBox CRBox ;
00128
00129
00130
00131
00132
00133
00134
00135
00136 struct _CRBox
00137 {
00138 enum CRBoxType type ;
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 CRBoxEdge inner_edge ;
00151
00152
00153
00154
00155
00156
00157
00158
00159 CRBoxEdge padding_edge ;
00160
00161
00162
00163
00164
00165
00166
00167
00168 CRBoxEdge border_edge ;
00169
00170
00171
00172
00173
00174
00175
00176
00177 CRBoxEdge outer_edge ;
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 CRBoxContent *content ;
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 gboolean as_simple_content ;
00200
00201
00202
00203
00204
00205 CRStyle *style ;
00206
00207
00208 CRBox *parent ;
00209
00210
00211 CRBox *next ;
00212
00213
00214 CRBox *prev ;
00215
00216
00217 CRBox *children ;
00218
00219 CRBoxModel * box_model ;
00220
00221
00222 CRBoxData *box_data ;
00223
00224
00225
00226
00227 gpointer *app_data ;
00228
00229 gulong ref_count ;
00230 } ;
00231
00232 struct _CRBoxModel
00233 {
00234 CRBox box ;
00235 gulong viewport_width ;
00236 gulong viewport_height ;
00237 gulong ref_count ;
00238 } ;
00239
00240
00241 CRBoxModel *
00242 cr_box_model_new (void) ;
00243
00244 void
00245 cr_box_model_destroy (CRBoxModel *a_this) ;
00246
00247 void
00248 cr_box_model_ref (CRBoxModel *a_this) ;
00249
00250 gboolean
00251 cr_box_model_unref (CRBoxModel *a_this) ;
00252
00253 CRBoxContent *
00254 cr_box_content_new_from_text (guchar *a_text) ;
00255
00256 void
00257 cr_box_content_destroy (CRBoxContent *a_this) ;
00258
00259 CRBox *
00260 cr_box_new (CRStyle *a_this, gboolean a_set_default_style) ;
00261
00262 enum CRStatus
00263 cr_box_insert_sibling (CRBox *a_prev,
00264 CRBox *a_next,
00265 CRBox *a_to_insert) ;
00266 enum CRStatus
00267 cr_box_to_string (CRBox *a_this,
00268 gulong a_nb_indent,
00269 GString **a_string) ;
00270
00271 enum CRStatus
00272 cr_box_dump_to_file (CRBox *a_this,
00273 gulong a_nb_indent,
00274 FILE *a_filep) ;
00275
00276 enum CRStatus
00277 cr_box_ref (CRBox *a_this) ;
00278
00279
00280 gboolean
00281 cr_box_unref (CRBox *a_this) ;
00282
00283 enum CRStatus
00284 cr_box_append_child (CRBox *a_this, CRBox *a_to_append) ;
00285
00286 void
00287 cr_box_destroy (CRBox *a_this) ;
00288
00289
00290 G_END_DECLS
00291
00292 #endif
00293