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

Go to the source code of this file.

Data Structures

struct  _listview_row
 
struct  _listview
 

Macros

#define DEFAULT_SPACING   2
 
#define LISTVIEW   ROFI_ORIENTATION_VERTICAL
 
#define BARVIEW   ROFI_ORIENTATION_HORIZONTAL
 

Enumerations

enum  MoveDirection { LEFT_TO_RIGHT = 0 , RIGHT_TO_LEFT = 1 }
 

Functions

static void listview_set_state (_listview_row r, TextBoxFontType tbft)
 
static void listview_add_widget (listview *lv, _listview_row *row, widget *wid, const char *label)
 
static void listview_create_row (listview *lv, _listview_row *row)
 
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 gboolean listview_element_motion_notify (widget *wid, gint x, gint y)
 
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)
 
static gboolean listview_element_motion_notify (widget *wid, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y)
 
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_set_ellipsize_start (listview *lv)
 
void listview_toggle_ellipsizing (listview *lv)
 

Variables

const char *const listview_theme_prop_names [][3]
 

Macro Definition Documentation

◆ BARVIEW

#define BARVIEW   ROFI_ORIENTATION_HORIZONTAL

Horizontal list. (barview)

Definition at line 51 of file listview.c.

◆ DEFAULT_SPACING

#define DEFAULT_SPACING   2

Default spacing between the elements in the listview.

Definition at line 43 of file listview.c.

◆ LISTVIEW

#define LISTVIEW   ROFI_ORIENTATION_VERTICAL

Orientation of the listview Vertical (classical) list

Definition at line 49 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 57 of file listview.c.

Function Documentation

◆ _listview_draw()

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

Definition at line 472 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_add_widget()

static void listview_add_widget ( listview lv,
_listview_row row,
widget wid,
const char *  label 
)
static

◆ listview_create_row()

static void listview_create_row ( listview lv,
_listview_row row 
)
static

◆ listview_draw()

◆ listview_element_motion_notify() [1/2]

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

◆ listview_element_motion_notify() [2/2]

static gboolean listview_element_motion_notify ( widget wid,
gint  x,
gint  y 
)
static

Referenced by listview_recompute_elements().

Here is the caller graph for this function:

◆ listview_element_trigger_action() [1/2]

◆ 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 570 of file listview.c.

References _listview_row::box, _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 211 of file listview.c.

References _listview_row::box, _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 737 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 815 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 723 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_set_state()

static void listview_set_state ( _listview_row  r,
TextBoxFontType  tbft 
)
static

Definition at line 138 of file listview.c.

References ACTIVE, ALT, _listview_row::box, FMOD_MASK, HIGHLIGHT, listview_theme_prop_names, STATE_MASK, URGENT, WIDGET, and widget_set_state().

Referenced by listview_recompute_elements(), and update_element().

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

◆ 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 597 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 259 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 236 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 222 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 279 of file listview.c.

References ALT, _listview::boxes, _listview::callback, HIGHLIGHT, _listview_row::icon, _listview_row::index, listview_set_state(), NORMAL, _listview::selected, _listview_row::textbox, textbox_text(), and _listview::udata.

Referenced by barview_draw(), and listview_draw().

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

Variable Documentation

◆ listview_theme_prop_names

const char* const listview_theme_prop_names[][3]
Initial value:
= {
{"normal.normal", "selected.normal", "alternate.normal"},
{"normal.urgent", "selected.urgent", "alternate.urgent"},
{"normal.active", "selected.active", "alternate.active"},
}

Names used for theming the elements in the listview. Each row can have 3 modes, normal, selected and alternate. Each row can have 3 states, normal, urgent and active.

Definition at line 129 of file listview.c.

Referenced by listview_set_state().