NetSurf
|
#include "netsurf/types.h"
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_t * | fbtk_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_t * | fbtk_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_t * | fbtk_create_window (fbtk_widget_t *parent, int x, int y, int width, int height, colour bg) |
Create a window widget. More... | |
fbtk_widget_t * | fbtk_create_fill (fbtk_widget_t *window, int x, int y, int width, int height, colour c) |
Create a filled rectangle. More... | |
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. More... | |
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. 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_t * | fbtk_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_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. More... | |
void | fbtk_set_bitmap (fbtk_widget_t *widget, struct fbtk_bitmap *image) |
Change the bitmap in a widget. More... | |
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. More... | |
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. More... | |
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. More... | |
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. 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... | |
#define FBTK_WIDGET_PADDING 30 |
typedef int(* fbtk_callback) (fbtk_widget_t *widget, fbtk_callback_info *cbi) |
typedef struct fbtk_callback_info fbtk_callback_info |
widget callback information
typedef enum fbtk_callback_type fbtk_callback_type |
Widget Callback type.
typedef enum fbtk_modifier_type fbtk_modifier_type |
Key modifier status.
typedef struct fbtk_widget_s fbtk_widget_t |
enum fbtk_callback_type |
enum fbtk_modifier_type |
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().
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().
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.
window | The window to add the bitmap widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
c | background colour |
image | The bitmap to put in the widget |
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().
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.
window | The window to add the button widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
c | background colour |
image | The bitmap to put in the widget |
click | The callback upon a click |
pw | The context tp pass to the callback |
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().
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.
window | The window to add the filled area widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
c | widget colour |
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().
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.
window | The window to add the filled area widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
bg | background colour |
fg | foreground colour |
callback | Called on scroll |
context | context passed to callback. |
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().
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.
window | The window to add the text widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
bg | background colour |
fg | foreground colour |
outline | widget will have a border. |
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().
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.
window | The window to add the text widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
bg | background colour |
fg | foreground colour |
click | The callback upon a click |
pw | The context tp pass to the callback |
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().
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.
window | The window to add the user widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
pw | The private pointer which can be read using fbtk_get_userpw |
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().
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.
window | The window to add the filled area widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
bg | background colour |
fg | foreground colour |
callback | Called on scroll |
context | context passed to callback. |
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().
fbtk_widget_t * fbtk_create_window | ( | fbtk_widget_t * | parent, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
colour | bg | ||
) |
Create a window widget.
parent | The parent window or the root widget for a top level window. |
x | The x location relative to the parent window. |
y | the y location relative to the parent window. |
width | The 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. |
height | The height of the window limited in a similar way to the /a width. |
bg | The background colour. |
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().
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
window | The window to add the text widget to. |
x | X coordinate of widget. |
y | Y coordinate of widget. |
width | Width of the widget |
height | Height of the widget |
bg | background colour |
fg | foreground colour |
outline | widget will have a border. |
enter | Callback when enter is pressed in widget. |
pw | Context pointer passed to entry callback. |
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().
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.
widget | The widget to destroy. |
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().
void fbtk_enable_oskb | ( | fbtk_widget_t * | widget | ) |
enable the on screen keyboard for input
widget | Widget 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().
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.
root | An fbtk widget. |
event | an event structure to update. |
timeout | The number of miliseconds to wait for an event. 0 means do not wait and -1 means wait foreevr. |
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().
int fbtk_get_absx | ( | fbtk_widget_t * | widget | ) |
Get a widget's absolute horizontal screen co-ordinate.
widget | The widget to inspect. |
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().
int fbtk_get_absy | ( | fbtk_widget_t * | widget | ) |
Get a widget's absolute vertical screen co-ordinate.
widget | The widget to inspect. |
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().
bool fbtk_get_bbox | ( | fbtk_widget_t * | widget, |
struct nsfb_bbox_s * | bbox | ||
) |
Get a widget's bounding box in absolute screen co-ordinates.
widget | The widget to inspect. |
bbox | The bounding box structure to update. |
Referenced by fb_redraw_bitmap(), fb_redraw_fill(), fb_redraw_text(), fb_redraw_text_button(), fb_redraw_window(), hscroll_redraw(), and vscroll_redraw().
bool fbtk_get_caret | ( | fbtk_widget_t * | widget, |
int * | x, | ||
int * | y, | ||
int * | height | ||
) |
Get a widget caret pos, if it owns caret.
widget | The widget to inspect. |
x | If widget has caret, returns x-coord of caret within widget |
y | If widget has caret, returns y-coord of caret within widget |
height | If widget has caret, returns caret height |
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().
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().
int fbtk_get_height | ( | fbtk_widget_t * | widget | ) |
Get a widget's height.
widget | The widget to inspect. |
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().
nsfb_t * fbtk_get_nsfb | ( | fbtk_widget_t * | widget | ) |
Retrieve the framebuffer library handle from toolkit widget.
widget | A fbtk widget. |
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().
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
widget | to check. |
Definition at line 611 of file fbtk.c.
References fbtk_get_root_widget(), and root.
Referenced by framebuffer_run().
void * fbtk_get_userpw | ( | fbtk_widget_t * | widget | ) |
Get the user context from a widget.
widget | The widget to get the context from. |
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().
fbtk_widget_t * fbtk_get_widget_at | ( | fbtk_widget_t * | widget, |
int | x, | ||
int | y | ||
) |
Obtain the widget at a point on screen.
widget | any tookit widget. |
x | location in horizontal plane. |
y | location in vertical plane. |
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().
int fbtk_get_width | ( | fbtk_widget_t * | widget | ) |
Get a widget's width.
widget | The widget to inspect. |
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().
fbtk_widget_t * fbtk_init | ( | nsfb_t * | fb | ) |
Initialise widget toolkit.
Initialises widget toolkit against a framebuffer.
fb | The underlying framebuffer. |
Definition at line 814 of file fbtk.c.
References FB_WIDGET_TYPE_ROOT, and root.
Referenced by main().
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().
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().
int fbtk_post_callback | ( | fbtk_widget_t * | widget, |
fbtk_callback_type | cbt, | ||
... | |||
) |
Helper function to allow simple calling of callbacks with parameters.
widget | The fbtk widget to post the callback to. |
cbt | The 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().
int fbtk_redraw | ( | fbtk_widget_t * | widget | ) |
Perform any pending widget redraws.
widget | A fbtk widget. |
Definition at line 669 of file fbtk.c.
References do_redraw(), fbtk_get_root_widget(), and root.
Referenced by framebuffer_run().
void fbtk_reposition_hscroll | ( | fbtk_widget_t * | scrollh, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Move and/or resize a horizontal scroll widget.
scrollh | the horizontal scroll widget |
x | new x pos |
y | new y pos |
width | new width |
height | new 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().
void fbtk_reposition_vscroll | ( | fbtk_widget_t * | scrollv, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Move and/or resize a vertical scroll widget.
scrollv | the vertical scroll widget |
x | new x pos |
y | new y pos |
width | new width |
height | new 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().
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().
void fbtk_set_bitmap | ( | fbtk_widget_t * | widget, |
struct fbtk_bitmap * | image | ||
) |
Change the bitmap in a widget.
widget | The widget to get the context from. |
image | The 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().
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.
widget | widget to give caret to, or ensure caret is released from |
set | true: caret to be set for widget, false: caret to be released |
x | x-coordinate of caret top |
y | y-coordinate of caret top |
height | height of caret |
remove_caret | callback 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().
void fbtk_set_focus | ( | fbtk_widget_t * | widget | ) |
Give widget input focus.
widget | Widget 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().
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.
widget | The widget to set the handler for. |
cbt | The type of callback to set. |
cb | The callback. |
pw | The private pointer to pass when calling the callback. |
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().
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().
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().
bool fbtk_set_scroll_parameters | ( | fbtk_widget_t * | widget, |
int | min, | ||
int | max, | ||
int | thumb, | ||
int | page | ||
) |
Set scoll widget parameters.
widget | The widget to set the parameters for. |
min | The minimum range value. |
max | The maximum range value. |
thumb | The size of the slider. |
page | The amout to scroll for a page. |
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().
bool fbtk_set_scroll_position | ( | fbtk_widget_t * | widget, |
int | pos | ||
) |
set scroll widget position.
widget | The widget to set the position on. |
pos | The position to set |
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().
void fbtk_set_text | ( | fbtk_widget_t * | widget, |
const char * | text | ||
) |
Change the text of a text widget.
widget | Text widget. |
text | The 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().
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().
bool fbtk_tgrab_pointer | ( | fbtk_widget_t * | widget | ) |
Toggle pointer grab.
Toggles the movement grab for a widget.
widget | The widget trying to grab the movement. |
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().
void fbtk_warp_pointer | ( | fbtk_widget_t * | widget, |
int | x, | ||
int | y, | ||
bool | relative | ||
) |
Move pointer.
Move the pointer cursor to a given location.
widget | any tookit widget. |
x | movement in horizontal plane. |
y | movement in vertical plane. |
relative | Wheter 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().
void fbtk_writable_text | ( | fbtk_widget_t * | widget, |
fbtk_enter_t | enter, | ||
void * | pw | ||
) |
Alter a text widget to be writable.
widget | Text widget. |
enter | The routine to call when enter is pressed. |
pw | The 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.
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().