aboutsummaryrefslogtreecommitdiffstats
path: root/src/focus_ring.h
blob: 74e900282aaef75e82cb01d1c95834f4a7f1d350 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef FOCUSRING_H
#define FOCUSRING_H

#include <gdk/gdk.h>


/* A FocusRing is an scrollable list that wraps around to the beginning/end
 * when the selection is moved out-of-bounds.
 */
typedef struct FocusRing_ {
    /* Points to current selection */
    const GList *selected;
    /* Points to beginning of list */
    const GList *beginning;
    /* Points to end of list */
    const GList *end;

    /* Function to retrieve the target "inner value" from the GList's data */
    gchar *(*getter_function)(gconstpointer);
} FocusRing;

FocusRing *initialize_focus_ring(const GList *options, gchar *(*getter_function)(gconstpointer), const gchar *const label);
void destroy_focus_ring(FocusRing *ring);

gchar *focus_ring_next(FocusRing *ring);
gchar *focus_ring_prev(FocusRing *ring);
gconstpointer focus_ring_get_selected(FocusRing *ring);
gchar *focus_ring_get_value(FocusRing *ring);
gchar *focus_ring_scroll_to_value(FocusRing *ring, const gchar *target_value);

#endif