NetSurf
Functions
scroll.c File Reference
#include <assert.h>
#include <stdbool.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
#include <libnsfb_cursor.h>
#include "utils/log.h"
#include "netsurf/browser_window.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/image_data.h"
#include "widget.h"
Include dependency graph for scroll.c:

Go to the source code of this file.

Functions

static int vscroll_redraw (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int vscroll_drag (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int vscrollu_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int vscrolld_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int vscrollarea_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
fbtk_widget_tfbtk_create_vscroll (fbtk_widget_t *parent, int x, int y, int width, int height, colour fg, colour bg, fbtk_callback callback, void *context)
 Create a vertical scroll widget. More...
 
void fbtk_reposition_vscroll (fbtk_widget_t *vscroll, int x, int y, int width, int height)
 Move and/or resize a vertical scroll widget. More...
 
static int hscroll_redraw (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int hscrolll_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int hscrollr_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int hscroll_drag (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int hscrollarea_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
fbtk_widget_tfbtk_create_hscroll (fbtk_widget_t *parent, int x, int y, int width, int height, colour fg, colour bg, fbtk_callback callback, void *context)
 Create a horizontal scroll widget. 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...
 
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 position)
 set scroll widget position. More...
 

Function Documentation

◆ 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_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_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_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:

◆ hscroll_drag()

static int hscroll_drag ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 392 of file scroll.c.

References fbtk_callback_info::context, fbtk_widget_s::drag, fbtk_widget_s::drag_position, FBTK_CBT_SCROLLX, fbtk_post_callback(), fbtk_widget_s::maximum, fbtk_widget_s::minimum, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, fbtk_widget_s::width, and fbtk_callback_info::x.

Referenced by hscrollarea_click().

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

◆ hscroll_redraw()

static int hscroll_redraw ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 300 of file scroll.c.

References fbtk_widget_s::bg, fbtk_get_bbox(), fbtk_get_root_widget(), fbtk_widget_s::fg, fbtk_widget_s::height, fbtk_widget_s::maximum, fbtk_widget_s::minimum, NSLOG, fbtk_widget_s::position, root, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, fbtk_widget_s::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by fbtk_create_hscroll().

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

◆ hscrollarea_click()

static int hscrollarea_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 415 of file scroll.c.

References fbtk_callback_info::context, fbtk_widget_s::drag, fbtk_widget_s::drag_position, fbtk_callback_info::event, FBTK_CBT_POINTERMOVE, FBTK_CBT_SCROLLX, fbtk_post_callback(), fbtk_set_handler(), fbtk_tgrab_pointer(), hscroll_drag(), fbtk_widget_s::maximum, fbtk_widget_s::minimum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, fbtk_widget_s::width, and fbtk_callback_info::x.

Referenced by fbtk_create_hscroll().

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

◆ hscrolll_click()

static int hscrolll_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 352 of file scroll.c.

References fbtk_callback_info::context, fbtk_callback_info::event, FBTK_CBT_SCROLLX, fbtk_post_callback(), fbtk_widget_s::minimum, NSLOG, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, and fbtk_widget_s::u.

Referenced by fbtk_create_hscroll().

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

◆ hscrollr_click()

static int hscrollr_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 373 of file scroll.c.

References fbtk_callback_info::context, fbtk_callback_info::event, FBTK_CBT_SCROLLX, fbtk_post_callback(), fbtk_widget_s::maximum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, and fbtk_widget_s::u.

Referenced by fbtk_create_hscroll().

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

◆ vscroll_drag()

static int vscroll_drag ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 93 of file scroll.c.

References fbtk_callback_info::context, fbtk_widget_s::drag, fbtk_widget_s::drag_position, FBTK_CBT_SCROLLY, fbtk_post_callback(), fbtk_widget_s::height, fbtk_widget_s::maximum, fbtk_widget_s::minimum, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, and fbtk_callback_info::y.

Referenced by vscrollarea_click().

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

◆ vscroll_redraw()

static int vscroll_redraw ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 42 of file scroll.c.

References fbtk_widget_s::bg, fbtk_get_bbox(), fbtk_get_root_widget(), fbtk_widget_s::fg, fbtk_widget_s::height, fbtk_widget_s::maximum, fbtk_widget_s::minimum, fbtk_widget_s::position, root, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, fbtk_widget_s::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by fbtk_create_vscroll().

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

◆ vscrollarea_click()

static int vscrollarea_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 154 of file scroll.c.

References fbtk_callback_info::context, fbtk_widget_s::drag, fbtk_widget_s::drag_position, fbtk_callback_info::event, FBTK_CBT_POINTERMOVE, FBTK_CBT_SCROLLY, fbtk_post_callback(), fbtk_set_handler(), fbtk_tgrab_pointer(), fbtk_widget_s::height, fbtk_widget_s::maximum, fbtk_widget_s::minimum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, fbtk_widget_s::u, vscroll_drag(), and fbtk_callback_info::y.

Referenced by fbtk_create_vscroll().

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

◆ vscrolld_click()

static int vscrolld_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 135 of file scroll.c.

References fbtk_callback_info::context, fbtk_callback_info::event, FBTK_CBT_SCROLLY, fbtk_post_callback(), fbtk_widget_s::maximum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, fbtk_widget_s::thumb, and fbtk_widget_s::u.

Referenced by fbtk_create_vscroll().

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

◆ vscrollu_click()

static int vscrollu_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 116 of file scroll.c.

References fbtk_callback_info::context, fbtk_callback_info::event, FBTK_CBT_SCROLLY, fbtk_post_callback(), fbtk_widget_s::minimum, fbtk_widget_s::page, fbtk_widget_s::position, fbtk_widget_s::scroll, and fbtk_widget_s::u.

Referenced by fbtk_create_vscroll().

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