rofi  1.7.0
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 
405 GList *rofi_theme_get_list(const widget *widget, const char *property,
406  const char *defaults);
411 gboolean rofi_theme_is_empty(void);
412 
416 void rofi_theme_reset(void);
417 
426 char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file);
427 
432 
440 
447 
454 
460 int rofi_theme_rasi_validate(const char *filename);
461 
462 #endif
PropertyType
Definition: rofi-types.h:10
RofiOrientation
Definition: rofi-types.h:134
RofiCursorType
Definition: rofi-types.h:142
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:1142
gboolean rofi_theme_get_image(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1107
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
Property * rofi_theme_property_copy(const Property *p)
Definition: theme.c:111
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
Definition: theme.c:830
ThemeWidget * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:732
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:856
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1282
struct ThemeWidget ThemeWidget
Property * rofi_theme_find_property(ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
Definition: theme.c:694
RofiCursorType rofi_theme_get_cursor_type(const widget *widget, const char *property, RofiCursorType def)
Definition: theme.c:913
ThemeWidget * rofi_theme_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:740
ThemeWidget * rofi_configuration
Definition: xrmoptions.c:46
void rofi_theme_parse_process_conditionals(void)
Definition: theme.c:1445
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:996
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget, const char *property, RofiHighlightColorStyle th)
Definition: theme.c:1205
int rofi_theme_rasi_validate(const char *filename)
Definition: rofi.c:1077
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
Definition: theme.c:884
Property * rofi_theme_property_create(PropertyType type)
Definition: theme.c:81
char * rofi_theme_parse_prepare_file(const char *file, const char *parent_file)
Definition: theme.c:1305
ThemeMediaType rofi_theme_parse_media_type(const char *type)
Definition: theme.c:1451
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table)
Definition: theme.c:605
double rofi_theme_get_double(const widget *widget, const char *property, double def)
Definition: theme.c:969
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
Definition: theme.c:793
void rofi_theme_print(ThemeWidget *widget)
Definition: theme.c:539
gboolean rofi_theme_parse_file(const char *file)
gboolean rofi_theme_has_property(const widget *widget, const char *property)
Definition: theme.c:1494
ThemeWidget * rofi_theme
Definition: theme.h:90
void rofi_theme_reset(void)
Definition: theme.c:210
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child)
Definition: theme.c:1339
GList * rofi_theme_get_list(const widget *widget, const char *property, const char *defaults)
Definition: theme.c:1176
int rofi_theme_get_position(const widget *widget, const char *property, int def)
Definition: theme.c:768
void rofi_theme_print_index(ThemeWidget *widget, int index)
Definition: theme.c:479
void rofi_theme_free(ThemeWidget *widget)
Definition: theme.c:216
ThemeWidget * rofi_theme_find_or_create_name(ThemeWidget *base, const char *name)
Definition: theme.c:61
gboolean rofi_theme_is_empty(void)
Definition: theme.c:1295
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance)
Definition: theme.c:99
void rofi_theme_property_free(Property *p)
Definition: theme.c:182
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
Definition: theme.c:941
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1286