From fe151c135d3ffe3dff155d51f4f2680024ae8382 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 22 Apr 2010 23:50:58 +0000 Subject: First steps towards rationalising fbtk, split teh scrollbar widgets out svn path=/trunk/netsurf/; revision=10466 --- framebuffer/fbtk.h | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'framebuffer/fbtk.h') diff --git a/framebuffer/fbtk.h b/framebuffer/fbtk.h index ccc4ac7d3..b201a9d34 100644 --- a/framebuffer/fbtk.h +++ b/framebuffer/fbtk.h @@ -1,3 +1,24 @@ +/* + * Copyright 2008 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NETSURF_FB_FBTK_H +#define NETSURF_FB_FBTK_H + #define FB_SCROLL_COLOUR 0xFFAAAAAA #define FB_FRAME_COLOUR 0xFFDDDDDD @@ -6,6 +27,24 @@ typedef struct fbtk_widget_s fbtk_widget_t; +enum fbtk_callback_info_type { + FBTK_CBIT_NONE, + FBTK_CBIT_SCROLLX, + FBTK_CBIT_SCROLLY, +}; + +typedef struct fbtk_callback_info { + enum fbtk_callback_info_type type; + void *context; + nsfb_event_t *event; + int x; + int y; + char *text; +} fbtk_callback_info; + +typedef int (*fbtk_callback)(fbtk_widget_t *widget, fbtk_callback_info *cbi); + + /* user widget callback */ typedef int (*fbtk_user_t)(fbtk_widget_t *widget, void *pw); @@ -86,7 +125,7 @@ fbtk_create_fill(fbtk_widget_t *window, int x, int y, int width, int height, col * @return new widget handle or NULL on error. */ fbtk_widget_t * -fbtk_create_hscroll(fbtk_widget_t *window, int x, int y, int width, int height, colour fg, colour bg); +fbtk_create_hscroll(fbtk_widget_t *window, int x, int y, int width, int height, colour fg, colour bg, fbtk_callback callback, void *context); /** Create a vertical scroll widget * @@ -96,7 +135,7 @@ fbtk_create_hscroll(fbtk_widget_t *window, int x, int y, int width, int height, * @return new widget handle or NULL on error. */ fbtk_widget_t * -fbtk_create_vscroll(fbtk_widget_t *window, int x, int y, int width, int height, colour fg, colour bg); +fbtk_create_vscroll(fbtk_widget_t *window, int x, int y, int width, int height, colour fg, colour bg, fbtk_callback callback, void *context); /** Create a user widget. * @@ -210,7 +249,7 @@ int fbtk_keycode_to_ucs4(int code, uint8_t mods); /* clip a box to a widgets area */ bool fbtk_clip_to_widget(fbtk_widget_t *widget, bbox_t * restrict box); - +#endif -- cgit v1.2.3