2016-12-09 18:49:49 +00:00
|
|
|
#ifndef THEME_H
|
|
|
|
#define THEME_H
|
|
|
|
#include <glib.h>
|
2016-12-11 11:19:46 +00:00
|
|
|
#include <cairo.h>
|
2016-12-09 18:49:49 +00:00
|
|
|
typedef enum {
|
|
|
|
P_INTEGER,
|
2016-12-09 21:16:31 +00:00
|
|
|
P_DOUBLE,
|
2016-12-09 18:49:49 +00:00
|
|
|
P_STRING,
|
|
|
|
P_BOOLEAN,
|
|
|
|
P_COLOR
|
|
|
|
} PropertyType;
|
|
|
|
|
2016-12-10 18:48:44 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** red channel */
|
|
|
|
double red;
|
|
|
|
/** green channel */
|
|
|
|
double green;
|
|
|
|
/** blue channel */
|
|
|
|
double blue;
|
|
|
|
/** alpha channel */
|
|
|
|
double alpha;
|
|
|
|
} ThemeColor;
|
|
|
|
|
2016-12-27 21:19:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int left;
|
|
|
|
int right;
|
|
|
|
int top;
|
|
|
|
int bottom;
|
|
|
|
gboolean percentual;
|
|
|
|
} Padding;
|
|
|
|
|
2016-12-09 18:49:49 +00:00
|
|
|
typedef struct {
|
|
|
|
char *name;
|
|
|
|
PropertyType type;
|
|
|
|
union {
|
|
|
|
int i;
|
|
|
|
double f;
|
|
|
|
char *s;
|
|
|
|
int b;
|
2016-12-10 18:48:44 +00:00
|
|
|
ThemeColor color;
|
2016-12-09 18:49:49 +00:00
|
|
|
} value;
|
|
|
|
} Property;
|
|
|
|
|
|
|
|
typedef struct _Widget {
|
2016-12-12 22:40:43 +00:00
|
|
|
int set;
|
2016-12-09 18:49:49 +00:00
|
|
|
char *name;
|
|
|
|
|
|
|
|
unsigned int num_widgets;
|
|
|
|
struct _Widget **widgets;
|
|
|
|
|
|
|
|
GHashTable *properties;
|
|
|
|
|
|
|
|
struct _Widget *parent;
|
|
|
|
} Widget;
|
|
|
|
|
2016-12-10 18:48:44 +00:00
|
|
|
|
2016-12-09 18:49:49 +00:00
|
|
|
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 );
|
2016-12-16 08:28:13 +00:00
|
|
|
void rofi_theme_widget_add_properties ( Widget *widget, GHashTable *table );
|
2016-12-09 21:16:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Public API
|
|
|
|
*/
|
|
|
|
|
2016-12-12 22:40:43 +00:00
|
|
|
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 );
|
2016-12-12 20:14:57 +00:00
|
|
|
void rofi_theme_get_color ( const char *wclass, const char *name, const char *state, const char *property, cairo_t *d);
|
2016-12-27 21:19:15 +00:00
|
|
|
Padding rofi_theme_get_padding ( const char *wclass, const char *name, const char *state, const char *property, Padding pad );
|
2016-12-09 18:49:49 +00:00
|
|
|
#endif
|