File: htmlboxinline.c

package info (click to toggle)
libgtkhtml2 2.11.0-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,740 kB
  • ctags: 3,830
  • sloc: ansic: 33,179; sh: 8,414; makefile: 597
file content (124 lines) | stat: -rw-r--r-- 3,138 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
   Copyright (C) 2000 CodeFactory AB
   Copyright (C) 2000 Jonas Borgstrm <jonas@codefactory.se>
   Copyright (C) 2000 Anders Carlsson <andersca@codefactory.se>
   
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#include <glib.h>
#include "htmlboxtext.h"
#include "htmlboxinline.h"

static void
html_box_inline_paint (HtmlBox *self, HtmlPainter *painter, GdkRectangle *area, gint tx, gint ty)
{
	HtmlBox *box;

	box = html_box_get_before (self);
	while (box) {
		html_box_paint (box, painter, area, self->x + tx, self->y + ty);
		box = box->next;
	}

	box = html_box_get_after (self);
	while (box) {
		html_box_paint (box, painter, area, self->x + tx, self->y + ty);
		box = box->next;
	}

	box = self->children;

	while (box) {
		/*
		 * Don't paint floating, relative or absolute boxes,
		 * they get painted in html_box_root_paint ()
		 */
		if (HTML_BOX_GET_STYLE (box)->Float == HTML_FLOAT_NONE || HTML_IS_BOX_TEXT (box)) {

			html_box_paint (box, painter, area, tx, ty);
		}
		box = box->next;
	}
}

static gboolean
html_box_inline_handles_events (HtmlBox *self)
{
	/* Normal inline boxes don't handle events */
	return FALSE;
}

static gint
html_box_inline_mbp_sum (HtmlBox *box, gint width)
{
	return 0;
}

static void
html_box_inline_class_init (HtmlBoxClass *klass)
{
	klass->paint = html_box_inline_paint;
	klass->handles_events = html_box_inline_handles_events;
	klass->left_mbp_sum   = html_box_inline_mbp_sum;
	klass->right_mbp_sum  = html_box_inline_mbp_sum;
	klass->top_mbp_sum    = html_box_inline_mbp_sum;
	klass->bottom_mbp_sum = html_box_inline_mbp_sum;
}

static void
html_box_inline_init (HtmlBox *box)
{
}

GType
html_box_inline_get_type (void)
{
       static GType html_type = 0;

       if (!html_type) {
               static GTypeInfo type_info = {
                       sizeof (HtmlBoxInlineClass),
		       NULL,
		       NULL,
                       (GClassInitFunc) html_box_inline_class_init,
		       NULL,
		       NULL,
		       sizeof (HtmlBoxInline),
		       16,
                       (GInstanceInitFunc) html_box_inline_init
               };

               html_type = g_type_register_static (HTML_TYPE_BOX, "HtmlBoxInline", &type_info, 0);
       }
       
       return html_type;
}

HtmlBox *
html_box_inline_new (void)
{
	return g_object_new (HTML_TYPE_BOX_INLINE, NULL);
}