1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* This file is part of the KDE libraries
4 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
5 * Copyright (C) 1997 Torben Weis (weis@kde.org)
6 * Copyright (C) 1999, 2000 Helix Code, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
27 #include "htmlobject.h"
29 #define HTML_IMAGE_FACTORY(x) ((HTMLImageFactory *)(x))
30 #define HTML_IMAGE_POINTER(x) ((HTMLImagePointer *)(x))
31 #define HTML_IS_IMAGE(x) (HTML_CHECK_TYPE ((x), HTML_TYPE_IMAGE))
33 struct _HTMLImagePointer
{
36 GdkPixbufLoader
*loader
;
37 GdkPixbufAnimation
*animation
;
38 GdkPixbufAnimationIter
*iter
;
39 GSList
*interests
; /* A list of HTMLImage's, or a NULL pointer for the background pixmap */
40 HTMLImageFactory
*factory
;
43 guint animation_timeout
;
46 #define HTML_IMAGE(x) ((HTMLImage *)(x))
47 #define HTML_IMAGE_POINTER(x) ((HTMLImagePointer *)(x))
51 HTMLImagePointer
*image_ptr
;
59 gint16 specified_width
;
60 gint16 specified_height
;
61 guint percent_width
: 1;
62 guint percent_height
: 1;
64 guint animation_active
: 1;
69 HTMLVAlignType valign
;
78 struct _HTMLImageClass
{
79 HTMLObjectClass parent_class
;
83 extern HTMLImageClass image_class
;
86 void html_image_type_init (void);
87 void html_image_class_init (HTMLImageClass
*klass
,
90 void html_image_init (HTMLImage
*image
,
91 HTMLImageClass
*klass
,
92 HTMLImageFactory
*imf
,
93 const gchar
*filename
,
98 gboolean percent_width
,
99 gboolean percent_height
,
101 HTMLColor
*border_color
,
102 HTMLVAlignType valign
,
104 HTMLObject
*html_image_new (HTMLImageFactory
*imf
,
105 const gchar
*filename
,
110 gboolean percent_width
,
111 gboolean percent_height
,
113 HTMLColor
*border_color
,
114 HTMLVAlignType valign
,
116 void html_image_set_size (HTMLImage
*image
,
121 void html_image_set_spacing (HTMLImage
*image
,
124 void html_image_set_url (HTMLImage
*image
,
126 void html_image_set_valign (HTMLImage
*image
,
127 HTMLVAlignType valign
);
128 void html_image_set_border (HTMLImage
*image
,
130 void html_image_set_alt (HTMLImage
*image
,
132 void html_image_set_map (HTMLImage
*image
,
135 gchar
*html_image_resolve_image_url (GtkHTML
*html
,
138 void html_image_edit_set_url (HTMLImage
*image
,
140 guint
html_image_get_actual_width (HTMLImage
*image
,
141 HTMLPainter
*painter
);
142 guint
html_image_get_actual_height (HTMLImage
*image
,
143 HTMLPainter
*painter
);
144 /* FIXME move to htmlimagefactory.c */
145 HTMLImageFactory
*html_image_factory_new (HTMLEngine
*e
);
146 void html_image_factory_free (HTMLImageFactory
*factory
);
147 void html_image_factory_cleanup (HTMLImageFactory
*factory
); /* Does gc etc. - removes unused image entries */
148 void html_image_factory_stop_animations (HTMLImageFactory
*factory
);
149 void html_image_factory_start_animations (HTMLImageFactory
*factory
);
150 void html_image_factory_set_animate (HTMLImageFactory
*factory
,
152 gboolean
html_image_factory_get_animate (HTMLImageFactory
*factory
);
153 void html_image_factory_deactivate_animations (HTMLImageFactory
*factory
);
154 HTMLImagePointer
*html_image_factory_register (HTMLImageFactory
*factory
,
156 const gchar
*filename
,
158 void html_image_factory_unregister (HTMLImageFactory
*factory
,
159 HTMLImagePointer
*pointer
,
161 void html_image_factory_move_images (HTMLImageFactory
*dst
,
162 HTMLImageFactory
*src
);
163 void html_image_factory_ref_all_images (HTMLImageFactory
*factory
);
164 void html_image_factory_unref_all_images (HTMLImageFactory
*factory
);
165 void html_image_factory_ref_image_ptr (HTMLImageFactory
*factory
,
167 void html_image_factory_unref_image_ptr (HTMLImageFactory
*factory
,
169 #endif /* _HTMLIMAGE_H_ */