1 /* "a -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*  This file is part of the GtkHTML library.
3  *
4  *  Copyright (C) 2002, Ximian Inc.
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Library General Public
8  *  License as published by the Free Software Foundation; either
9  *  version 2 of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Library General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Library General Public License
17  *  along with this library; see the file COPYING.LIB.  If not, write to
18  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef __HTML_STYLE_H__
23 #define __HTML_STYLE_H__
24 #include "gtkhtml-enums.h"
25 #include "htmlenums.h"
26 #include "htmltypes.h"
27 #include "htmlcolor.h"
28 
29 struct _HTMLLength {
30 	gint           val;
31 	HTMLLengthType type;
32 };
33 
34 struct _HTMLStyle {
35 	HTMLColor          *color;
36 	HTMLFontFace       *face;
37 	GtkHTMLFontStyle    settings;
38 	GtkHTMLFontStyle    mask;
39 
40 	/* Block Level */
41 	HTMLHAlignType      text_align;
42 	HTMLClearType       clear;
43 
44 	/* Cell Level */
45 	HTMLVAlignType      text_valign;
46 
47 	/* box settings */
48 	HTMLLength     *width;
49 	HTMLLength     *height;
50 
51 	gchar           *bg_image;
52 	HTMLColor      *bg_color;
53 	HTMLDisplayType display;
54 
55 	/* border */
56 	gint border_width;
57 	HTMLBorderStyle border_style;
58 	HTMLColor *border_color;
59 	gint padding;
60 };
61 
62 HTMLStyle *html_style_new                  (void);
63 HTMLStyle *html_style_unset_decoration     (HTMLStyle *style, GtkHTMLFontStyle decoration);
64 HTMLStyle *html_style_set_decoration       (HTMLStyle *style, GtkHTMLFontStyle decoration);
65 HTMLStyle *html_style_set_font_size        (HTMLStyle *style, GtkHTMLFontStyle decoration);
66 HTMLStyle *html_style_set_size             (HTMLStyle *style, GtkHTMLFontStyle size);
67 HTMLStyle *html_style_set_display          (HTMLStyle *style, HTMLDisplayType display);
68 HTMLStyle *html_style_set_clear            (HTMLStyle *style, HTMLClearType clear);
69 HTMLStyle *html_style_set_border_style     (HTMLStyle *style, HTMLBorderStyle bstyle);
70 HTMLStyle *html_style_set_border_width     (HTMLStyle *style, gint width);
71 HTMLStyle *html_style_set_border_color     (HTMLStyle *style, HTMLColor *color);
72 HTMLStyle *html_style_set_padding          (HTMLStyle *style, gint padding);
73 HTMLStyle *html_style_add_text_align       (HTMLStyle *style, HTMLHAlignType type);
74 HTMLStyle *html_style_add_text_valign      (HTMLStyle *style, HTMLVAlignType type);
75 HTMLStyle *html_style_add_font_face        (HTMLStyle *style, const HTMLFontFace *face);
76 HTMLStyle *html_style_add_color            (HTMLStyle *style, HTMLColor *face);
77 HTMLStyle *html_style_add_attribute        (HTMLStyle *style, const gchar *attr);
78 HTMLStyle *html_style_add_background_image (HTMLStyle *style, const gchar *url);
79 HTMLStyle *html_style_add_background_color (HTMLStyle *style, HTMLColor *color);
80 HTMLStyle *html_style_add_width            (HTMLStyle *style, gchar *width);
81 HTMLStyle *html_style_add_height           (HTMLStyle *style, gchar *height);
82 void       html_style_free                 (HTMLStyle *style);
83 
84 gboolean   html_parse_color                (const gchar *text, GdkColor *color);
85 
86 #endif /* __HTML_COLOR_H__ */
87