NetSurf
window.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Vincent Sanders <vince@simtec.co.uk>
3 *
4 * Framebuffer windowing toolkit window 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
34/** Window redraw callback.
35 *
36 * Called when a window requires redrawing.
37 *
38 * @param widget The widget to be redrawn.
39 * @param cbi The callback parameters.
40 * @return The callback result.
41 */
42static int
44{
45 nsfb_bbox_t bbox;
46 nsfb_t *nsfb;
47
48 if ((widget->bg & 0xFF000000) == 0)
49 return 0;
50
51 nsfb = fbtk_get_nsfb(widget);
52
53 fbtk_get_bbox(widget, &bbox);
54
55 nsfb_claim(nsfb, &bbox);
56
57 nsfb_plot_rectangle_fill(nsfb, &bbox, widget->bg);
58
59 nsfb_update(nsfb, &bbox);
60
61 return 0;
62}
63
64/* exported function documented in fbtk.h */
67 int x,
68 int y,
69 int width,
70 int height,
71 colour bg)
72{
73 fbtk_widget_t *neww;
74
75 if (parent == NULL)
76 return NULL;
77
79
80 neww->bg = bg;
81
83
84 return neww;
85}
86
87/*
88 * Local Variables:
89 * c-basic-offset:8
90 * End:
91 */
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
fbtk_widget_t * fbtk_create_window(fbtk_widget_t *parent, int x, int y, int width, int height, colour bg)
Create a window widget.
Definition: window.c:66
static int fb_redraw_window(fbtk_widget_t *widget, fbtk_callback_info *cbi)
Window redraw callback.
Definition: window.c:43
static nsfb_t * nsfb
Definition: framebuffer.c:45
int width
Definition: gui.c:160
int height
Definition: gui.c:161
widget callback information
Definition: fbtk.h:52
Widget description.
Definition: widget.h:120
colour bg
Definition: widget.h:137
uint32_t colour
Colour type: XBGR.
Definition: types.h:35
@ FB_WIDGET_TYPE_WINDOW
Definition: widget.h:26