45#define DEFAULT_SPACING 2
51#define LISTVIEW ROFI_ORIENTATION_VERTICAL
53#define BARVIEW ROFI_ORIENTATION_HORIZONTAL
143 {
"normal.normal",
"selected.normal",
"alternate.normal"},
145 {
"normal.urgent",
"selected.urgent",
"alternate.urgent"},
147 {
"normal.active",
"selected.active",
"alternate.active"},
174 if (strcasecmp(label,
"element-icon") == 0) {
177 }
else if (strcasecmp(label,
"element-text") == 0) {
183 }
else if (strcasecmp(label,
"element-index") == 0) {
188 }
else if (strncasecmp(label,
"textbox", 7) == 0) {
193 }
else if (strncasecmp(label,
"button", 6) == 0) {
200 }
else if (strncasecmp(label,
"icon", 4) == 0) {
217 for (GList *iter = g_list_first(list); iter != NULL;
218 iter = g_list_next(iter)) {
231 list = g_list_append(list, g_strdup(
"element-icon"));
232 list = g_list_append(list, g_strdup(
"element-text"));
234 list = g_list_append(list, g_strdup(
"element-text"));
242 for (GList *iter = g_list_first(list); iter != NULL;
243 iter = g_list_next(iter)) {
246 g_list_free_full(list, g_free);
305 unsigned int vmid = (lv->
max_rows - 1) / 2;
307 unsigned int middle = (lv->
max_rows * hmid) + vmid;
308 unsigned int offset = 0;
328 unsigned int middle, selected, req_rows, offset;
333 if (selected > middle) {
334 if (selected < (req_rows - (lv->
max_rows - middle))) {
335 offset = selected - middle;
359 char str[2] = {((index + 1) % 10) +
'0',
'\0'};
373 unsigned int offset = 0;
392 for (
unsigned int i = 0; i < max && width > 0; i++) {
396 if (twidth >= width) {
406 width -= twidth + spacing_hori;
407 left_offset += twidth + spacing_hori;
412 for (
unsigned int i = 0;
413 i < lv->
cur_elements && width > 0 && i <= offset; i++) {
417 if (twidth >= width) {
423 right_offset -= twidth;
428 width -= twidth + spacing_hori;
429 right_offset -= spacing_hori;
433 offset -= lv->
barview.cur_visible - 1;
435 for (
unsigned int i = 0; i < (lv->
barview.cur_visible / 2); i++) {
437 int sw = lv->
barview.cur_visible - i - 1;
439 lv->
boxes[sw] = temp;
444 for (
unsigned int i = 0; i < lv->
barview.cur_visible; i++) {
453 unsigned int offset = 0;
486 unsigned int width = lv->
widget.
w;
489 width -= spacing_hori;
492 unsigned int element_width =
495 int d = width - (element_width + spacing_hori) * (lv->
cur_columns - 1) -
503 for (
unsigned int i = 0; i < max; i++) {
505 unsigned int ex = left_offset + ((i) % lv->
cur_columns) *
506 (element_width + spacing_hori);
524 unsigned int ex = left_offset + ((i) / lv->
max_rows) *
525 (element_width + spacing_hori);
549 for (
unsigned int i = 0; i < max; i++) {
560 gint x, gint y,
void *user_data);
575 unsigned int newne = 0;
593 for (
unsigned int i = newne; i < lv->
cur_elements; i++) {
598 for (
unsigned int i = lv->
cur_elements; i < newne; i++) {
618 TICK_N(
"listview_set_num_elements");
626 TICK_N(
"recompute elements");
713 for (i = 0; i < max && target == NULL; i++) {
727 G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y,
728 G_GNUC_UNUSED
void *user_data) {
749 G_GNUC_UNUSED gint y,
void *user_data) {
759 gboolean custom = FALSE;
776 G_GNUC_UNUSED gint x,
777 G_GNUC_UNUSED gint y) {
792 unsigned int eh, gboolean reverse) {
804 lv->
eh = MIN(eh, 128);
806 lv->
emode = PANGO_ELLIPSIZE_END;
814 char buff[lv->
eh * 2 + 1];
815 memset(buff,
'\0', lv->
eh * 2 + 1);
816 for (
unsigned int i = 0; i < (lv->
eh - 1); i++) {
818 buff[i * 2 + 1] =
'\n';
1106 G_GNUC_UNUSED
const int width) {
1190 PangoEllipsizeMode mode = lv->
emode;
1191 if (mode == PANGO_ELLIPSIZE_START) {
1192 mode = PANGO_ELLIPSIZE_MIDDLE;
1193 }
else if (mode == PANGO_ELLIPSIZE_MIDDLE) {
1194 mode = PANGO_ELLIPSIZE_END;
1195 }
else if (mode == PANGO_ELLIPSIZE_END) {
1196 mode = PANGO_ELLIPSIZE_START;
MouseBindingListviewElementAction
MouseBindingListviewAction
void textbox_set_ellipsize(textbox *tb, PangoEllipsizeMode mode)
textbox * textbox_create(widget *parent, WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign)
void textbox_moveresize(textbox *tb, int x, int y, int w, int h)
void textbox_text(textbox *tb, const char *text)
WidgetTriggerActionResult textbox_button_trigger_action(widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, G_GNUC_UNUSED void *user_data)
void box_add(box *wid, widget *child, gboolean expand)
box * box_create(widget *parent, const char *name, RofiOrientation type)
icon * icon_create(widget *parent, const char *name)
void listview_nav_page_next(listview *lv)
void listview_set_fixed_num_lines(listview *lv)
struct _listview listview
listview * listview_create(widget *parent, const char *name, listview_update_callback cb, listview_page_changed_cb page_cb, void *udata, unsigned int eh, gboolean reverse)
void listview_set_show_scrollbar(listview *lv, gboolean enabled)
void listview_set_num_elements(listview *lv, unsigned int rows)
void listview_nav_right(listview *lv)
void(*) listview_selection_changed_callback(listview *lv, unsigned int index, void *udata)
void listview_set_mouse_activated_cb(listview *lv, listview_mouse_activated_cb cb, void *udata)
void listview_toggle_ellipsizing(listview *lv)
void listview_set_ellipsize(listview *lv, PangoEllipsizeMode mode)
void listview_set_selected(listview *lv, unsigned int selected)
void listview_set_max_lines(listview *lv, unsigned int max_lines)
void listview_nav_left(listview *lv)
void listview_set_scroll_type(listview *lv, ScrollType type)
gboolean listview_get_fixed_num_lines(listview *lv)
void listview_nav_prev(listview *lv)
unsigned int listview_get_selected(listview *lv)
void(*) listview_mouse_activated_cb(listview *, gboolean, void *)
void(*) listview_page_changed_cb(void)
void listview_set_filtered(listview *lv, gboolean filtered)
void listview_nav_up(listview *lv)
void listview_nav_next(listview *lv)
void listview_nav_page_prev(listview *lv)
unsigned int listview_get_element_pitch(listview *lv, RofiOrientation orientation)
void listview_set_selection_changed_callback(listview *lv, listview_selection_changed_callback cb, void *udata)
void(*) listview_update_callback(textbox *tb, icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full)
void listview_nav_down(listview *lv)
@ LISTVIEW_SCROLL_PER_PAGE
static void listview_nav_column_right_int(listview *lv)
static unsigned int scroll_per_page(listview *lv)
static void listview_nav_up_int(listview *lv)
static unsigned int scroll_per_page_barview(listview *lv)
const char *const listview_theme_prop_names[][3]
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_nav_page_next_int(listview *lv)
static void listview_resize(widget *wid, short w, short h)
static widget * listview_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
static void _listview_draw(widget *wid, cairo_t *draw)
static void listview_nav_page_prev_int(listview *lv)
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 void listview_recompute_elements(listview *lv)
static void listview_add_widget(listview *lv, _listview_row *row, widget *wid, const char *label)
static unsigned int scroll_continious_elements(listview *lv)
static unsigned int scroll_continious_rows(listview *lv)
static void barview_draw(widget *wid, cairo_t *draw)
static void listview_free(widget *wid)
static void listview_nav_column_left_int(listview *lv)
static void listview_nav_down_int(listview *lv)
static void listview_create_row(listview *lv, _listview_row *row)
static void listview_draw(widget *wid, cairo_t *draw)
static int listview_get_desired_height(widget *wid, const int width)
static void update_element(listview *lv, unsigned int tb, unsigned int index, gboolean full)
static void listview_set_state(_listview_row r, TextBoxFontType tbft)
@ ROFI_ORIENTATION_HORIZONTAL
@ ROFI_ORIENTATION_VERTICAL
#define DEFAULT_MENU_LINES
#define DEFAULT_MENU_COLUMNS
unsigned int fixed_num_lines
void * mouse_activated_data
unsigned int menu_columns
unsigned int max_displayed_lines
listview_update_callback callback
listview_mouse_activated_cb mouse_activated
unsigned int req_elements
unsigned int element_height
unsigned int cur_elements
struct _listview::@103371100076221356057032132175372067233160022074 barview
listview_page_changed_cb page_callback
unsigned int max_elements
unsigned int fixed_num_lines
listview_selection_changed_callback sc_callback
gboolean scrollbar_scroll
RofiOrientation pack_direction
int rofi_theme_get_integer(const widget *wid, const char *property, int def)
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
int rofi_theme_get_boolean(const widget *wid, const char *property, int def)
RofiOrientation rofi_theme_get_orientation(const widget *wid, const char *property, RofiOrientation def)
RofiDistance rofi_theme_get_distance(const widget *wid, const char *property, int def)
GList * rofi_theme_get_list_strings(const widget *wid, const char *property)
const char * rofi_theme_get_string(const widget *wid, const char *property, const char *def)