rofi  1.7.3
theme.h
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2021 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 "rofi-types.h"
31 #include <cairo.h>
32 #include <glib.h>
33 #include <widgets/widget.h>
34 
38 typedef enum {
56 
60 typedef struct ThemeMedia {
62  double value;
64 
68 typedef struct ThemeWidget {
69  int set;
70  char *name;
71 
72  unsigned int num_widgets;
73  struct ThemeWidget **widgets;
74 
76 
77  GHashTable *properties;
78 
81 
85 extern ThemeWidget *rofi_theme;
86 
91 
96 
106  const char *name);
107 
114 
121 void rofi_theme_print_index(ThemeWidget *widget, int index);
122 
131 
138 
151 
159 gboolean rofi_theme_parse_file(const char *file);
160 
168 gboolean rofi_theme_parse_string(const char *string);
169 
176 void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table);
177 
191 RofiDistance rofi_theme_get_distance(const widget *widget, const char *property,
192  int def);
193 
203 int rofi_theme_get_integer(const widget *widget, const char *property, int def);
204 
214 int rofi_theme_get_position(const widget *widget, const char *property,
215  int def);
216 
226 int rofi_theme_get_boolean(const widget *widget, const char *property, int def);
227 
238  const char *property,
239  RofiOrientation def);
240 
251  const char *property,
252  RofiCursorType def);
262 const char *rofi_theme_get_string(const widget *widget, const char *property,
263  const char *def);
264 
274 double rofi_theme_get_double(const widget *widget, const char *property,
275  double def);
276 
285 void rofi_theme_get_color(const widget *widget, const char *property,
286  cairo_t *d);
287 
297 gboolean rofi_theme_get_image(const widget *widget, const char *property,
298  cairo_t *d);
299 
307 gboolean rofi_theme_has_property(const widget *widget, const char *property);
308 
318 RofiPadding rofi_theme_get_padding(const widget *widget, const char *property,
319  RofiPadding pad);
320 
331  const char *property,
333 
348 void distance_get_linestyle(RofiDistance d, cairo_t *draw);
349 
364 ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
365  gboolean exact);
366 
377 ThemeWidget *rofi_config_find_widget(const char *name, const char *state,
378  gboolean exact);
379 
393  const char *property, gboolean exact);
394 
398 void rofi_theme_reset(void);
399 
408 char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file);
409 
414 
422 
429 
436 
442 int rofi_theme_rasi_validate(const char *filename);
443 
449 
456 
461 GList *rofi_theme_get_list_distance(const widget *widget, const char *property);
462 GList *rofi_theme_get_list_strings(const widget *widget, const char *property);
463 #endif
PropertyType
Definition: rofi-types.h:10
RofiOrientation
Definition: rofi-types.h:137
RofiCursorType
Definition: rofi-types.h:145
ThemeMediaType type
Definition: theme.h:61
double value
Definition: theme.h:62
struct ThemeWidget ** widgets
Definition: theme.h:73
struct ThemeWidget * parent
Definition: theme.h:79
ThemeMedia * media
Definition: theme.h:75
unsigned int num_widgets
Definition: theme.h:72
char * name
Definition: theme.h:70
int set
Definition: theme.h:69
GHashTable * properties
Definition: theme.h:77
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:1201
gboolean rofi_theme_get_image(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1166
void rofi_theme_free_parsed_files(void)
Definition: theme.c:51
gboolean rofi_theme_parse_string(const char *string)
struct ThemeMedia ThemeMedia
ThemeMediaType
Definition: theme.h:38
@ THEME_MEDIA_TYPE_MAX_HEIGHT
Definition: theme.h:46
@ THEME_MEDIA_TYPE_MON_ID
Definition: theme.h:48
@ THEME_MEDIA_TYPE_INVALID
Definition: theme.h:54
@ THEME_MEDIA_TYPE_MIN_WIDTH
Definition: theme.h:40
@ THEME_MEDIA_TYPE_MIN_ASPECT_RATIO
Definition: theme.h:50
@ THEME_MEDIA_TYPE_MAX_ASPECT_RATIO
Definition: theme.h:52
@ THEME_MEDIA_TYPE_MAX_WIDTH
Definition: theme.h:42
@ THEME_MEDIA_TYPE_MIN_HEIGHT
Definition: theme.h:44
GList * rofi_theme_get_list_distance(const widget *widget, const char *property)
Definition: theme.c:1227
GList * rofi_theme_get_list_strings(const widget *widget, const char *property)
Definition: theme.c:1255
Property * rofi_theme_property_copy(const Property *p)
Definition: theme.c:123
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
Definition: theme.c:865
ThemeWidget * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:766
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:891
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1403
struct ThemeWidget ThemeWidget
Property * rofi_theme_find_property(ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
Definition: theme.c:728
RofiCursorType rofi_theme_get_cursor_type(const widget *widget, const char *property, RofiCursorType def)
Definition: theme.c:950
ThemeWidget * rofi_theme_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:774
ThemeWidget * rofi_configuration
Definition: xrmoptions.c:46
void rofi_theme_parse_process_conditionals(void)
Definition: theme.c:1545
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1055
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget, const char *property, RofiHighlightColorStyle th)
Definition: theme.c:1308
int rofi_theme_rasi_validate(const char *filename)
Definition: rofi.c:1092
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
Definition: theme.c:920
Property * rofi_theme_property_create(PropertyType type)
Definition: theme.c:93
char * rofi_theme_parse_prepare_file(const char *file, const char *parent_file)
Definition: theme.c:1416
ThemeMediaType rofi_theme_parse_media_type(const char *type)
Definition: theme.c:1551
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table)
Definition: theme.c:639
double rofi_theme_get_double(const widget *widget, const char *property, double def)
Definition: theme.c:1028
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
Definition: theme.c:828
void rofi_theme_print(ThemeWidget *widget)
Definition: theme.c:573
gboolean rofi_theme_parse_file(const char *file)
gboolean rofi_theme_has_property(const widget *widget, const char *property)
Definition: theme.c:1594
ThemeWidget * rofi_theme
Definition: theme.h:90
void rofi_theme_reset(void)
Definition: theme.c:225
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child)
Definition: theme.c:1434
int rofi_theme_get_position(const widget *widget, const char *property, int def)
Definition: theme.c:803
void rofi_theme_print_index(ThemeWidget *widget, int index)
Definition: theme.c:513
void rofi_theme_free(ThemeWidget *widget)
Definition: theme.c:231
ThemeWidget * rofi_theme_find_or_create_name(ThemeWidget *base, const char *name)
Definition: theme.c:73
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance)
Definition: theme.c:111
void rofi_theme_property_free(Property *p)
Definition: theme.c:194
void rofi_theme_print_parsed_files(int is_term)
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
Definition: theme.c:978
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1407