rofi
1.5.4
|
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <gio/gio.h>
#include "theme.h"
#include "theme-parser.h"
#include "helper.h"
#include "settings.h"
#include "widgets/textbox.h"
#include "view.h"
#include "rofi.h"
#include "rofi-types.h"
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "Theme" |
Variables | |
const char *const | WindowLocationStr [9] |
FILE * | yyin |
#define G_LOG_DOMAIN "Theme" |
|
static |
Definition at line 48 of file theme.c.
References RofiDistance::distance, RofiDistance::style, and RofiDistance::type.
Referenced by int_rofi_theme_print_property().
void distance_get_linestyle | ( | RofiDistance | d, |
cairo_t * | draw | ||
) |
d | The distance handle. |
draw | The cairo drawable. |
Set linestyle.
Definition at line 788 of file theme.c.
References ROFI_HL_DASH, and RofiDistance::style.
Referenced by widget_draw().
int distance_get_pixel | ( | RofiDistance | d, |
RofiOrientation | ori | ||
) |
d | The distance handle. |
ori | The orientation. |
Convert RofiDistance into pixels.
Definition at line 765 of file theme.c.
References RofiDistance::distance, ROFI_ORIENTATION_VERTICAL, ROFI_PU_CH, ROFI_PU_EM, ROFI_PU_PERCENT, rofi_view_get_current_monitor(), textbox_get_estimated_ch(), textbox_get_estimated_char_height(), and RofiDistance::type.
Referenced by barview_draw(), box_get_desired_height(), box_get_desired_width(), hori_calculate_size(), listview_draw(), listview_get_desired_height(), listview_resize(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), scrollbar_create(), textbox_get_desired_width(), vert_calculate_size(), widget_draw(), widget_padding_get_bottom(), widget_padding_get_left(), widget_padding_get_right(), and widget_padding_get_top().
|
static |
Definition at line 190 of file theme.c.
References ThemeColor::alpha, _PropertyValue::b, ThemeColor::blue, RofiPadding::bottom, RofiHighlightColorStyle::color, _PropertyValue::color, _PropertyValue::def_value, distance_compare(), _PropertyValue::f, ThemeColor::green, _PropertyValue::highlight, _PropertyValue::i, RofiPadding::left, _PropertyValue::link, _PropertyValue::list, _PropertyValue::name, P_BOOLEAN, P_COLOR, P_DOUBLE, P_HIGHLIGHT, P_INHERIT, P_INTEGER, P_LINK, P_LIST, P_ORIENTATION, P_PADDING, P_POSITION, P_STRING, _PropertyValue::padding, ThemeColor::red, RofiPadding::right, ROFI_HL_BOLD, ROFI_HL_COLOR, ROFI_HL_ITALIC, ROFI_HL_STRIKETHROUGH, ROFI_HL_UNDERLINE, ROFI_ORIENTATION_HORIZONTAL, rofi_theme_print_distance(), _PropertyValue::s, RofiHighlightColorStyle::style, RofiPadding::top, Property::type, Property::value, and WindowLocationStr.
Referenced by rofi_theme_print_property_index().
|
inlinestatic |
Definition at line 154 of file theme.c.
Referenced by rofi_theme_print_distance().
|
static |
Definition at line 53 of file theme.c.
Referenced by rofi_theme_get_list(), and rofi_theme_property_copy().
|
static |
Definition at line 402 of file theme.c.
References Property::name, and rofi_theme_property_copy().
Referenced by rofi_theme_widget_add_properties().
|
static |
Definition at line 433 of file theme.c.
References rofi_theme_find_single().
Referenced by rofi_theme_find_widget().
ThemeWidget* rofi_theme_find_or_create_name | ( | ThemeWidget * | base, |
const char * | name | ||
) |
base | Handle to the current level in the theme. |
name | Name of the new element. |
Create a new element in the theme structure.
Definition at line 58 of file theme.c.
References ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::parent, and ThemeWidget::widgets.
Property* rofi_theme_find_property | ( | ThemeWidget * | widget, |
PropertyType | type, | ||
const char * | property, | ||
gboolean | exact | ||
) |
widget | The widget to find the property on. |
type | The PropertyType to find. |
property | The property to find. |
exact | If the property should only be found on this widget, or on parents if not found. |
Find the property on the widget. If not exact, the parents are searched recursively until match is found.
Definition at line 499 of file theme.c.
References _PropertyValue::link, _widget::name, P_INHERIT, P_INTEGER, P_LINK, P_PADDING, _widget::parent, PropertyTypeName, _PropertyValue::ref, rofi_theme_resolve_link_property(), Property::type, and Property::value.
Referenced by combi_mgrv(), rofi_theme_get_boolean(), rofi_theme_get_color(), rofi_theme_get_distance(), rofi_theme_get_double(), rofi_theme_get_highlight(), rofi_theme_get_integer(), rofi_theme_get_list(), rofi_theme_get_orientation(), rofi_theme_get_padding(), rofi_theme_get_position(), and rofi_theme_get_string().
|
inlinestatic |
Public API
Definition at line 423 of file theme.c.
References _widget::name.
Referenced by rofi_theme_find(), and rofi_theme_find_widget().
ThemeWidget* rofi_theme_find_widget | ( | const char * | name, |
const char * | state, | ||
gboolean | exact | ||
) |
Low-level functions. These can be used by non-widgets to obtain values.
name | The name of the element to find. |
state | The state of the element. |
exact | If the match should be exact, or parent can be included. |
Find the theme element. If not exact, the closest specified element is returned.
Definition at line 537 of file theme.c.
References rofi_theme, rofi_theme_find(), and rofi_theme_find_single().
Referenced by combi_mgrv(), rofi_theme_get_boolean(), rofi_theme_get_color(), rofi_theme_get_distance(), rofi_theme_get_double(), rofi_theme_get_highlight(), rofi_theme_get_integer(), rofi_theme_get_list(), rofi_theme_get_orientation(), rofi_theme_get_padding(), rofi_theme_get_position(), and rofi_theme_get_string().
void rofi_theme_free | ( | ThemeWidget * | widget | ) |
widget | Free the widget and alll children. |
Definition at line 134 of file theme.c.
References _widget::name, and rofi_theme_free().
Referenced by cleanup(), main(), rofi_theme_free(), and rofi_theme_reset().
int rofi_theme_get_boolean | ( | const widget * | widget, |
const char * | property, | ||
int | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the boolean of the widget.
Definition at line 601 of file theme.c.
References _PropertyValue::b, _widget::name, P_BOOLEAN, P_INHERIT, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_boolean(), _widget::state, Property::type, and Property::value.
Referenced by __create_window(), box_add(), listview_create(), rofi_theme_get_boolean(), and widget_init().
void rofi_theme_get_color | ( | const widget * | widget, |
const char * | property, | ||
cairo_t * | d | ||
) |
widget | The widget to query |
property | The property to query. |
d | The drawable to apply color. |
Obtain the color of the widget and applies this to the drawable d.
Definition at line 677 of file theme.c.
References ThemeColor::alpha, ThemeColor::blue, _PropertyValue::color, ThemeColor::green, _widget::name, P_COLOR, P_INHERIT, _widget::parent, ThemeColor::red, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_color(), _widget::state, Property::type, and Property::value.
Referenced by rofi_theme_get_color(), scrollbar_draw(), textbox_draw(), and widget_draw().
RofiDistance rofi_theme_get_distance | ( | const widget * | widget, |
const char * | property, | ||
int | def | ||
) |
Public API
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the distance of the widget.
Definition at line 579 of file theme.c.
References _PropertyValue::i, RofiPadding::left, _widget::name, P_INHERIT, P_INTEGER, P_PADDING, _PropertyValue::padding, _widget::parent, ROFI_HL_SOLID, ROFI_PU_PX, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_distance(), _widget::state, Property::type, and Property::value.
Referenced by box_create(), box_get_desired_width(), listview_create(), rofi_theme_get_distance(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), scrollbar_create(), and textbox_get_desired_width().
double rofi_theme_get_double | ( | const widget * | widget, |
const char * | property, | ||
double | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the double of the widget.
Definition at line 650 of file theme.c.
References _PropertyValue::f, _PropertyValue::i, _widget::name, P_DOUBLE, P_INHERIT, P_INTEGER, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_double(), _widget::state, Property::type, and Property::value.
Referenced by icon_create(), rofi_theme_get_double(), and textbox_create().
RofiHighlightColorStyle rofi_theme_get_highlight | ( | widget * | widget, |
const char * | property, | ||
RofiHighlightColorStyle | th | ||
) |
widget | The widget to query |
property | The property to query. |
th | The default value. |
Obtain the highlight .
Definition at line 748 of file theme.c.
References _PropertyValue::highlight, _widget::name, P_HIGHLIGHT, P_INHERIT, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_highlight(), _widget::state, Property::type, and Property::value.
Referenced by rofi_theme_get_highlight(), and update_callback().
int rofi_theme_get_integer | ( | const widget * | widget, |
const char * | property, | ||
int | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the integer of the widget.
Definition at line 563 of file theme.c.
References _PropertyValue::i, _widget::name, P_INHERIT, P_INTEGER, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_integer(), _widget::state, Property::type, and Property::value.
Referenced by icon_create(), listview_create(), rofi_theme_get_integer(), and rofi_view_add_widget().
GList* rofi_theme_get_list | ( | const widget * | widget, |
const char * | property, | ||
const char * | defaults | ||
) |
widget | The widget to query |
property | The property to query. |
defaults | The default value. |
Obtain list of elements (strings) of the widget.
Definition at line 722 of file theme.c.
References _PropertyValue::list, _widget::name, P_INHERIT, P_LIST, _widget::parent, rofi_g_list_strdup(), rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_list(), _widget::state, Property::type, and Property::value.
Referenced by rofi_theme_get_list(), rofi_view_add_widget(), and rofi_view_create().
RofiOrientation rofi_theme_get_orientation | ( | const widget * | widget, |
const char * | property, | ||
RofiOrientation | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the orientation indicated by property of the widget.
Definition at line 617 of file theme.c.
References _PropertyValue::b, _widget::name, P_INHERIT, P_ORIENTATION, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_orientation(), _widget::state, Property::type, and Property::value.
Referenced by box_create(), listview_create(), and rofi_theme_get_orientation().
RofiPadding rofi_theme_get_padding | ( | const widget * | widget, |
const char * | property, | ||
RofiPadding | pad | ||
) |
widget | The widget to query |
property | The property to query. |
pad | The default value. |
Obtain the padding of the widget.
Definition at line 699 of file theme.c.
References _PropertyValue::i, _widget::name, P_INHERIT, P_PADDING, _PropertyValue::padding, _widget::parent, ROFI_HL_SOLID, ROFI_PU_PX, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_padding(), _widget::state, Property::type, and Property::value.
Referenced by rofi_theme_get_padding(), widget_init(), and widget_set_state().
int rofi_theme_get_position | ( | const widget * | widget, |
const char * | property, | ||
int | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the position of the widget.
Definition at line 546 of file theme.c.
References _PropertyValue::i, _widget::name, P_INHERIT, P_POSITION, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_position(), _widget::state, Property::type, and Property::value.
Referenced by rofi_theme_get_position(), and rofi_view_calculate_window_position().
const char* rofi_theme_get_string | ( | const widget * | widget, |
const char * | property, | ||
const char * | def | ||
) |
widget | The widget to query |
property | The property to query. |
def | The default value. |
Obtain the string of the widget.
Definition at line 634 of file theme.c.
References _widget::name, P_INHERIT, P_STRING, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_string(), _PropertyValue::s, _widget::state, Property::type, and Property::value.
Referenced by __create_window(), icon_create(), rofi_theme_get_string(), textbox_create(), and textbox_initialize_font().
gboolean rofi_theme_is_empty | ( | void | ) |
Checks if a theme is set, or is empty.
Definition at line 799 of file theme.c.
References ThemeWidget::num_widgets, ThemeWidget::properties, and rofi_theme.
Referenced by main().
char* rofi_theme_parse_prepare_file | ( | const char * | file, |
const char * | parent_file | ||
) |
file | File name to prepare. |
parent_file | Filename of parent file. |
Tries to find full path relative to parent file.
Definition at line 950 of file theme.c.
References rofi_expand_path().
void rofi_theme_print | ( | ThemeWidget * | widget | ) |
widget | The widget handle. |
Print out the widget to the commandline.
Definition at line 352 of file theme.c.
References rofi_theme_print_index().
Referenced by main().
|
static |
Definition at line 160 of file theme.c.
References RofiDistance::distance, printf_double(), ROFI_HL_DASH, ROFI_PU_PERCENT, ROFI_PU_PX, RofiDistance::style, and RofiDistance::type.
Referenced by int_rofi_theme_print_property().
|
static |
Definition at line 301 of file theme.c.
References Property::name, ThemeWidget::name, ThemeWidget::parent, and rofi_theme_print_property_index().
Referenced by rofi_theme_print().
|
static |
Definition at line 292 of file theme.c.
References depth, int_rofi_theme_print_property(), and Property::name.
Referenced by rofi_theme_print_index().
p | The property to free. |
Definition at line 83 of file theme.c.
References _PropertyValue::def_value, _PropertyValue::link, _PropertyValue::list, _PropertyValue::name, Property::name, P_LINK, P_LIST, P_STRING, _PropertyValue::ref, rofi_g_list_strdup(), rofi_theme_property_copy(), rofi_theme_property_create(), _PropertyValue::s, Property::type, and Property::value.
Referenced by rofi_theme_copy_property_int(), and rofi_theme_property_copy().
Property* rofi_theme_property_create | ( | PropertyType | type | ) |
Properties
Definition at line 77 of file theme.c.
References Property::type.
Referenced by rofi_theme_property_copy().
void rofi_theme_property_free | ( | Property * | p | ) |
p | The property to free. |
Free the content of the property.
Definition at line 109 of file theme.c.
References _PropertyValue::def_value, _PropertyValue::link, _PropertyValue::name, Property::name, P_LINK, P_STRING, rofi_theme_property_free(), _PropertyValue::s, Property::type, and Property::value.
Referenced by rofi_theme_property_free(), and rofi_theme_widget_add_properties().
void rofi_theme_reset | ( | void | ) |
Reset the current theme.
Definition at line 127 of file theme.c.
References ThemeWidget::name, rofi_theme, and rofi_theme_free().
|
static |
Definition at line 461 of file theme.c.
References _PropertyValue::def_value, depth, _PropertyValue::link, _PropertyValue::name, Property::name, P_LINK, ThemeWidget::properties, _PropertyValue::ref, rofi_theme, Property::type, and Property::value.
Referenced by rofi_theme_find_property().
void rofi_theme_widget_add_properties | ( | ThemeWidget * | widget, |
GHashTable * | table | ||
) |
widget | The widget handle. |
table | HashTable containing properties set. |
Merge properties with widgets current property.
Definition at line 408 of file theme.c.
References rofi_theme_copy_property_int(), and rofi_theme_property_free().
void yyerror | ( | YYLTYPE * | yylloc, |
const char * | what, | ||
const char * | s | ||
) |
yylloc | The file location. |
what | What we are parsing, filename or string. |
s | Error message string. |
Error handler for the lex parser.
Definition at line 382 of file theme.c.
References rofi_add_error_message().
void yylex_destroy | ( | void | ) |
Destroy the internal of lex parser.
int yyparse | ( | ) |
Main lex parser.
const char* const WindowLocationStr[9] |
Textual representation of Window Location
Definition at line 178 of file theme.c.
Referenced by int_rofi_theme_print_property().
FILE* yyin |
Global handle input file to flex parser.