rofi  1.6.1
theme.h
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2020 Qball Cow <qball@gmpclient.org>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  */
27 
28 #ifndef THEME_H
29 #define THEME_H
30 #include <glib.h>
31 #include <cairo.h>
32 #include <widgets/widget.h>
33 #include "rofi-types.h"
34 
38 typedef enum
39 {
57 
61 typedef struct ThemeMedia
62 {
64  double value;
66 
70 typedef struct ThemeWidget
71 {
72  int set;
73  char *name;
74 
75  unsigned int num_widgets;
76  struct ThemeWidget **widgets;
77 
79 
80  GHashTable *properties;
81 
84 
88 extern ThemeWidget *rofi_theme;
89 
99 
106 
115 
122 
135 
143 gboolean rofi_theme_parse_file ( const char *file );
144 
152 gboolean rofi_theme_parse_string ( const char *string );
153 
160 void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table );
161 
175 RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def );
176 
186 int rofi_theme_get_integer ( const widget *widget, const char *property, int def );
187 
197 int rofi_theme_get_position ( const widget *widget, const char *property, int def );
198 
208 int rofi_theme_get_boolean ( const widget *widget, const char *property, int def );
209 
219 RofiOrientation rofi_theme_get_orientation ( const widget *widget, const char *property, RofiOrientation def );
229 const char *rofi_theme_get_string ( const widget *widget, const char *property, const char *def );
230 
240 double rofi_theme_get_double ( const widget *widget, const char *property, double def );
241 
250 void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );
251 
259 gboolean rofi_theme_has_property ( const widget *widget, const char *property );
260 
270 RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, RofiPadding pad );
271 
282 
297 void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
298 
312 ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact );
313 
324 Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, const char *property, gboolean exact );
325 
335 GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults );
340 gboolean rofi_theme_is_empty ( void );
341 
345 void rofi_theme_reset ( void );
346 #ifdef THEME_CONVERTER
350 void rofi_theme_convert_old ( void );
351 #endif
352 
358 char *helper_get_theme_path ( const char *file );
359 
368 char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file );
369 
374 
382 
388 ThemeMediaType rofi_theme_parse_media_type ( const char *type );
390 #endif
PropertyType
Definition: rofi-types.h:11
RofiOrientation
Definition: rofi-types.h:138
ThemeMediaType type
Definition: theme.h:63
double value
Definition: theme.h:64
struct ThemeWidget ** widgets
Definition: theme.h:76
struct ThemeWidget * parent
Definition: theme.h:82
ThemeMedia * media
Definition: theme.h:78
unsigned int num_widgets
Definition: theme.h:75
char * name
Definition: theme.h:73
int set
Definition: theme.h:72
GHashTable * properties
Definition: theme.h:80
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:883
gboolean rofi_theme_parse_string(const char *string)
char * helper_get_theme_path(const char *file)
Definition: helper.c:1080
struct ThemeMedia ThemeMedia
ThemeMediaType
Definition: theme.h:39
@ THEME_MEDIA_TYPE_MAX_HEIGHT
Definition: theme.h:47
@ THEME_MEDIA_TYPE_MON_ID
Definition: theme.h:49
@ THEME_MEDIA_TYPE_INVALID
Definition: theme.h:55
@ THEME_MEDIA_TYPE_MIN_WIDTH
Definition: theme.h:41
@ THEME_MEDIA_TYPE_MIN_ASPECT_RATIO
Definition: theme.h:51
@ THEME_MEDIA_TYPE_MAX_ASPECT_RATIO
Definition: theme.h:53
@ THEME_MEDIA_TYPE_MAX_WIDTH
Definition: theme.h:43
@ THEME_MEDIA_TYPE_MIN_HEIGHT
Definition: theme.h:45
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
Definition: theme.c:763
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:785
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1026
struct ThemeWidget ThemeWidget
Property * rofi_theme_find_property(ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
Definition: theme.c:683
ThemeWidget * rofi_theme_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:721
void rofi_theme_parse_process_conditionals(void)
Definition: theme.c:1346
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:861
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget, const char *property, RofiHighlightColorStyle th)
Definition: theme.c:932
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
Definition: theme.c:801
Property * rofi_theme_property_copy(Property *p)
Definition: theme.c:109
Property * rofi_theme_property_create(PropertyType type)
Definition: theme.c:78
char * rofi_theme_parse_prepare_file(const char *file, const char *parent_file)
Definition: theme.c:1202
ThemeMediaType rofi_theme_parse_media_type(const char *type)
Definition: theme.c:1353
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table)
Definition: theme.c:592
double rofi_theme_get_double(const widget *widget, const char *property, double def)
Definition: theme.c:834
ThemeWidget * rofi_theme
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
Definition: theme.c:747
void rofi_theme_print(ThemeWidget *widget)
Definition: theme.c:536
gboolean rofi_theme_parse_file(const char *file)
gboolean rofi_theme_has_property(const widget *widget, const char *property)
Definition: theme.c:1379
void rofi_theme_reset(void)
Definition: theme.c:237
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child)
Definition: theme.c:1237
GList * rofi_theme_get_list(const widget *widget, const char *property, const char *defaults)
Definition: theme.c:906
int rofi_theme_get_position(const widget *widget, const char *property, int def)
Definition: theme.c:730
void rofi_theme_free(ThemeWidget *widget)
Definition: theme.c:246
ThemeWidget * rofi_theme_find_or_create_name(ThemeWidget *base, const char *name)
Definition: theme.c:59
gboolean rofi_theme_is_empty(void)
Definition: theme.c:1042
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance)
Definition: theme.c:97
void rofi_theme_property_free(Property *p)
Definition: theme.c:168
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
Definition: theme.c:818
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1031