NetSurf
fill.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Vincent Sanders <vince@simtec.co.uk>
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 <http://www.gnu.org/licenses/>.
19 */
20
21#include <stdbool.h>
22#include <stdlib.h>
23
24#include <libnsfb.h>
25#include <libnsfb_plot.h>
26
28
29#include "framebuffer/gui.h"
30#include "framebuffer/fbtk.h"
31
32#include "widget.h"
33
34static int
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 */
60 int x,
61 int y,
62 int width,
63 int height,
64 colour c)
65{
66 fbtk_widget_t *neww;
67
69 neww->bg = c;
70 neww->mapped = true;
71
73
74 return neww;
75}
76
77/*
78 * Local Variables:
79 * c-basic-offset:8
80 * End:
81 */
Browser window creation and manipulation interface.
wimp_w parent
Definition: dialog.c:88
fbtk_widget_t * fbtk_widget_new(fbtk_widget_t *parent, enum fbtk_widgettype_e type, int x, int y, int width, int height)
creates a new widget and insert it into to hierachy.
Definition: fbtk.c:546
fbtk_callback fbtk_set_handler(fbtk_widget_t *widget, fbtk_callback_type cbt, fbtk_callback cb, void *pw)
Set a callback handler.
Definition: fbtk.c:693
@ FBTK_CBT_REDRAW
Definition: fbtk.h:44
bool fbtk_get_bbox(fbtk_widget_t *widget, struct nsfb_bbox_s *bbox)
Get a widget's bounding box in absolute screen co-ordinates.
nsfb_t * fbtk_get_nsfb(fbtk_widget_t *widget)
Retrieve the framebuffer library handle from toolkit widget.
Definition: fbtk.c:802
static int fb_redraw_fill(fbtk_widget_t *widget, fbtk_callback_info *cbi)
Definition: fill.c:35
fbtk_widget_t * fbtk_create_fill(fbtk_widget_t *parent, int x, int y, int width, int height, colour c)
Create a filled rectangle.
Definition: fill.c:59
static nsfb_t * nsfb
Definition: framebuffer.c:45
int width
Definition: gui.c:159
int height
Definition: gui.c:160
widget callback information
Definition: fbtk.h:52
Widget description.
Definition: widget.h:120
bool mapped
The widget is mapped/visible .
Definition: widget.h:130
colour bg
Definition: widget.h:137
uint32_t colour
Colour type: XBGR.
Definition: types.h:35
@ FB_WIDGET_TYPE_FILL
Definition: widget.h:28