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
347 
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
rofi_theme_get_highlight
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget, const char *property, RofiHighlightColorStyle th)
Definition: theme.c:932
rofi_theme_print
void rofi_theme_print(ThemeWidget *widget)
Definition: theme.c:536
PropertyType
PropertyType
Definition: rofi-types.h:11
THEME_MEDIA_TYPE_MAX_ASPECT_RATIO
@ THEME_MEDIA_TYPE_MAX_ASPECT_RATIO
Definition: theme.h:53
rofi_theme_reset
void rofi_theme_reset(void)
Definition: theme.c:237
rofi_theme_parse_media_type
ThemeMediaType rofi_theme_parse_media_type(const char *type)
Definition: theme.c:1353
helper_get_theme_path
char * helper_get_theme_path(const char *file)
Definition: helper.c:1080
rofi_theme_parse_process_conditionals
void rofi_theme_parse_process_conditionals(void)
Definition: theme.c:1346
rofi_theme_property_create
Property * rofi_theme_property_create(PropertyType type)
Definition: theme.c:78
rofi_theme
ThemeWidget * rofi_theme
ThemeMediaType
ThemeMediaType
Definition: theme.h:39
THEME_MEDIA_TYPE_MIN_HEIGHT
@ THEME_MEDIA_TYPE_MIN_HEIGHT
Definition: theme.h:45
rofi_theme_get_position
int rofi_theme_get_position(const widget *widget, const char *property, int def)
Definition: theme.c:730
rofi-types.h
ThemeWidget::media
ThemeMedia * media
Definition: theme.h:78
ThemeWidget::widgets
struct ThemeWidget ** widgets
Definition: theme.h:76
rofi_theme_find_or_create_name
ThemeWidget * rofi_theme_find_or_create_name(ThemeWidget *base, const char *name)
Definition: theme.c:59
rofi_theme_property_copy_distance
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance)
Definition: theme.c:97
rofi_theme_parse_file
gboolean rofi_theme_parse_file(const char *file)
ThemeMedia
Definition: theme.h:62
ThemeMedia::value
double value
Definition: theme.h:64
rofi_theme_get_double
double rofi_theme_get_double(const widget *widget, const char *property, double def)
Definition: theme.c:834
distance_get_linestyle
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1031
RofiDistance
Definition: rofi-types.h:127
THEME_MEDIA_TYPE_MIN_ASPECT_RATIO
@ THEME_MEDIA_TYPE_MIN_ASPECT_RATIO
Definition: theme.h:51
rofi_theme_has_property
gboolean rofi_theme_has_property(const widget *widget, const char *property)
Definition: theme.c:1379
widget.h
Property
Definition: rofi-types.h:247
ThemeWidget::parent
struct ThemeWidget * parent
Definition: theme.h:82
rofi_theme_parse_prepare_file
char * rofi_theme_parse_prepare_file(const char *file, const char *parent_file)
Definition: theme.c:1202
THEME_MEDIA_TYPE_MON_ID
@ THEME_MEDIA_TYPE_MON_ID
Definition: theme.h:49
RofiPadding
Definition: rofi-types.h:162
THEME_MEDIA_TYPE_MAX_HEIGHT
@ THEME_MEDIA_TYPE_MAX_HEIGHT
Definition: theme.h:47
rofi_theme_parse_string
gboolean rofi_theme_parse_string(const char *string)
ThemeWidget::num_widgets
unsigned int num_widgets
Definition: theme.h:75
ThemeMedia::type
ThemeMediaType type
Definition: theme.h:63
rofi_theme_get_distance
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
Definition: theme.c:763
ThemeWidget::set
int set
Definition: theme.h:72
rofi_theme_property_free
void rofi_theme_property_free(Property *p)
Definition: theme.c:168
rofi_theme_get_integer
int rofi_theme_get_integer(const widget *widget, const char *property, int def)
Definition: theme.c:747
rofi_theme_property_copy
Property * rofi_theme_property_copy(Property *p)
Definition: theme.c:109
rofi_theme_free
void rofi_theme_free(ThemeWidget *widget)
Definition: theme.c:246
THEME_MEDIA_TYPE_MIN_WIDTH
@ THEME_MEDIA_TYPE_MIN_WIDTH
Definition: theme.h:41
rofi_theme_get_color
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:861
rofi_theme_widget_add_properties
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table)
Definition: theme.c:592
rofi_theme_is_empty
gboolean rofi_theme_is_empty(void)
Definition: theme.c:1042
rofi_theme_get_list
GList * rofi_theme_get_list(const widget *widget, const char *property, const char *defaults)
Definition: theme.c:906
THEME_MEDIA_TYPE_MAX_WIDTH
@ THEME_MEDIA_TYPE_MAX_WIDTH
Definition: theme.h:43
ThemeWidget
Definition: theme.h:71
rofi_theme_find_property
Property * rofi_theme_find_property(ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
Definition: theme.c:683
rofi_theme_parse_merge_widgets
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child)
Definition: theme.c:1237
THEME_MEDIA_TYPE_INVALID
@ THEME_MEDIA_TYPE_INVALID
Definition: theme.h:55
rofi_theme_find_widget
ThemeWidget * rofi_theme_find_widget(const char *name, const char *state, gboolean exact)
Definition: theme.c:721
RofiHighlightColorStyle
Definition: rofi-types.h:173
rofi_theme_get_orientation
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
Definition: theme.c:801
RofiOrientation
RofiOrientation
Definition: rofi-types.h:138
_widget
Definition: widget-internal.h:36
ThemeWidget
struct ThemeWidget ThemeWidget
distance_get_pixel
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1026
ThemeWidget::properties
GHashTable * properties
Definition: theme.h:80
rofi_theme_get_padding
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:883
rofi_theme_get_string
const char * rofi_theme_get_string(const widget *widget, const char *property, const char *def)
Definition: theme.c:818
ThemeWidget::name
char * name
Definition: theme.h:73
ThemeMedia
struct ThemeMedia ThemeMedia
rofi_theme_get_boolean
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:785