diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-01-09 00:09:02 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-01-09 00:09:02 +0100 |
commit | 713d41f619a1a8b311c3028a97e909e79cf88353 (patch) | |
tree | 8f30db8856307c2ebbc156573fc1dfc54969ba21 /include | |
parent | baab2047adf24642cbc727b50a77dc544e934a76 (diff) |
Allow matching highlighting to be set. Fixes #522
Diffstat (limited to 'include')
-rw-r--r-- | include/helper.h | 4 | ||||
-rw-r--r-- | include/theme.h | 42 |
2 files changed, 44 insertions, 2 deletions
diff --git a/include/helper.h b/include/helper.h index af93aece..3398c0ef 100644 --- a/include/helper.h +++ b/include/helper.h @@ -3,6 +3,7 @@ #include "rofi.h" #include <pango/pango.h> +#include <theme.h> /** * @defgroup HELPERS Helpers */ @@ -195,6 +196,7 @@ char * rofi_force_utf8 ( gchar *data, ssize_t length ); char * rofi_latin_to_utf8_strdup ( const char *input, gssize length ); /** + * @param th The ThemeHighlight * @param tokens Array of regexes used for matching * @param input The input string to find the matches on * @param retv The Attribute list to update with matches @@ -203,6 +205,6 @@ char * rofi_latin_to_utf8_strdup ( const char *input, gssize length ); * * @returns the updated retv list. */ -PangoAttrList *token_match_get_pango_attr ( GRegex **tokens, const char *input, PangoAttrList *retv ); +PangoAttrList *token_match_get_pango_attr ( ThemeHighlight th, GRegex **tokens, const char *input, PangoAttrList *retv ); /*@}*/ #endif // ROFI_HELPER_H diff --git a/include/theme.h b/include/theme.h index c1d187f0..37cdf29c 100644 --- a/include/theme.h +++ b/include/theme.h @@ -5,6 +5,21 @@ #include <widgets/widget.h> #include <settings.h> +/** Style of text highlight */ +typedef enum +{ + /** no highlight */ + HL_NONE = 0, + /** bold */ + HL_BOLD = 1, + /** underline */ + HL_UNDERLINE = 2, + /** italic */ + HL_ITALIC = 4, + /** color */ + HL_COLOR = 8 +} HighlightStyle; + /** Style of line */ typedef enum { @@ -69,6 +84,8 @@ typedef enum P_LINK, /** Position */ P_POSITION, + /** Highlight */ + P_HIGHLIGHT, } PropertyType; /** @@ -98,6 +115,16 @@ typedef struct } Padding; /** + * Theme highlight. + */ +typedef struct +{ + /** style to display */ + HighlightStyle style; + /** Color */ + ThemeColor color; +} ThemeHighlight; +/** * Property structure. */ typedef struct Property @@ -128,7 +155,9 @@ typedef struct Property char *name; /** Cached looked up ref */ struct Property *ref; - } link; + } link; + /** Highlight Style */ + ThemeHighlight highlight; } value; } Property; /** @@ -321,6 +350,17 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t Padding rofi_theme_get_padding ( const widget *widget, const char *property, Padding pad ); /** + * @param widget The widget to query + * @param property The property to query. + * @param th The default value. + * + * Obtain the highlight . + * + * @returns The highlight of this property for this widget. + */ +ThemeHighlight rofi_theme_get_highlight ( widget *widget, const char *property, ThemeHighlight th ); + +/** * @param d The distance handle. * @param ori The orientation. * |