rofi  1.5.4
scrollbar.c File Reference
#include <config.h>
#include <xkbcommon/xkbcommon.h>
#include <glib.h>
#include "widgets/textbox.h"
#include "widgets/listview.h"
#include "widgets/scrollbar.h"
#include "theme.h"
Include dependency graph for scrollbar.c:

Go to the source code of this file.

Macros

#define DEFAULT_SCROLLBAR_WIDTH   8
 

Functions

static void scrollbar_draw (widget *, cairo_t *)
 
static void scrollbar_free (widget *)
 
static int scrollbar_get_desired_height (widget *wid)
 
guint scrollbar_scroll_get_line (const scrollbar *sb, int y)
 
static void scrollbar_scroll (scrollbar *sb, int y)
 
static WidgetTriggerActionResult scrollbar_trigger_action (widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, gint y, G_GNUC_UNUSED void *user_data)
 
static gboolean scrollbar_motion_notify (widget *wid, G_GNUC_UNUSED gint x, gint y)
 
scrollbarscrollbar_create (widget *parent, const char *name)
 
void scrollbar_set_max_value (scrollbar *sb, unsigned int max)
 
void scrollbar_set_handle (scrollbar *sb, unsigned int pos)
 
void scrollbar_set_handle_length (scrollbar *sb, unsigned int pos_length)
 

Macro Definition Documentation

◆ DEFAULT_SCROLLBAR_WIDTH

#define DEFAULT_SCROLLBAR_WIDTH   8

The default width of the scrollbar

Definition at line 39 of file scrollbar.c.

Function Documentation

◆ scrollbar_draw()

static void scrollbar_draw ( widget wid,
cairo_t *  draw 
)
static

The range is the height - handle length. r = h - handle; handle is the element length of the handle* length of one element. handle = r / ( num ) * hl

r = h - r / ( num) *hl r*num = num*h - r*hl r*num+r*hl = num*h; r ( num+hl ) = num*h r = (num*h)/(num+hl)

Definition at line 165 of file scrollbar.c.

References _widget::h, _scrollbar::length, _scrollbar::pos, _scrollbar::pos_length, rofi_theme_get_color(), WIDGET, widget_padding_get_left(), widget_padding_get_remaining_height(), widget_padding_get_remaining_width(), and widget_padding_get_top().

Referenced by scrollbar_create().

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

◆ scrollbar_free()

static void scrollbar_free ( widget wid)
static

Definition at line 126 of file scrollbar.c.

Referenced by scrollbar_create().

Here is the caller graph for this function:

◆ scrollbar_get_desired_height()

static int scrollbar_get_desired_height ( widget wid)
static

Definition at line 43 of file scrollbar.c.

References _widget::h.

Referenced by scrollbar_create().

Here is the caller graph for this function:

◆ scrollbar_motion_notify()

static gboolean scrollbar_motion_notify ( widget wid,
G_GNUC_UNUSED gint  x,
gint  y 
)
static

Definition at line 95 of file scrollbar.c.

References scrollbar_scroll().

Referenced by scrollbar_create().

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

◆ scrollbar_scroll()

static void scrollbar_scroll ( scrollbar sb,
int  y 
)
static

Definition at line 73 of file scrollbar.c.

References listview_set_selected(), _widget::parent, scrollbar_scroll_get_line(), and _scrollbar::widget.

Referenced by scrollbar_motion_notify(), and scrollbar_trigger_action().

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

◆ scrollbar_trigger_action()

static WidgetTriggerActionResult scrollbar_trigger_action ( widget wid,
MouseBindingMouseDefaultAction  action,
G_GNUC_UNUSED gint  x,
gint  y,
G_GNUC_UNUSED void *  user_data 
)
static

Definition at line 78 of file scrollbar.c.

References MOUSE_CLICK_DOWN, MOUSE_CLICK_UP, MOUSE_DCLICK_DOWN, MOUSE_DCLICK_UP, scrollbar_scroll(), WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN, and WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END.

Referenced by scrollbar_create().

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