Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3584 sourcerer 1
/*
2
 * Copyright 2010 Vincent Sanders 
3
 *
4
 * Framebuffer windowing toolkit filled area widget
5
 *
6
 * This file is part of NetSurf, http://www.netsurf-browser.org/
7
 *
8
 * NetSurf is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; version 2 of the License.
11
 *
12
 * NetSurf is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see .
19
 */
20
 
21
#include 
22
#include 
23
 
24
#include 
25
#include 
26
 
27
#include "desktop/browser.h"
28
 
29
#include "framebuffer/gui.h"
30
#include "framebuffer/fbtk.h"
31
 
32
#include "widget.h"
33
 
34
static int
35
fb_redraw_fill(fbtk_widget_t *widget, fbtk_callback_info *cbi)
36
{
37
	nsfb_bbox_t bbox;
38
	nsfb_t *nsfb;
39
 
40
	nsfb = fbtk_get_nsfb(widget);
41
 
42
	fbtk_get_bbox(widget, &bbox);
43
 
44
	nsfb_claim(nsfb, &bbox);
45
 
46
	/* clear background */
47
	if ((widget->bg & 0xFF000000) != 0) {
48
		/* transparent polygon filling isnt working so fake it */
49
		nsfb_plot_rectangle_fill(nsfb, &bbox, widget->bg);
50
	}
51
 
52
	nsfb_update(nsfb, &bbox);
53
 
54
	return 0;
55
}
56
 
57
/* exported function documented in fbtk.h */
58
fbtk_widget_t *
59
fbtk_create_fill(fbtk_widget_t *parent,
60
		 int x,
61
		 int y,
62
		 int width,
63
		 int height,
64
		 colour c)
65
{
66
	fbtk_widget_t *neww;
67
 
68
	neww = fbtk_widget_new(parent, FB_WIDGET_TYPE_FILL, x, y, width, height);
69
	neww->bg = c;
70
	neww->mapped = true;
71
 
72
	fbtk_set_handler(neww, FBTK_CBT_REDRAW, fb_redraw_fill, NULL);
73
 
74
	return neww;
75
}
76
 
77
/*
78
 * Local Variables:
79
 * c-basic-offset:8
80
 * End:
81
 */