NetSurf
user.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Vincent Sanders <vince@simtec.co.uk>
3 *
4 * Framebuffer windowing toolkit user 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 <stdlib.h>
22#include <stdbool.h>
23#include <libnsfb.h>
24
25#include "framebuffer/gui.h"
26#include "framebuffer/fbtk.h"
27
28#include "widget.h"
29
30/* exported function documented in fbtk.h */
31void *
33{
34 if ((widget == NULL) ||
35 (widget->type != FB_WIDGET_TYPE_USER))
36 return NULL;
37
38 return widget->u.user.pw;
39}
40
41/* exported function documented in fbtk.h */
44 int x,
45 int y,
46 int width,
47 int height,
48 void *pw)
49{
50 fbtk_widget_t *neww;
51
53 neww->u.user.pw = pw;
54 neww->mapped = true;
55
56 return neww;
57}
58
59/*
60 * Local Variables:
61 * c-basic-offset:8
62 * End:
63 */
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
int width
Definition: gui.c:160
int height
Definition: gui.c:161
Widget description.
Definition: widget.h:120
enum fbtk_widgettype_e type
The type of the widget.
Definition: widget.h:154
bool mapped
The widget is mapped/visible .
Definition: widget.h:130
void * pw
Definition: widget.h:185
struct fbtk_widget_s::@35::@39 user
union fbtk_widget_s::@35 u
void * fbtk_get_userpw(fbtk_widget_t *widget)
Get the user context from a widget.
Definition: user.c:32
fbtk_widget_t * fbtk_create_user(fbtk_widget_t *parent, int x, int y, int width, int height, void *pw)
Create a user widget.
Definition: user.c:43
@ FB_WIDGET_TYPE_USER
Definition: widget.h:32