19#ifndef NETSURF_FB_FBTK_H
20#define NETSURF_FB_FBTK_H
24#define FB_SCROLL_COLOUR 0xFFAAAAAA
25#define FB_FRAME_COLOUR 0xFFDDDDDD
26#define FB_COLOUR_BLACK 0xFF000000
27#define FB_COLOUR_WHITE 0xFFFFFFFF
29#define FBTK_WIDGET_PADDING 30
fbtk_callback fbtk_set_handler(fbtk_widget_t *widget, fbtk_callback_type cbt, fbtk_callback cb, void *pw)
Set a callback handler.
int fbtk_set_mapping(fbtk_widget_t *widget, bool mapped)
Map a widget and request it is redrawn.
int fbtk_destroy_widget(fbtk_widget_t *widget)
Destroy a widget and all its descendants.
bool fbtk_get_redraw_pending(fbtk_widget_t *widget)
Determine if there are any redraws pending for a widget.
fbtk_callback_type
Widget Callback type.
fbtk_widget_t * fbtk_create_writable_text(fbtk_widget_t *window, int x, int y, int width, int height, colour bg, colour fg, bool outline, fbtk_enter_t enter, void *pw)
Create a writable text widget.
bool fbtk_set_pos_and_size(fbtk_widget_t *widget, int x, int y, int width, int height)
Change the widget's position and size.
fbtk_widget_t * 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 vertical scroll widget.
void * fbtk_get_userpw(fbtk_widget_t *widget)
Get the user context from a widget.
void fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
Move pointer.
void fbtk_request_redraw(fbtk_widget_t *widget)
Indicate a widget should be redrawn.
void fbtk_enable_oskb(fbtk_widget_t *widget)
enable the on screen keyboard for input
fbtk_widget_t * fbtk_get_widget_at(fbtk_widget_t *widget, int x, int y)
Obtain the widget at a point on screen.
int fbtk_get_absx(fbtk_widget_t *widget)
Get a widget's absolute horizontal screen co-ordinate.
fbtk_callback fbtk_get_handler(fbtk_widget_t *widget, fbtk_callback_type cbt)
Get a callback handler.
int fbtk_get_width(fbtk_widget_t *widget)
Get a widget's width.
bool fbtk_tgrab_pointer(fbtk_widget_t *widget)
Toggle pointer grab.
fbtk_modifier_type
Key modifier status.
void fbtk_set_focus(fbtk_widget_t *widget)
Give widget input focus.
fbtk_widget_t * fbtk_create_fill(fbtk_widget_t *window, int x, int y, int width, int height, colour c)
Create a filled rectangle.
fbtk_widget_t * 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 horizontal scroll widget.
int fbtk_set_zorder(fbtk_widget_t *widget, int z)
Set the z order of a widget.
struct fbtk_callback_info fbtk_callback_info
widget callback information
int fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt,...)
Helper function to allow simple calling of callbacks with parameters.
bool fbtk_set_scroll_parameters(fbtk_widget_t *widget, int min, int max, int thumb, int page)
Set scoll widget parameters.
bool fbtk_get_bbox(fbtk_widget_t *widget, struct nsfb_bbox_s *bbox)
Get a widget's bounding box in absolute screen co-ordinates.
void fbtk_reposition_hscroll(fbtk_widget_t *scrollh, int x, int y, int width, int height)
Move and/or resize a horizontal scroll widget.
void fbtk_writable_text(fbtk_widget_t *widget, fbtk_enter_t enter, void *pw)
Alter a text widget to be writable.
fbtk_widget_t * fbtk_create_user(fbtk_widget_t *window, int x, int y, int width, int height, void *pw)
Create a user widget.
bool fbtk_set_scroll_position(fbtk_widget_t *widget, int pos)
set scroll widget position.
bool fbtk_clip_rect(const bbox_t *restrict clip, bbox_t *restrict box)
clip one bounding box to another.
void map_osk(void)
show the osk.
void fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
Insert mouse button press into toolkit.
bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
Retrive events from the framebuffer input.
fbtk_widget_t * fbtk_init(nsfb_t *fb)
Initialise widget toolkit.
fbtk_widget_t * fbtk_create_window(fbtk_widget_t *parent, int x, int y, int width, int height, colour bg)
Create a window widget.
fbtk_widget_t * fbtk_create_text_button(fbtk_widget_t *window, int x, int y, int width, int height, colour bg, colour fg, fbtk_callback click, void *pw)
Create a button with text.
fbtk_widget_t * fbtk_create_text(fbtk_widget_t *window, int x, int y, int width, int height, colour bg, colour fg, bool outline)
Create a text widget.
int fbtk_keycode_to_ucs4(int code, fbtk_modifier_type mods)
Convert a framebuffer keycode to ucs4.
fbtk_widget_t * fbtk_create_bitmap(fbtk_widget_t *window, int x, int y, int width, int height, colour c, struct fbtk_bitmap *image)
Create a bitmap widget.
bool fbtk_clip_to_widget(fbtk_widget_t *widget, bbox_t *restrict box)
clip a bounding box to a widgets area.
int(* fbtk_enter_t)(void *pw, char *text)
void fbtk_set_text(fbtk_widget_t *widget, const char *text)
Change the text of a text widget.
int fbtk_get_absy(fbtk_widget_t *widget)
Get a widget's absolute vertical screen co-ordinate.
void fbtk_set_caret(fbtk_widget_t *widget, bool set, int x, int y, int height, void(*remove_caret)(fbtk_widget_t *widget))
Set caret owner and position.
nsfb_t * fbtk_get_nsfb(fbtk_widget_t *widget)
Retrieve the framebuffer library handle from toolkit widget.
void fbtk_reposition_vscroll(fbtk_widget_t *scrollv, int x, int y, int width, int height)
Move and/or resize a vertical scroll widget.
int fbtk_redraw(fbtk_widget_t *widget)
Perform any pending widget redraws.
fbtk_widget_t * fbtk_create_button(fbtk_widget_t *window, int x, int y, int width, int height, colour c, struct fbtk_bitmap *image, fbtk_callback click, void *pw)
Create a button widget with an image.
int fbtk_get_height(fbtk_widget_t *widget)
Get a widget's height.
void fbtk_input(fbtk_widget_t *widget, nsfb_event_t *event)
Insert input into toolkit.
void fbtk_set_bitmap(fbtk_widget_t *widget, struct fbtk_bitmap *image)
Change the bitmap in a widget.
bool fbtk_get_caret(fbtk_widget_t *widget, int *x, int *y, int *height)
Get a widget caret pos, if it owns caret.
int(* fbtk_callback)(fbtk_widget_t *widget, fbtk_callback_info *cbi)
static struct directory * root
struct nsfb_bbox_s bbox_t
framebuffer toolkit bitmaps
widget callback information
enum fbtk_callback_type type
uint32_t colour
Colour type: XBGR.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.