NetSurf
Data Structures | Macros | Typedefs | Enumerations | Functions
fbtk.h File Reference
#include "netsurf/types.h"
Include dependency graph for fbtk.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fbtk_callback_info
 widget callback information More...
 
struct  fbtk_bitmap
 framebuffer toolkit bitmaps
More...
 

Macros

#define FB_SCROLL_COLOUR   0xFFAAAAAA
 
#define FB_FRAME_COLOUR   0xFFDDDDDD
 
#define FB_COLOUR_BLACK   0xFF000000
 
#define FB_COLOUR_WHITE   0xFFFFFFFF
 
#define FBTK_WIDGET_PADDING   30
 percentage of widget size used for padding More...
 
#define FBTK_DPI   90
 screen DPI More...
 

Typedefs

typedef struct fbtk_widget_s fbtk_widget_t
 
typedef enum fbtk_callback_type fbtk_callback_type
 Widget Callback type. More...
 
typedef struct fbtk_callback_info fbtk_callback_info
 widget callback information More...
 
typedef enum fbtk_modifier_type fbtk_modifier_type
 Key modifier status. More...
 
typedef int(* fbtk_callback) (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
typedef int(* fbtk_enter_t) (void *pw, char *text)
 

Enumerations

enum  fbtk_callback_type {
  FBTK_CBT_START = 0 , FBTK_CBT_SCROLLX , FBTK_CBT_SCROLLY , FBTK_CBT_CLICK ,
  FBTK_CBT_INPUT , FBTK_CBT_POINTERMOVE , FBTK_CBT_POINTERLEAVE , FBTK_CBT_POINTERENTER ,
  FBTK_CBT_REDRAW , FBTK_CBT_DESTROY , FBTK_CBT_USER , FBTK_CBT_STRIP_FOCUS ,
  FBTK_CBT_END
}
 Widget Callback type. More...
 
enum  fbtk_modifier_type {
  FBTK_MOD_CLEAR = 0 , FBTK_MOD_LSHIFT = (1 << 0) , FBTK_MOD_RSHIFT = (1 << 1) , FBTK_MOD_LCTRL = (1 << 2) ,
  FBTK_MOD_RCTRL = (1 << 3)
}
 Key modifier status. More...
 

Functions

fbtk_widget_tfbtk_init (nsfb_t *fb)
 Initialise widget toolkit. More...
 
nsfb_t * fbtk_get_nsfb (fbtk_widget_t *widget)
 Retrieve the framebuffer library handle from toolkit widget. More...
 
int fbtk_redraw (fbtk_widget_t *widget)
 Perform any pending widget redraws. More...
 
bool fbtk_get_redraw_pending (fbtk_widget_t *widget)
 Determine if there are any redraws pending for a widget. More...
 
bool fbtk_clip_to_widget (fbtk_widget_t *widget, bbox_t *restrict box)
 clip a bounding box to a widgets area. More...
 
bool fbtk_clip_rect (const bbox_t *restrict clip, bbox_t *restrict box)
 clip one bounding box to another. More...
 
int fbtk_post_callback (fbtk_widget_t *widget, fbtk_callback_type cbt,...)
 Helper function to allow simple calling of callbacks with parameters. More...
 
fbtk_callback fbtk_set_handler (fbtk_widget_t *widget, fbtk_callback_type cbt, fbtk_callback cb, void *pw)
 Set a callback handler. More...
 
fbtk_callback fbtk_get_handler (fbtk_widget_t *widget, fbtk_callback_type cbt)
 Get a callback handler. More...
 
bool fbtk_event (fbtk_widget_t *root, nsfb_event_t *event, int timeout)
 Retrive events from the framebuffer input. More...
 
void fbtk_click (fbtk_widget_t *widget, nsfb_event_t *event)
 Insert mouse button press into toolkit. More...
 
void fbtk_input (fbtk_widget_t *widget, nsfb_event_t *event)
 Insert input into toolkit. More...
 
void fbtk_warp_pointer (fbtk_widget_t *widget, int x, int y, bool relative)
 Move pointer. More...
 
bool fbtk_tgrab_pointer (fbtk_widget_t *widget)
 Toggle pointer grab. More...
 
int fbtk_keycode_to_ucs4 (int code, fbtk_modifier_type mods)
 Convert a framebuffer keycode to ucs4. More...
 
fbtk_widget_tfbtk_get_widget_at (fbtk_widget_t *widget, int x, int y)
 Obtain the widget at a point on screen. More...
 
int fbtk_get_absx (fbtk_widget_t *widget)
 Get a widget's absolute horizontal screen co-ordinate. More...
 
int fbtk_get_absy (fbtk_widget_t *widget)
 Get a widget's absolute vertical screen co-ordinate. More...
 
int fbtk_get_width (fbtk_widget_t *widget)
 Get a widget's width. More...
 
int fbtk_get_height (fbtk_widget_t *widget)
 Get a widget's height. More...
 
bool fbtk_get_bbox (fbtk_widget_t *widget, struct nsfb_bbox_s *bbox)
 Get a widget's bounding box in absolute screen co-ordinates. More...
 
bool fbtk_get_caret (fbtk_widget_t *widget, int *x, int *y, int *height)
 Get a widget caret pos, if it owns caret. More...
 
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. More...
 
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. More...
 
int fbtk_set_mapping (fbtk_widget_t *widget, bool mapped)
 Map a widget and request it is redrawn. More...
 
int fbtk_set_zorder (fbtk_widget_t *widget, int z)
 Set the z order of a widget. More...
 
void fbtk_request_redraw (fbtk_widget_t *widget)
 Indicate a widget should be redrawn. More...
 
int fbtk_destroy_widget (fbtk_widget_t *widget)
 Destroy a widget and all its descendants. More...
 
fbtk_widget_tfbtk_create_window (fbtk_widget_t *parent, int x, int y, int width, int height, colour bg)
 Create a window widget. More...
 
fbtk_widget_tfbtk_create_fill (fbtk_widget_t *window, int x, int y, int width, int height, colour c)
 Create a filled rectangle. More...
 
fbtk_widget_tfbtk_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. More...
 
fbtk_widget_tfbtk_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. More...
 
bool fbtk_set_scroll_parameters (fbtk_widget_t *widget, int min, int max, int thumb, int page)
 Set scoll widget parameters. More...
 
bool fbtk_set_scroll_position (fbtk_widget_t *widget, int pos)
 set scroll widget position. More...
 
void fbtk_reposition_hscroll (fbtk_widget_t *scrollh, int x, int y, int width, int height)
 Move and/or resize a horizontal scroll widget. More...
 
void fbtk_reposition_vscroll (fbtk_widget_t *scrollv, int x, int y, int width, int height)
 Move and/or resize a vertical scroll widget. More...
 
fbtk_widget_tfbtk_create_user (fbtk_widget_t *window, int x, int y, int width, int height, void *pw)
 Create a user widget. More...
 
void * fbtk_get_userpw (fbtk_widget_t *widget)
 Get the user context from a widget. More...
 
fbtk_widget_tfbtk_create_bitmap (fbtk_widget_t *window, int x, int y, int width, int height, colour c, struct fbtk_bitmap *image)
 Create a bitmap widget. More...
 
void fbtk_set_bitmap (fbtk_widget_t *widget, struct fbtk_bitmap *image)
 Change the bitmap in a widget. More...
 
fbtk_widget_tfbtk_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. More...
 
fbtk_widget_tfbtk_create_text (fbtk_widget_t *window, int x, int y, int width, int height, colour bg, colour fg, bool outline)
 Create a text widget. More...
 
fbtk_widget_tfbtk_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. More...
 
fbtk_widget_tfbtk_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. More...
 
void fbtk_writable_text (fbtk_widget_t *widget, fbtk_enter_t enter, void *pw)
 Alter a text widget to be writable. More...
 
void fbtk_set_text (fbtk_widget_t *widget, const char *text)
 Change the text of a text widget. More...
 
void fbtk_set_focus (fbtk_widget_t *widget)
 Give widget input focus. More...
 
void fbtk_enable_oskb (fbtk_widget_t *widget)
 enable the on screen keyboard for input More...
 
void map_osk (void)
 show the osk. More...
 

Macro Definition Documentation

◆ FB_COLOUR_BLACK

#define FB_COLOUR_BLACK   0xFF000000

Definition at line 26 of file fbtk.h.

◆ FB_COLOUR_WHITE

#define FB_COLOUR_WHITE   0xFFFFFFFF

Definition at line 27 of file fbtk.h.

◆ FB_FRAME_COLOUR

#define FB_FRAME_COLOUR   0xFFDDDDDD

Definition at line 25 of file fbtk.h.

◆ FB_SCROLL_COLOUR

#define FB_SCROLL_COLOUR   0xFFAAAAAA

Definition at line 24 of file fbtk.h.

◆ FBTK_DPI

#define FBTK_DPI   90

screen DPI

Definition at line 30 of file fbtk.h.

◆ FBTK_WIDGET_PADDING

#define FBTK_WIDGET_PADDING   30

percentage of widget size used for padding

Definition at line 29 of file fbtk.h.

Typedef Documentation

◆ fbtk_callback

typedef int(* fbtk_callback) (fbtk_widget_t *widget, fbtk_callback_info *cbi)

Definition at line 83 of file fbtk.h.

◆ fbtk_callback_info

widget callback information

◆ fbtk_callback_type

Widget Callback type.

◆ fbtk_enter_t

typedef int(* fbtk_enter_t) (void *pw, char *text)

Definition at line 86 of file fbtk.h.

◆ fbtk_modifier_type

Key modifier status.

◆ fbtk_widget_t

typedef struct fbtk_widget_s fbtk_widget_t

Definition at line 32 of file fbtk.h.

Enumeration Type Documentation

◆ fbtk_callback_type

Widget Callback type.

Enumerator
FBTK_CBT_START 
FBTK_CBT_SCROLLX 
FBTK_CBT_SCROLLY 
FBTK_CBT_CLICK 
FBTK_CBT_INPUT 
FBTK_CBT_POINTERMOVE 
FBTK_CBT_POINTERLEAVE 
FBTK_CBT_POINTERENTER 
FBTK_CBT_REDRAW 
FBTK_CBT_DESTROY 
FBTK_CBT_USER 
FBTK_CBT_STRIP_FOCUS 
FBTK_CBT_END 

Definition at line 35 of file fbtk.h.

◆ fbtk_modifier_type

Key modifier status.

Enumerator
FBTK_MOD_CLEAR 
FBTK_MOD_LSHIFT 
FBTK_MOD_RSHIFT 
FBTK_MOD_LCTRL 
FBTK_MOD_RCTRL 

Definition at line 75 of file fbtk.h.

Function Documentation

◆ fbtk_click()

void fbtk_click ( fbtk_widget_t widget,
nsfb_event_t *  event 
)

Insert mouse button press into toolkit.

Definition at line 63 of file event.c.

References FBTK_CBT_CLICK, FBTK_CBT_INPUT, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_handler(), fbtk_get_root_widget(), fbtk_get_widget_at(), fbtk_post_callback(), fbtk_set_focus(), NSLOG, and root.

Referenced by fbtk_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_clip_rect()

bool fbtk_clip_rect ( const bbox_t *restrict  clip,
bbox_t *restrict  box 
)

clip one bounding box to another.

Definition at line 336 of file fbtk.c.

References clip(), REGION, and SWAP.

Referenced by fbtk_clip_to_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_clip_to_widget()

bool fbtk_clip_to_widget ( fbtk_widget_t widget,
bbox_t *restrict  box 
)

clip a bounding box to a widgets area.

Definition at line 379 of file fbtk.c.

References fbtk_clip_rect(), fbtk_widget_s::height, and fbtk_widget_s::width.

Referenced by fb_queue_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_bitmap()

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.

Create a widget which shows a bitmap.

Parameters
windowThe window to add the bitmap widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
cbackground colour
imageThe bitmap to put in the widget
Returns
new widget handle or NULL on error.

Definition at line 84 of file bitmap.c.

References fbtk_widget_s::bg, fbtk_widget_s::bitmap, fb_redraw_bitmap(), FB_WIDGET_TYPE_BITMAP, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_widget_new(), height, fbtk_widget_s::mapped, parent, fbtk_widget_s::u, and width.

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_button()

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.

Helper function which creates a bitmap widget and associate a handler for when it is clicked.

Parameters
windowThe window to add the button widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
cbackground colour
imageThe bitmap to put in the widget
clickThe callback upon a click
pwThe context tp pass to the callback
Returns
new widget handle or NULL on error.

Definition at line 107 of file bitmap.c.

References fbtk_widget_s::bg, fbtk_widget_s::bitmap, fb_redraw_bitmap(), FB_WIDGET_TYPE_BITMAP, FBTK_CBT_CLICK, FBTK_CBT_POINTERENTER, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_set_ptr(), fbtk_widget_new(), hand_image, height, fbtk_widget_s::mapped, parent, fbtk_widget_s::u, and width.

Referenced by create_normal_browser_window(), create_toolbar(), fbtk_create_hscroll(), fbtk_create_vscroll(), and fbtk_enable_oskb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_fill()

fbtk_widget_t * fbtk_create_fill ( fbtk_widget_t window,
int  x,
int  y,
int  width,
int  height,
colour  c 
)

Create a filled rectangle.

Create a widget which is a filled rectangle, usually used for backgrounds.

Parameters
windowThe window to add the filled area widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
cwidget colour
Returns
new widget handle or NULL on error.

Definition at line 59 of file fill.c.

References fbtk_widget_s::bg, fb_redraw_fill(), FB_WIDGET_TYPE_FILL, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_widget_new(), height, fbtk_widget_s::mapped, parent, and width.

Referenced by create_normal_browser_window(), and fb_corewindow_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_hscroll()

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.

Create a horizontal scroll widget.

Parameters
windowThe window to add the filled area widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
bgbackground colour
fgforeground colour
callbackCalled on scroll
contextcontext passed to callback.
Returns
new widget handle or NULL on error.

Definition at line 463 of file scroll.c.

References fbtk_widget_s::bg, fbtk_widget_s::btndr, fbtk_widget_s::btnul, FB_WIDGET_TYPE_HSCROLL, FBTK_CBT_CLICK, FBTK_CBT_REDRAW, FBTK_CBT_SCROLLX, fbtk_create_button(), fbtk_set_handler(), fbtk_widget_new(), fbtk_widget_s::fg, height, hscroll_redraw(), hscrollarea_click(), hscrolll_click(), hscrollr_click(), fbtk_widget_s::mapped, parent, fbtk_widget_s::scroll, scrolll, scrollr, fbtk_widget_s::u, fbtk_bitmap::width, and width.

Referenced by create_normal_browser_window(), and fb_corewindow_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_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.

Parameters
windowThe window to add the text widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
bgbackground colour
fgforeground colour
outlinewidget will have a border.
Returns
new widget handle or NULL on error.

Definition at line 581 of file text.c.

References fbtk_widget_s::bg, fb_destroy_text(), fb_redraw_text(), FB_WIDGET_TYPE_TEXT, FBTK_CBT_DESTROY, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_widget_new(), fbtk_widget_s::fg, height, fbtk_widget_s::mapped, parent, fbtk_widget_s::text, fbtk_widget_s::u, and width.

Referenced by create_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_text_button()

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.

Parameters
windowThe window to add the text widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
bgbackground colour
fgforeground colour
clickThe callback upon a click
pwThe context tp pass to the callback
Returns
new widget handle or NULL on error.

Definition at line 639 of file text.c.

References fbtk_widget_s::bg, fb_destroy_text(), fb_redraw_text_button(), FB_WIDGET_TYPE_TEXT, FBTK_CBT_CLICK, FBTK_CBT_DESTROY, FBTK_CBT_POINTERENTER, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_set_ptr(), fbtk_widget_new(), fbtk_widget_s::fg, hand_image, height, fbtk_widget_s::mapped, parent, fbtk_widget_s::text, fbtk_widget_s::u, and width.

Referenced by create_normal_browser_window(), and fbtk_enable_oskb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_user()

fbtk_widget_t * fbtk_create_user ( fbtk_widget_t window,
int  x,
int  y,
int  width,
int  height,
void *  pw 
)

Create a user widget.

Create a widget which is to be handled entirely by the calling application.

Parameters
windowThe window to add the user widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
pwThe private pointer which can be read using fbtk_get_userpw
Returns
new widget handle or NULL on error.

Definition at line 43 of file user.c.

References FB_WIDGET_TYPE_USER, fbtk_widget_new(), height, fbtk_widget_s::mapped, parent, fbtk_widget_s::pw, fbtk_widget_s::u, fbtk_widget_s::user, and width.

Referenced by create_browser_widget(), and fb_corewindow_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_vscroll()

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.

Create a vertical scroll widget.

Parameters
windowThe window to add the filled area widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
bgbackground colour
fgforeground colour
callbackCalled on scroll
contextcontext passed to callback.
Returns
new widget handle or NULL on error.

Definition at line 224 of file scroll.c.

References fbtk_widget_s::bg, fbtk_widget_s::btndr, fbtk_widget_s::btnul, FB_WIDGET_TYPE_VSCROLL, FBTK_CBT_CLICK, FBTK_CBT_REDRAW, FBTK_CBT_SCROLLY, fbtk_create_button(), fbtk_set_handler(), fbtk_widget_new(), fbtk_widget_s::fg, fbtk_bitmap::height, height, fbtk_widget_s::mapped, parent, fbtk_widget_s::scroll, scrolld, scrollu, fbtk_widget_s::u, vscroll_redraw(), vscrollarea_click(), vscrolld_click(), vscrollu_click(), and width.

Referenced by create_normal_browser_window(), and fb_corewindow_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_window()

fbtk_widget_t * fbtk_create_window ( fbtk_widget_t parent,
int  x,
int  y,
int  width,
int  height,
colour  bg 
)

Create a window widget.

Parameters
parentThe parent window or the root widget for a top level window.
xThe x location relative to the parent window.
ythe y location relative to the parent window.
widthThe width of the window. 0 indicates parents width should be used. Negative value indicates parents width less the value should be used. The width is limited to lie within the parent window.
heightThe height of the window limited in a similar way to the /a width.
bgThe background colour.
Returns
new window widget handle or NULL on error.

Definition at line 66 of file window.c.

References fbtk_widget_s::bg, fb_redraw_window(), FB_WIDGET_TYPE_WINDOW, FBTK_CBT_REDRAW, fbtk_set_handler(), fbtk_widget_new(), height, parent, and width.

Referenced by create_normal_browser_window(), create_toolbar(), fb_corewindow_init(), and fbtk_enable_oskb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_create_writable_text()

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.

Helper function which creates a text widget and configures an input handler to create a writable text field. This call is equivalent to calling fbtk_create_text followed by fbtk_writable_text

Parameters
windowThe window to add the text widget to.
xX coordinate of widget.
yY coordinate of widget.
widthWidth of the widget
heightHeight of the widget
bgbackground colour
fgforeground colour
outlinewidget will have a border.
enterCallback when enter is pressed in widget.
pwContext pointer passed to entry callback.
Returns
new widget handle or NULL on error.

Definition at line 606 of file text.c.

References fbtk_widget_s::bg, fb_destroy_text(), fb_redraw_text(), FB_WIDGET_TYPE_TEXT, FBTK_CBT_CLICK, FBTK_CBT_DESTROY, FBTK_CBT_INPUT, FBTK_CBT_REDRAW, FBTK_CBT_STRIP_FOCUS, fbtk_set_handler(), fbtk_widget_new(), fbtk_widget_s::fg, height, fbtk_widget_s::mapped, parent, fbtk_widget_s::text, text_input(), text_input_click(), text_input_strip_focus(), fbtk_widget_s::u, and width.

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_destroy_widget()

int fbtk_destroy_widget ( fbtk_widget_t widget)

Destroy a widget and all its descendants.

Removes a widget from the hierachy and frees it and all its children.

Parameters
widgetThe widget to destroy.
Returns
0 on success or -1 on error.

Definition at line 282 of file fbtk.c.

References FBTK_CBT_DESTROY, fbtk_destroy_widget(), fbtk_post_callback(), fbtk_widget_s::first_child, fbtk_widget_s::next, fbtk_widget_s::parent, parent, and fbtk_widget_s::prev.

Referenced by fbtk_destroy_widget(), and gui_window_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_enable_oskb()

void fbtk_enable_oskb ( fbtk_widget_t widget)

enable the on screen keyboard for input

Parameters
widgetWidget to be given input focus.

Definition at line 138 of file osk.c.

References FB_COLOUR_BLACK, FB_FRAME_COLOUR, fbtk, fbtk_create_button(), fbtk_create_text_button(), fbtk_create_window(), fbtk_get_height(), fbtk_get_root_widget(), fbtk_get_width(), fbtk_set_text(), kbd_button_s::h, kbdbase, KEYCOUNT, osk, osk_click(), osk_close(), osk_image, root, kbd_button_s::t, kbd_button_s::w, kbd_button_s::x, and kbd_button_s::y.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_event()

bool fbtk_event ( fbtk_widget_t root,
nsfb_event_t *  event,
int  timeout 
)

Retrive events from the framebuffer input.

Obtain events from the framebuffer input system with a timeout. Some events may be used by the toolkit instead of being returned to the caller.

Parameters
rootAn fbtk widget.
eventan event structure to update.
timeoutThe number of miliseconds to wait for an event. 0 means do not wait and -1 means wait foreevr.
Returns
wether event has been updated.

Definition at line 188 of file event.c.

References fbtk_click(), fbtk_get_root_widget(), fbtk_input(), fbtk_warp_pointer(), gui_resize(), and root.

Referenced by framebuffer_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_get_absx()

int fbtk_get_absx ( fbtk_widget_t widget)

Get a widget's absolute horizontal screen co-ordinate.

Parameters
widgetThe widget to inspect.
Returns
The absolute screen co-ordinate.

Definition at line 430 of file fbtk.c.

References fbtk_widget_s::parent, and fbtk_widget_s::x.

Referenced by create_normal_browser_window(), do_redraw(), fb_cw_draw_event(), fb_pan(), fb_redraw(), fbtk_click(), and fbtk_warp_pointer().

Here is the caller graph for this function:

◆ fbtk_get_absy()

int fbtk_get_absy ( fbtk_widget_t widget)

Get a widget's absolute vertical screen co-ordinate.

Parameters
widgetThe widget to inspect.
Returns
The absolute screen co-ordinate.

Definition at line 445 of file fbtk.c.

References fbtk_widget_s::parent, and fbtk_widget_s::y.

Referenced by create_normal_browser_window(), do_redraw(), fb_cw_draw_event(), fb_pan(), fb_redraw(), fbtk_click(), and fbtk_warp_pointer().

Here is the caller graph for this function:

◆ fbtk_get_bbox()

bool fbtk_get_bbox ( fbtk_widget_t widget,
struct nsfb_bbox_s *  bbox 
)

Get a widget's bounding box in absolute screen co-ordinates.

Parameters
widgetThe widget to inspect.
bboxThe bounding box structure to update.
Returns
If the bbox parameter has been updated.

Referenced by fb_redraw_bitmap(), fb_redraw_fill(), fb_redraw_text(), fb_redraw_text_button(), fb_redraw_window(), hscroll_redraw(), and vscroll_redraw().

Here is the caller graph for this function:

◆ fbtk_get_caret()

bool fbtk_get_caret ( fbtk_widget_t widget,
int *  x,
int *  y,
int *  height 
)

Get a widget caret pos, if it owns caret.

Parameters
widgetThe widget to inspect.
xIf widget has caret, returns x-coord of caret within widget
yIf widget has caret, returns y-coord of caret within widget
heightIf widget has caret, returns caret height
Returns
true iff widget has caret

Definition at line 494 of file fbtk.c.

References fbtk_get_root_widget(), height, and root.

Referenced by fb_redraw(), fb_redraw_text(), fb_text_input_remove_caret_cb(), fbtk_set_text(), gui_window_remove_caret(), and gui_window_remove_caret_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_get_handler()

fbtk_callback fbtk_get_handler ( fbtk_widget_t widget,
fbtk_callback_type  cbt 
)

Get a callback handler.

Definition at line 681 of file fbtk.c.

References fbtk_widget_s::callback, FBTK_CBT_END, and FBTK_CBT_START.

Referenced by fbtk_click().

Here is the caller graph for this function:

◆ fbtk_get_height()

int fbtk_get_height ( fbtk_widget_t widget)

Get a widget's height.

Parameters
widgetThe widget to inspect.
Returns
The widget height.

Definition at line 460 of file fbtk.c.

References fbtk_widget_s::height.

Referenced by create_normal_browser_window(), fb_browser_window_input(), fb_browser_window_redraw(), fb_corewindow_init(), fb_cw_draw_event(), fb_cw_get_window_dimensions(), fb_local_history_present(), fb_pan(), fb_window_invalidate_area(), fbtk_enable_oskb(), gui_window_get_dimensions(), gui_window_update_extent(), resize_normal_browser_window(), and widget_scroll_y().

Here is the caller graph for this function:

◆ fbtk_get_nsfb()

nsfb_t * fbtk_get_nsfb ( fbtk_widget_t widget)

Retrieve the framebuffer library handle from toolkit widget.

Parameters
widgetA fbtk widget.
Returns
The underlying framebuffer.

Definition at line 802 of file fbtk.c.

References fbtk_get_root_widget(), and root.

Referenced by fb_cw_draw_event(), fb_pan(), fb_redraw(), fb_redraw_bitmap(), fb_redraw_fill(), fb_redraw_text(), fb_redraw_window(), and gui_resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_get_redraw_pending()

bool fbtk_get_redraw_pending ( fbtk_widget_t widget)

Determine if there are any redraws pending for a widget.

Mainly used by clients on the root widget to determine if they need to call fbtk_redraw

Parameters
widgetto check.

Definition at line 611 of file fbtk.c.

References fbtk_get_root_widget(), and root.

Referenced by framebuffer_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_get_userpw()

void * fbtk_get_userpw ( fbtk_widget_t widget)

Get the user context from a widget.

Parameters
widgetThe widget to get the context from.
Returns
The context or NULL.

Definition at line 32 of file user.c.

References FB_WIDGET_TYPE_USER, fbtk_widget_s::pw, fbtk_widget_s::type, fbtk_widget_s::u, and fbtk_widget_s::user.

Referenced by fb_browser_window_click(), fb_browser_window_destroy(), fb_browser_window_move(), fb_browser_window_redraw(), fb_queue_redraw(), fb_window_invalidate_area(), gui_window_get_scroll(), gui_window_place_caret(), gui_window_remove_caret_cb(), gui_window_set_scroll(), widget_scroll_x(), and widget_scroll_y().

Here is the caller graph for this function:

◆ fbtk_get_widget_at()

fbtk_widget_t * fbtk_get_widget_at ( fbtk_widget_t widget,
int  x,
int  y 
)

Obtain the widget at a point on screen.

Parameters
widgetany tookit widget.
xlocation in horizontal plane.
ylocation in vertical plane.
Returns
widget or NULL.

Definition at line 516 of file fbtk.c.

References fbtk_get_root_widget(), fbtk_widget_s::first_child, fbtk_widget_s::height, fbtk_widget_s::mapped, fbtk_widget_s::next, fbtk_widget_s::width, fbtk_widget_s::x, and fbtk_widget_s::y.

Referenced by fbtk_click(), and fbtk_warp_pointer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_get_width()

int fbtk_get_width ( fbtk_widget_t widget)

Get a widget's width.

Parameters
widgetThe widget to inspect.
Returns
The widget width.

Definition at line 467 of file fbtk.c.

References fbtk_widget_s::width.

Referenced by create_normal_browser_window(), create_toolbar(), fb_browser_window_input(), fb_browser_window_redraw(), fb_corewindow_init(), fb_cw_draw_event(), fb_cw_get_window_dimensions(), fb_local_history_present(), fb_pan(), fb_window_invalidate_area(), fbtk_enable_oskb(), gui_window_get_dimensions(), gui_window_update_extent(), resize_normal_browser_window(), resize_toolbar(), and widget_scroll_x().

Here is the caller graph for this function:

◆ fbtk_init()

fbtk_widget_t * fbtk_init ( nsfb_t *  fb)

Initialise widget toolkit.

Initialises widget toolkit against a framebuffer.

Parameters
fbThe underlying framebuffer.
Returns
The root widget handle.

Definition at line 814 of file fbtk.c.

References FB_WIDGET_TYPE_ROOT, and root.

Referenced by main().

Here is the caller graph for this function:

◆ fbtk_input()

void fbtk_input ( fbtk_widget_t widget,
nsfb_event_t *  event 
)

Insert input into toolkit.

Definition at line 45 of file event.c.

References FBTK_CBT_INPUT, fbtk_get_root_widget(), fbtk_post_callback(), NSLOG, and root.

Referenced by fbtk_event(), and osk_click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_keycode_to_ucs4()

int fbtk_keycode_to_ucs4 ( int  code,
fbtk_modifier_type  mods 
)

Convert a framebuffer keycode to ucs4.

Character mapping between keycode with modifier state and ucs-4.

Definition at line 301 of file event.c.

References FBTK_MOD_CLEAR, FBTK_MOD_LCTRL, FBTK_MOD_LSHIFT, FBTK_MOD_RCTRL, FBTK_MOD_RSHIFT, keymap, NOF_ELEMENTS, NS_KEY_CLEAR_SELECTION, NS_KEY_COPY_SELECTION, NS_KEY_CUT_SELECTION, NS_KEY_DELETE_LINE, NS_KEY_PASTE, NS_KEY_SELECT_ALL, and sh_keymap.

Referenced by fb_browser_window_input(), and text_input().

Here is the caller graph for this function:

◆ fbtk_post_callback()

int fbtk_post_callback ( fbtk_widget_t widget,
fbtk_callback_type  cbt,
  ... 
)

Helper function to allow simple calling of callbacks with parameters.

Parameters
widgetThe fbtk widget to post the callback to.
cbtThe type of callback to post
...Parameters appropriate for the callback type.

Definition at line 715 of file fbtk.c.

References fbtk_widget_s::callback, fbtk_widget_s::callback_context, fbtk_callback_info::context, fbtk_callback_info::event, FBTK_CBT_CLICK, FBTK_CBT_INPUT, FBTK_CBT_POINTERMOVE, FBTK_CBT_REDRAW, FBTK_CBT_SCROLLX, FBTK_CBT_SCROLLY, FBTK_CBT_STRIP_FOCUS, FBTK_CBT_USER, fbtk_widget_s::mapped, fbtk_callback_info::type, fbtk_callback_info::x, and fbtk_callback_info::y.

Referenced by do_redraw(), fbtk_click(), fbtk_destroy_widget(), fbtk_input(), fbtk_set_focus(), fbtk_warp_pointer(), hscroll_drag(), hscrollarea_click(), hscrolll_click(), hscrollr_click(), vscroll_drag(), vscrollarea_click(), vscrolld_click(), and vscrollu_click().

Here is the caller graph for this function:

◆ fbtk_redraw()

int fbtk_redraw ( fbtk_widget_t widget)

Perform any pending widget redraws.

Parameters
widgetA fbtk widget.

Definition at line 669 of file fbtk.c.

References do_redraw(), fbtk_get_root_widget(), and root.

Referenced by framebuffer_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_reposition_hscroll()

void fbtk_reposition_hscroll ( fbtk_widget_t scrollh,
int  x,
int  y,
int  width,
int  height 
)

Move and/or resize a horizontal scroll widget.

Parameters
scrollhthe horizontal scroll widget
xnew x pos
ynew y pos
widthnew width
heightnew height

Definition at line 515 of file scroll.c.

References fbtk_widget_s::btndr, fbtk_widget_s::btnul, FB_WIDGET_TYPE_HSCROLL, fbtk_set_pos_and_size(), height, fbtk_widget_s::scroll, scrolll, scrollr, fbtk_widget_s::type, fbtk_widget_s::u, fbtk_bitmap::width, and width.

Referenced by resize_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_reposition_vscroll()

void fbtk_reposition_vscroll ( fbtk_widget_t scrollv,
int  x,
int  y,
int  width,
int  height 
)

Move and/or resize a vertical scroll widget.

Parameters
scrollvthe vertical scroll widget
xnew x pos
ynew y pos
widthnew width
heightnew height

Definition at line 280 of file scroll.c.

References fbtk_widget_s::btndr, fbtk_widget_s::btnul, FB_WIDGET_TYPE_VSCROLL, fbtk_set_pos_and_size(), fbtk_bitmap::height, height, fbtk_widget_s::scroll, scrolld, scrollu, fbtk_widget_s::type, fbtk_widget_s::u, and width.

Referenced by resize_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_request_redraw()

void fbtk_request_redraw ( fbtk_widget_t widget)

Indicate a widget should be redrawn.

Definition at line 82 of file fbtk.c.

References fbtk_widget_s::child, fbtk, fbtk_request_redraw(), fbtk_widget_s::height, fbtk_widget_s::last_child, fbtk_widget_s::mapped, fbtk_widget_s::needed, NSLOG, fbtk_widget_s::parent, fbtk_widget_s::prev, fbtk_widget_s::redraw, fbtk_widget_s::width, fbtk_widget_s::x, and fbtk_widget_s::y.

Referenced by fb_queue_redraw(), fb_text_input_remove_caret_cb(), fbtk_request_redraw(), fbtk_set_bitmap(), fbtk_set_mapping(), fbtk_set_scroll_parameters(), fbtk_set_scroll_position(), fbtk_set_text(), gui_resize(), text_input(), text_input_click(), widget_scroll_x(), and widget_scroll_y().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_bitmap()

void fbtk_set_bitmap ( fbtk_widget_t widget,
struct fbtk_bitmap image 
)

Change the bitmap in a widget.

Parameters
widgetThe widget to get the context from.
imageThe bitmap to put in the widget

Definition at line 72 of file bitmap.c.

References fbtk_widget_s::bitmap, FB_WIDGET_TYPE_BITMAP, fbtk_request_redraw(), fbtk_widget_s::type, and fbtk_widget_s::u.

Referenced by fb_update_back_forward(), gui_window_stop_throbber(), and throbber_advance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_caret()

void fbtk_set_caret ( fbtk_widget_t widget,
bool  set,
int  x,
int  y,
int  height,
void(*)(fbtk_widget_t *widget)  remove_caret 
)

Set caret owner and position.

Parameters
widgetwidget to give caret to, or ensure caret is released from
settrue: caret to be set for widget, false: caret to be released
xx-coordinate of caret top
yy-coordinate of caret top
heightheight of caret
remove_caretcallback when caret is removed.

Definition at line 252 of file fbtk.c.

References fbtk_get_root_widget(), height, and root.

Referenced by fb_browser_window_strip_focus(), fbtk_set_text(), gui_window_place_caret(), gui_window_remove_caret(), text_input(), text_input_click(), and text_input_strip_focus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_focus()

void fbtk_set_focus ( fbtk_widget_t widget)

Give widget input focus.

Parameters
widgetWidget to be given input focus.

Definition at line 781 of file fbtk.c.

References FBTK_CBT_STRIP_FOCUS, fbtk_get_root_widget(), fbtk_post_callback(), and root.

Referenced by create_normal_browser_window(), and fbtk_click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_handler()

fbtk_callback fbtk_set_handler ( fbtk_widget_t widget,
fbtk_callback_type  cbt,
fbtk_callback  cb,
void *  pw 
)

Set a callback handler.

Set a callback handler and the pointer to pass for a widget.

Parameters
widgetThe widget to set the handler for.
cbtThe type of callback to set.
cbThe callback.
pwThe private pointer to pass when calling the callback.
Returns
The previous callback handler for the type or NULL.

Definition at line 693 of file fbtk.c.

References fbtk_widget_s::callback, fbtk_widget_s::callback_context, FBTK_CBT_END, and FBTK_CBT_START.

Referenced by create_browser_widget(), create_normal_browser_window(), create_toolbar(), fb_corewindow_init(), fbtk_create_bitmap(), fbtk_create_button(), fbtk_create_fill(), fbtk_create_hscroll(), fbtk_create_text(), fbtk_create_text_button(), fbtk_create_vscroll(), fbtk_create_window(), fbtk_create_writable_text(), fbtk_writable_text(), hscrollarea_click(), and vscrollarea_click().

Here is the caller graph for this function:

◆ fbtk_set_mapping()

int fbtk_set_mapping ( fbtk_widget_t widget,
bool  mapped 
)

Map a widget and request it is redrawn.

Definition at line 127 of file fbtk.c.

References fbtk_request_redraw(), fbtk_widget_s::mapped, NSLOG, and fbtk_widget_s::parent.

Referenced by create_toolbar(), fb_local_history_hide(), fb_local_history_mouse(), fb_local_history_present(), gui_window_create(), map_osk(), and osk_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_pos_and_size()

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.

(Doesn't redraw)

Definition at line 209 of file fbtk.c.

References fbtk_widget_s::height, height, fbtk_widget_s::parent, parent, fbtk_widget_s::width, width, fbtk_widget_s::x, and fbtk_widget_s::y.

Referenced by fbtk_reposition_hscroll(), fbtk_reposition_vscroll(), gui_resize(), resize_browser_widget(), resize_normal_browser_window(), and resize_toolbar().

Here is the caller graph for this function:

◆ fbtk_set_scroll_parameters()

bool fbtk_set_scroll_parameters ( fbtk_widget_t widget,
int  min,
int  max,
int  thumb,
int  page 
)

Set scoll widget parameters.

Parameters
widgetThe widget to set the parameters for.
minThe minimum range value.
maxThe maximum range value.
thumbThe size of the slider.
pageThe amout to scroll for a page.
Returns
true if the scroll parameter was set else false.

Definition at line 535 of file scroll.c.

References FB_WIDGET_TYPE_HSCROLL, FB_WIDGET_TYPE_VSCROLL, fbtk_request_redraw(), max, fbtk_widget_s::maximum, min, fbtk_widget_s::minimum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::type, and fbtk_widget_s::u.

Referenced by gui_window_update_extent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_scroll_position()

bool fbtk_set_scroll_position ( fbtk_widget_t widget,
int  pos 
)

set scroll widget position.

Parameters
widgetThe widget to set the position on.
posThe position to set
Returns
true if the scroll parameter was set else false.

Definition at line 565 of file scroll.c.

References FB_WIDGET_TYPE_HSCROLL, FB_WIDGET_TYPE_VSCROLL, fbtk_request_redraw(), fbtk_widget_s::maximum, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::type, and fbtk_widget_s::u.

Referenced by widget_scroll_x(), and widget_scroll_y().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_text()

void fbtk_set_text ( fbtk_widget_t widget,
const char *  text 
)

Change the text of a text widget.

Parameters
widgetText widget.
textThe new UTF-8 text to put in the widget.

Definition at line 542 of file text.c.

References fb_font_width(), fb_text_font_style(), fb_text_input_remove_caret_cb(), FB_WIDGET_TYPE_TEXT, fbtk_get_caret(), fbtk_request_redraw(), fbtk_set_caret(), fbtk_widget_s::height, fbtk_widget_s::text, text(), fbtk_widget_s::type, and fbtk_widget_s::u.

Referenced by fbtk_enable_oskb(), gui_window_set_status(), and gui_window_set_url().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_set_zorder()

int fbtk_set_zorder ( fbtk_widget_t widget,
int  z 
)

Set the z order of a widget.

Definition at line 181 of file fbtk.c.

References fbtk_widget_s::next, fbtk_widget_s::prev, and swap_siblings().

Referenced by fb_local_history_present(), and map_osk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_tgrab_pointer()

bool fbtk_tgrab_pointer ( fbtk_widget_t widget)

Toggle pointer grab.

Toggles the movement grab for a widget.

Parameters
widgetThe widget trying to grab the movement.
Returns
true if the grab was ok, false if the grab failed (already grabbed).

Definition at line 95 of file event.c.

References fbtk_get_root_widget(), and root.

Referenced by fb_browser_window_click(), fb_browser_window_move(), hscrollarea_click(), and vscrollarea_click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_warp_pointer()

void fbtk_warp_pointer ( fbtk_widget_t widget,
int  x,
int  y,
bool  relative 
)

Move pointer.

Move the pointer cursor to a given location.

Parameters
widgetany tookit widget.
xmovement in horizontal plane.
ymovement in vertical plane.
relativeWheter the /a x and /a y should be considered relative to current pointer position.

Definition at line 117 of file event.c.

References FBTK_CBT_POINTERENTER, FBTK_CBT_POINTERLEAVE, FBTK_CBT_POINTERMOVE, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_root_widget(), fbtk_get_widget_at(), fbtk_post_callback(), fbtk_widget_s::height, root, and fbtk_widget_s::width.

Referenced by fbtk_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fbtk_writable_text()

void fbtk_writable_text ( fbtk_widget_t widget,
fbtk_enter_t  enter,
void *  pw 
)

Alter a text widget to be writable.

Parameters
widgetText widget.
enterThe routine to call when enter is pressed.
pwThe context to pass to the enter callback routine.

Definition at line 532 of file text.c.

References FBTK_CBT_INPUT, fbtk_set_handler(), fbtk_widget_s::text, text_input(), and fbtk_widget_s::u.

Here is the call graph for this function:

◆ map_osk()

void map_osk ( void  )

show the osk.

Definition at line 189 of file osk.c.

References fbtk_set_mapping(), fbtk_set_zorder(), and osk.

Referenced by fb_osk_click().

Here is the call graph for this function:
Here is the caller graph for this function: