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

Go to the source code of this file.

Data Structures

struct  _listview
 

Macros

#define DEFAULT_SPACING   2
 

Enumerations

enum  ViewType { LISTVIEW = ROFI_ORIENTATION_VERTICAL, BARVIEW = ROFI_ORIENTATION_HORIZONTAL }
 
enum  MoveDirection { LEFT_TO_RIGHT = 0, RIGHT_TO_LEFT = 1 }
 

Functions

static int listview_get_desired_height (widget *wid)
 
static void listview_free (widget *wid)
 
static unsigned int scroll_per_page_barview (listview *lv)
 
static unsigned int scroll_per_page (listview *lv)
 
static unsigned int scroll_continious (listview *lv)
 
static void update_element (listview *lv, unsigned int tb, unsigned int index, gboolean full)
 
static void barview_draw (widget *wid, cairo_t *draw)
 
static void listview_draw (widget *wid, cairo_t *draw)
 
static WidgetTriggerActionResult listview_element_trigger_action (widget *wid, MouseBindingListviewElementAction action, gint x, gint y, void *user_data)
 
static void _listview_draw (widget *wid, cairo_t *draw)
 
static void listview_recompute_elements (listview *lv)
 
void listview_set_num_elements (listview *lv, unsigned int rows)
 
unsigned int listview_get_selected (listview *lv)
 
void listview_set_selected (listview *lv, unsigned int selected)
 
static void listview_resize (widget *wid, short w, short h)
 
static widgetlistview_find_mouse_target (widget *wid, WidgetType type, gint x, gint y)
 
static WidgetTriggerActionResult listview_trigger_action (widget *wid, MouseBindingListviewAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, G_GNUC_UNUSED void *user_data)
 
static WidgetTriggerActionResult listview_element_trigger_action (widget *wid, MouseBindingListviewElementAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, void *user_data)
 
listviewlistview_create (widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse)
 
static void listview_nav_up_int (listview *lv)
 
static void listview_nav_down_int (listview *lv)
 
void listview_nav_up (listview *lv)
 
void listview_nav_down (listview *lv)
 
void listview_nav_left (listview *lv)
 
void listview_nav_right (listview *lv)
 
static void listview_nav_page_prev_int (listview *lv)
 
static void listview_nav_page_next_int (listview *lv)
 
void listview_nav_page_prev (listview *lv)
 
void listview_nav_page_next (listview *lv)
 
void listview_set_show_scrollbar (listview *lv, gboolean enabled)
 
void listview_set_scroll_type (listview *lv, ScrollType type)
 
void listview_set_mouse_activated_cb (listview *lv, listview_mouse_activated_cb cb, void *udata)
 
void listview_set_multi_select (listview *lv, gboolean enable)
 
void listview_set_num_lines (listview *lv, unsigned int num_lines)
 
unsigned int listview_get_num_lines (listview *lv)
 
void listview_set_max_lines (listview *lv, unsigned int max_lines)
 
gboolean listview_get_fixed_num_lines (listview *lv)
 
void listview_set_fixed_num_lines (listview *lv)
 
void listview_toggle_ellipsizing (listview *lv)
 

Macro Definition Documentation

◆ DEFAULT_SPACING

#define DEFAULT_SPACING   2

Default spacing between the elements in the listview.

Definition at line 40 of file listview.c.

Enumeration Type Documentation

◆ MoveDirection

The moving direction of the selection, this (in barview) affects the scrolling.

Enumerator
LEFT_TO_RIGHT 
RIGHT_TO_LEFT 

Definition at line 55 of file listview.c.

◆ ViewType

enum ViewType

Orientation of the listview

Enumerator
LISTVIEW 

Vertical (classical) list

BARVIEW 

Horizontal list. (barview)

Definition at line 44 of file listview.c.

Function Documentation

◆ _listview_draw()

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

Definition at line 352 of file listview.c.

References barview_draw(), LISTVIEW, listview_draw(), and _listview::type.

Referenced by listview_create().

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

◆ barview_draw()

◆ listview_draw()

◆ listview_element_trigger_action() [1/2]

static WidgetTriggerActionResult listview_element_trigger_action ( widget wid,
MouseBindingListviewElementAction  action,
G_GNUC_UNUSED gint  x,
G_GNUC_UNUSED gint  y,
void *  user_data 
)
static

◆ listview_element_trigger_action() [2/2]

static WidgetTriggerActionResult listview_element_trigger_action ( widget wid,
MouseBindingListviewElementAction  action,
gint  x,
gint  y,
void *  user_data 
)
static

Referenced by listview_recompute_elements().

Here is the caller graph for this function:

◆ listview_find_mouse_target()

static widget* listview_find_mouse_target ( widget wid,
WidgetType  type,
gint  x,
gint  y 
)
static

Definition at line 450 of file listview.c.

References _listview::boxes, _listview::cur_elements, _listview::last_offset, _listview::req_elements, _listview::scrollbar, WIDGET, widget_enabled(), widget_find_mouse_target(), widget_get_x_pos(), widget_get_y_pos(), and widget_intersect().

Referenced by listview_create().

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

◆ listview_free()

static void listview_free ( widget wid)
static

Definition at line 124 of file listview.c.

References _listview::boxes, _listview::cur_elements, _listview::listview_name, _listview::scrollbar, WIDGET, and widget_free().

Referenced by listview_create().

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

◆ listview_get_desired_height()

static int listview_get_desired_height ( widget wid)
static

◆ listview_nav_down_int()

static void listview_nav_down_int ( listview lv)
static

Definition at line 585 of file listview.c.

References _listview::barview, _listview::cycle, _listview::direction, LEFT_TO_RIGHT, _listview::req_elements, _listview::selected, WIDGET, and widget_queue_redraw().

Referenced by listview_nav_down(), listview_nav_right(), and listview_nav_up().

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

◆ listview_nav_page_next_int()

static void listview_nav_page_next_int ( listview lv)
static

◆ listview_nav_page_prev_int()

static void listview_nav_page_prev_int ( listview lv)
static

Definition at line 665 of file listview.c.

References BARVIEW, _listview::barview, _listview::direction, _listview::last_offset, _listview::max_elements, RIGHT_TO_LEFT, _listview::selected, _listview::type, WIDGET, and widget_queue_redraw().

Referenced by listview_nav_page_next(), and listview_nav_page_prev().

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

◆ listview_nav_up_int()

static void listview_nav_up_int ( listview lv)
static

Navigation commands.

Definition at line 570 of file listview.c.

References _listview::barview, _listview::cycle, _listview::direction, _listview::req_elements, RIGHT_TO_LEFT, _listview::selected, WIDGET, and widget_queue_redraw().

Referenced by listview_nav_down(), listview_nav_left(), and listview_nav_up().

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

◆ listview_recompute_elements()

◆ listview_resize()

◆ listview_trigger_action()

static WidgetTriggerActionResult listview_trigger_action ( widget wid,
MouseBindingListviewAction  action,
G_GNUC_UNUSED gint  x,
G_GNUC_UNUSED gint  y,
G_GNUC_UNUSED void *  user_data 
)
static

Definition at line 475 of file listview.c.

References listview_nav_down(), listview_nav_left(), listview_nav_right(), listview_nav_up(), SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, and WIDGET_TRIGGER_ACTION_RESULT_HANDLED.

Referenced by listview_create().

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

◆ scroll_continious()

static unsigned int scroll_continious ( listview lv)
static

Definition at line 175 of file listview.c.

References _listview::cur_page, _listview::max_rows, _listview::rchanged, _listview::req_elements, and _listview::selected.

Referenced by listview_draw().

Here is the caller graph for this function:

◆ scroll_per_page()

static unsigned int scroll_per_page ( listview lv)
static

Definition at line 152 of file listview.c.

References _listview::cur_page, _listview::last_offset, _listview::max_elements, _listview::rchanged, and _listview::selected.

Referenced by listview_draw().

Here is the caller graph for this function:

◆ scroll_per_page_barview()

static unsigned int scroll_per_page_barview ( listview lv)
static

Definition at line 136 of file listview.c.

References _listview::barview, _listview::cur_visible, _listview::last_offset, _listview::rchanged, and _listview::selected.

Referenced by barview_draw().

Here is the caller graph for this function:

◆ update_element()

static void update_element ( listview lv,
unsigned int  tb,
unsigned int  index,
gboolean  full 
)
static

Definition at line 196 of file listview.c.

References ALT, _listview::boxes, _listview::callback, HIGHLIGHT, NORMAL, _listview::selected, and _listview::udata.

Referenced by barview_draw(), and listview_draw().

Here is the caller graph for this function: