summaryrefslogtreecommitdiffstats
path: root/include/theme.h
blob: 2eac4601924478e44200d5a10243503fab507ed8 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef THEME_H
#define THEME_H
#include <glib.h>
#include <cairo.h>
typedef enum {
    P_INTEGER,
    P_DOUBLE,
    P_STRING,
    P_BOOLEAN,
    P_COLOR
} PropertyType;

typedef struct
{
    /** red channel */
    double red;
    /** green channel */
    double green;
    /** blue channel */
    double blue;
    /**  alpha channel */
    double alpha;
} ThemeColor;

typedef struct {
    char *name;
    PropertyType type;
    union {
        int           i;
        double        f;
        char          *s;
        int           b;
        ThemeColor color;
    } value;
} Property;

typedef struct _Widget {
    int set;
    char *name;

    unsigned int num_widgets;
    struct _Widget **widgets;

    GHashTable *properties;

    struct _Widget *parent;
} Widget;


extern Widget *rofi_theme;

Widget *rofi_theme_find_or_create_class ( Widget *base, const char *class );


void rofi_theme_print ( Widget *widget );

Property *rofi_theme_property_create ( PropertyType type );
void rofi_theme_property_free ( Property *p );
void rofi_theme_free ( Widget * );
void rofi_theme_parse_file ( const char *file );

/**
 * Public API
 */

int rofi_theme_get_integer   ( const char *wclass,  const char *name, const char *state,  const char *property, int def );
int rofi_theme_get_boolean   ( const char *wclass,  const char *name, const char *state,  const char *property, int def );
char *rofi_theme_get_string  ( const char *wclass,  const char *name, const char *state,  const char *property, char *def );
double rofi_theme_get_double ( const char *wclass,  const char *name, const char *state,  const char *property, double def );
void rofi_theme_get_color ( const char *wclass, const char  *name, const char *state, const char *property, cairo_t *d);
#endif