rofi  1.7.5
theme.h
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2022 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 {
58 
62 typedef struct ThemeMedia {
64  double value;
65  gboolean boolv;
67 
71 typedef struct ThemeWidget {
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 
94 
99 
109  const char *name);
110 
117 
124 void rofi_theme_print_index(ThemeWidget *widget, int index);
125 
134 
141 
154 
162 gboolean rofi_theme_parse_file(const char *file);
163 
171 gboolean rofi_theme_parse_string(const char *string);
172 
179 void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table);
180 
194 RofiDistance rofi_theme_get_distance(const widget *widget, const char *property,
195  int def);
196 
206 int rofi_theme_get_integer(const widget *widget, const char *property, int def);
207 
217 int rofi_theme_get_position(const widget *widget, const char *property,
218  int def);
219 
229 int rofi_theme_get_boolean(const widget *widget, const char *property, int def);
230 
241  const char *property,
242  RofiOrientation def);
243 
254  const char *property,
255  RofiCursorType def);
265 const char *rofi_theme_get_string(const widget *widget, const char *property,
266  const char *def);
267 
277 double rofi_theme_get_double(const widget *widget, const char *property,
278  double def);
279 
288 void rofi_theme_get_color(const widget *widget, const char *property,
289  cairo_t *d);
290 
300 gboolean rofi_theme_get_image(const widget *widget, const char *property,
301  cairo_t *d);
302 
310 gboolean rofi_theme_has_property(const widget *widget, const char *property);
311 
321 RofiPadding rofi_theme_get_padding(const widget *widget, const char *property,
322  RofiPadding pad);
323 
334  const char *property,
336 
351 void distance_get_linestyle(RofiDistance d, cairo_t *draw);
352 
367 ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
368  gboolean exact);
369 
380 ThemeWidget *rofi_config_find_widget(const char *name, const char *state,
381  gboolean exact);
382 
396  const char *property, gboolean exact);
397 
401 void rofi_theme_reset(void);
402 
411 char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file);
412 
417 
422 
430 
437 
444 
450 int rofi_theme_rasi_validate(const char *filename);
451 
457 
464 
469 GList *rofi_theme_get_list_distance(const widget *widget, const char *property);
470 GList *rofi_theme_get_list_strings(const widget *widget, const char *property);
471 #endif
PropertyType
Definition: rofi-types.h:10
RofiOrientation
Definition: rofi-types.h:141
RofiCursorType
Definition: rofi-types.h:149
gboolean boolv
Definition: theme.h:65
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:1213
gboolean rofi_theme_get_image(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1178
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:56
@ THEME_MEDIA_TYPE_MIN_WIDTH
Definition: theme.h:40
@ THEME_MEDIA_TYPE_MIN_ASPECT_RATIO
Definition: theme.h:50
@ THEME_MEDIA_TYPE_BOOLEAN
Definition: theme.h:54
@ 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:1239
GList * rofi_theme_get_list_strings(const widget *widget, const char *property)
Definition: theme.c:1267
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
Definition: theme.c:877
ThemeWidget * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:778
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:903
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1415
struct ThemeWidget ThemeWidget
void rofi_theme_parse_process_links(void)
Definition: theme.c:1615
Property * rofi_theme_find_property(ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
Definition: theme.c:740
RofiCursorType rofi_theme_get_cursor_type(const widget *widget, const char *property, RofiCursorType def)
Definition: theme.c:962
ThemeWidget * rofi_theme_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:786
ThemeWidget * rofi_configuration
Definition: xrmoptions.c:46
void rofi_theme_parse_process_conditionals(void)
Definition: theme.c:1619
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1067
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget, const char *property, RofiHighlightColorStyle th)
Definition: theme.c:1320
int rofi_theme_rasi_validate(const char *filename)
Definition: rofi.c:1148
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
Definition: theme.c:932
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:1428
ThemeMediaType rofi_theme_parse_media_type(const char *type)
Definition: theme.c:1625
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table)
Definition: theme.c:651
double rofi_theme_get_double(const widget *widget, const char *property, double def)
Definition: theme.c:1040
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
Definition: theme.c:840
void rofi_theme_print(ThemeWidget *widget)
Definition: theme.c:585
gboolean rofi_theme_parse_file(const char *file)
gboolean rofi_theme_has_property(const widget *widget, const char *property)
Definition: theme.c:1671
ThemeWidget * rofi_theme
Definition: theme.h:93
void rofi_theme_reset(void)
Definition: theme.c:226
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child)
Definition: theme.c:1446
int rofi_theme_get_position(const widget *widget, const char *property, int def)
Definition: theme.c:815
void rofi_theme_print_index(ThemeWidget *widget, int index)
Definition: theme.c:525
void rofi_theme_free(ThemeWidget *widget)
Definition: theme.c:232
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:195
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:990
Property * rofi_theme_property_copy(const Property *p, void *)
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1419